Tag Archives: pi

In the zone

The default time zone for Raspbian – which is the Linux distribution I installed on the Raspberry Pi – is UTC; this is not terribly convenient for somebody living in Illinois, so the other day I set about changing the Pi’s time zone to CST.

This proved…interesting.

There are a great many ways to set the time zone in Linux. One is user-specific, the others are global but don’t always work on all platforms. Some work, but disappear after a while.

Method #1

Run the tzselect utility. It will ask some questions, then spit out a line that looks like this:

TZ='America/Chicago'; export TZ

Add this line to ~/.profile and you’re done.

This only changes the time zone for the current user. (How many Raspberry Pi machines have multiple user accounts?) The system time zone remains UTC. And support-forum chatter suggests fooling with the TZ environment variable is deprecated.

Method #2

The system time is controlled by /etc/localtime. Overwrite it with the appropriate file from /usr/share/zoneinfo:

sudo cp /usr/share/zoneinfo/America/Chicago /etc/localtime

On some distributions, /etc/localtime is overwritten on system restart. Oops.

Other options

I’ve seen these proposed:

  • Edit /etc/rc.conf
  • Run tzset or tzconfig
  • (On Raspbian) run sudo dpkg-reconfigure tzdata

I went with the /etc/localtime method. It may not be the officially-blessed method – I’m not convinced that such a thing even exists – but it works.

Raspberry Pi

This year, Santa brought me a Raspberry Pi, which is a teeny-tiny computer that runs Linux¬†(How small is it? I’ve eaten cookies that were larger that the Raspberry Pi.)¬†This evening, I powered it up for the first time. It works:

pi@pi ~ $ uptime
02:49:03 up 1:53, 1 user, load average: 0.09, 0.08, 0.07

Getting it on the network required a bit of foolery. I had to edit /etc/network/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0 inet dhcp
wpa-ssid name
wpa-psk password

Attempts to find usable, up-to-date documentation for this file have met with little success. It’s all voodoo. I read some web pages, guessed about a few things, and – presto! – it worked.