Ask Klaus

Ask Klaus

Article from Issue 193/2016
Author(s):

Klaus Knopper answers your Linux questions.

Good Morning Klaus,

I am using Knoppix 7.7 obtained from Linux Magazine. I boot from a boot-only CD to an 8GB memory stick with an encrypted Reiser partition. The OS remembers my trash can on the desktop settings, personalized desktop wallpaper, and new background color.

Although the date and time is remembered, my time zone is reset back to the default New York on every boot. This causes some confusion with email date/time stamps. Is there a cure for this? I would much prefer to remain permanently in Johannesburg.

Thanks for the great software.

ted

First, a more general answer: The system time in a Unix system is composed of elements from two resources: The interpretation of the battery-backed clock (which exists on most Intel/AMD architecture boards) and the localization settings, which determine the time offset to Greenwich mean time (GMT), or rather "Universal time" (UTC). Although your question is more about localization, I'll look at the battery-backed clock setting first.

Under Unix/Linux, it is common always to leave the BIOS/real-time clock time in Universal time (UTC) and let the system time be set by time zone settings automatically during boot. Under Windows it seems common instead to have the real-time clock in "local time," and even rewrite the real-time clock time during the daylight savings time switch. It is possible for both operating systems to change the default "BIOS" time interpretation to either "localtime" or UTC; however, it's probably easier to do this under Linux than it is to search for an appropriate setting or registry patch or change a system setting in Windows.

When a Linux system reads the time from the battery-backed real-time clock, it honors the file /etc/adjtime, which contains the word

UTC

in its last line if the BIOS time is expected in Universal time, or

LOCAL

if the BIOS time is stored as local time instead.

Changing this setting in /etc/adjtime will change Linux behavior when reading the battery-backed clock with hwclock -s during system start.

GNU/Linux systems will not write back their own system times to the BIOS automatically, unless instructed to do so during system shutdown, whereas Windows will do this frequently whenever time needs to be adjusted because of a winter or summer time change, so you might still experience differences when dual booting and it's time to switch between daylight savings and standard time.

Now the offset between this time reference and the local time adjustment determined by the time zone is set by a timezone file stored as /etc/timezone. Normally, this file is created just once during system installation when time zone settings are interactively queried, which can also be done at a later point (Figures 1-3) using the Debian command

sudo dpkg-reconfigure tzdata
Figure 1: Choosing the geographic area for tzdata.
Figure 2: Choosing the region for tzdata.
Figure 3: Setting and checking the timezone configuration from the shell.

Because Knoppix is distributed as a Live system, the standard setting is to interpret the battery-backed clock time in local time "as is," with no offset to universal time. For easy changeability for non-Unix experts (who most likely don't know about the settings mentioned above), the timezone setting offset is guessed from the lang variable (lang=en, lang=de, etc.) or set as an additional tz boot command-line option, such as

knoppix64 tz=Africa/Johannesburg

either typed on the boot screen for the current session or written to the APPEND option lines in boot/syslinux/syslinux.cfg (boot/syslinux/syslnx64.cfg in the UEFI boot variant for 64-bit and boot/syslinux/syslnx32.cfg for the UEFI 32-bit variant) on the Knoppix USB flash disk:

APPEND lang=de apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=Africa/Johannesburg

This is also (partly at least) documented in the knoppix-cheatcodes.txt file found in the KNOPPIX directory. To be on the safe side, you might want to add the timezone setting tz=area/region to all APPEND lines in the .cfg files.

For an uncompressed Knoppix hard disk installation, the same setting can be placed in the KERNEL configuration statement in the GRUB configuration file /boot/grub/menu.lst.

Now your special setup of the boot-only CD with a USB flash disk is only a little more complicated, because the boot settings are read from the boot-only CD's isolinux settings in boot/isolinux/isolinux.cfg, which is not easily changeable without remastering the CD.

For creating a new boot-only CD with changed settings, please do the following (Listing 1).

Listing 1

Creating a CD with Changed Boot Options

01 mount /media/sr0
02 cp -a /media/sr0 boot-cd
03 chmod -R +w boot-cd
04 nano boot-cd/boot/isolinux/isolinux.cfg
05 mkisofs -pad -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o boot-cd.iso boot-cd
06 cdrecord -v boot-cd.iso
  1. Mount the CD.
  2. Copy the CD content to a directory.
  3. Make the copied content writable.
  4. Change settings, and then save the file (Ctrl+X in Nano).
  5. Create a new bootable ISO (if your system does not have the mkisofs command, use genisoimage instead).
  6. Burn the new ISO image to a CD medium (use wodim if cdrecord is not available).

The new boot-only CD now contains the settings for your time zone.

The Author

Klaus Knopper is an engineer, creator of Knoppix, and co-founder of LinuxTag expo. He works as a regular professor at the University of Applied Sciences, Kaiserslautern, Germany. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of LinuxTag expo. He works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of LinuxTag expo. He works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

  • Ask Klaus!
  • Ask Klaus!

     

  • Knoppix 6.3 Exclusive!

    Knoppix creator (and Q&A mastermind) Klaus Knopper shares some insights on the latest release.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia