Setting System Time & Date on Debian Gnu-Linux and Open Firmware

Having your BIOS or Open Firmware set to an erroneous date may result in unexpected behaviour. For instance, after a prolonged power outage (and on an iMac DV running Debian Gnu-Linux) I found the Midori browser would fail to start, presumably because it uses the computer held date (which is linked to the computer clock) to retrieve the previous browsing session. Also, Bfilter would behave erratically, consuming most of the CPU. In the extreme case known to myself, startup would evoke a chime but wouldn’t start booting despite having recently replaced the battery. Lastly, when trying to update with aptitude  I received the following error, “GPG error … The following signatures were invalid … You may want to run apt-get update to correct these problems””. Despite that I’d just replaced the battery,  Debian reported it was 1904. I figured the computer clock not being set to the correct time/date was due to a prolonged power outage.

As iMacs run with Open Firmware (OF, not BIOS as PCs do), I originally set out to learn how to set the date through the OF prompt. I found there to be little information on OF. Considering that PPC hardware were never taken up by the masses, beyond Apple and IBM server (and today by gaming station) fans, this is of little surprise. Thus, I endeavoured to write an article on how to set time and date on any Linux based operating system, although I eventually found some OF instructions with which to conclude this article. Of course, this is only of use if you can eventually get your system booted.

In my case, I assumed the new battery was faulty. So in an attempt to reset some Open Firmware settings without cracking open the computer (and considering that at this point I could not reset PRAM via the keyboard), I unplugged the computer for a few days, pressed the power button (and out of desperation even pressed the reset side button) –not necessarily in that order. Simply unplugging it for 15-20 minutes (the poor man’s way of resetting power management) did not work –probably because the battery was/is not entirely drained, and so it retained faulty OF settings. I assume opening up the iMac DV and taking out the battery for the same alloted time would have worked, too, but I hadn’t gotten to that.

Observation: I should assume that if PRAM settings resolved to a bootable configuration after 3 days of having the computer unplugged, my new battery probably is faulty and in need of replacement –barring that pressing the power button on an unplugged iMac DV and the reset button helped in some way. Subsequent reboots will tell.

First off and as usual, Debian offers an easy terminal/console configuration utility (see below) without resorting to sluggish KDE, Gnome, XFCE utilities, or “my” line command instructions (further below). If you’re using an ultra-Spartan distro or install without a bloated desktop environment, then the line command solution I present should be of service. (I successfully use it on Debian.)

The easiest thing to do is to install ntp and ntpdate, so the time/date utility synchronize with time servers.

The Debian Way

# dpkg-reconfigure tzdata

# ntpdate-debian

If you don’t have ntpdate, install through:

# apt-get install ntpdate

# ntpdate-debian

“My” line command solution

First check your date at with line command.

$ date

This should output something such as this.

$ Fri Jan 15 02:30:08 MST 2010

The syntax used in the output above is as so.

<day> <month> <date> <hour:minutes:seconds> <timezone> <year>

If your time is correct but the date is wrong, correct it as in the following example where the setting is January 15, 2010.

# date –set <year>-<month>-<day>


# date –set 2010-01-15

You should also set the actual time of the day.

# date –set <hour>:<minutes>:<seconds>


# date –set 16:22:0

I’ve read that the above can be set in one line with the following format.

# date -s ‘// ::’

The “set” flag seems to be interchangeable with “s”. Notice this format uses single quotes where the examples above don’t, and (lastly) the following uses a different format for the month, day, year section (in terms of order and “/” rather than “-” as separators). Yes, this seems to be an inconsistency.

Yet, another way might be the following one –being consistent to the out-put format of the date command. Leave the timezone out of the above if it’s already set correctly. (Notice abbreviations used.)

# date –set='<weekday> <month> <day> <hour>:<minutes>:<seconds> <timezone> <year>’


# date –set=’Wed FEB 16 12:12:12 CST 2009′

Of interest to Chileans, at one time the time zone for Chile was SMT. In contrast, it’s now CLT. This means a dead (or a mal-configured) battery may show an output (to $ date) of “Mon Jan  4 21:30:36 SMT 1904”, but “Sat Mar 28 08:36:14 CLT 2009” after setting the year (and this without inputting a timezone).

Syncing the OS time

Whichever format you choose to use to set the correct time to Gnu-Linux, you’ll need to sync this to you computer firmware (be it a Open Firmware, or BIOS machine). Do this with the following command.

# clock -w

There’s also the following line command.

# hwclock –systohc –utc

but that may give you

# hwclock –systohc –utc

RTC_RD_TIME: Invalid argument

ioctl() to /dev/rtc0 to read the time failed.

as it did to me.

Apparently hwclock is BIOS machine specific (CMOS to be specific), while clock is related to Open Firmware (PPC computers).

Timezone (if needed)

Look at the output of date command, again. If the timezone part is off –and the above hasn’t worked, although not my experience– you’ll need to adjust it in another fashion. You’ll need to link your zone setting (found under /usr/share/zoneinfo/) to /etc/localtime. First off, locate your timezone (within /usr/share/zoneinfo). Keep that pathway present. Note: If you don’t know what a particular timezone abbreviation means, google it (ie., google the following timezone MST).

Second, see if /etc/localtime exists.

$ ls /etc/ | grep localtime

If it does exist (the above command will show output). Then link that to /etc/localtime. My example is Edmonton, Canada.

$ ln -s /usr/share/zoneinfo/America/Edmonton /etc/localtime

Subsequent boots may disconfigure things. If that’s the case, you’ll want to link the kernal clock to the Open Firmware clock.

# echo “clock -s” > /sbin/hwclock

# chmod +x /sbin/hwclock

Open Firmware (PPC Macs and IBM PPC)

The following information is solely pertinent to PPC users and not Gnu-Linux specific.

As mentioned previously, when I first started researching this, I wanted to “enter” Open Firmware –via the keyboard shortcut command+option+o+f– and set the time therein. Although, I hadn’t read about it, I knew it was theoretically possible and I preferred it to the “mess” of Gnu-Linux commands that there surely was –as you can now well confirm from the above. Well, if you look long enough or closely enough, you’ll find what you want. In my case, I found what I was looking for, but not untill well after writing the above. Still, the above is not a waste –as it enables an user to configure time in any Gnu-Linux installed computer. Just the same, owners of older Apple computers and IBM PPC (and perhaps PPC game station) users may prefer to set time in the familiar Open Firmware command prompt.

Setting time via Open Firmware

0 > time&date <hh>:<mm>:<ss> <mm>/<dd>/<yyyy>

or, although problems have been reported with the following,

0 > decimal dev <rtc>

as in the following.

0 > decimal dev rtc 10 15 23 31 12 2005 set-time


Maurice Cepeda






Also see “man date”.

All rights reserved. All brands mentioned are properties of their respective owners. This article does not guarantee nor does it insinuate results of any sort –as it’s written under the WFM (Works For Me) premise, and for informational purposes. By reading this article, the reader forgoes any accountability of the writer. The reading of this article implies acceptance of the above stipulations.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s