migrate UTC setting from /etc/default/rcS to adjtime

Bug #1541532 reported by Martin Pitt on 2016-02-03
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
installation-guide (Ubuntu)
Undecided
Unassigned
lupin (Ubuntu)
Undecided
Unassigned
mbr (Debian)
Fix Released
Unknown
mbr (Ubuntu)
Undecided
Martin Pitt
systemd (Ubuntu)
Undecided
Martin Pitt
sysvinit (Ubuntu)
Undecided
Unassigned
util-linux (Ubuntu)
Undecided
Unassigned

Bug Description

This has been an Ubuntu delta in systemd and perhaps other Ubuntu packages for a long time. But /etc/default/rcS is a SysV-ism, and no other setting in there is relevant. Steps:

 * Bump the version guard in systemd.conf for migrating the actual setting (keep until 16.04 LTS)
 * Ensure that we only look at the LOCAL setting during boot, and do no actual drift correction at boot, as the kernel does that by itself.
 * grep the archive for software which might directly look at or even write that file (Ubuntu specific config tools and the like).

Martin Pitt (pitti) on 2016-02-03
Changed in systemd (Ubuntu):
milestone: none → ubuntu-16.02
assignee: nobody → Martin Pitt (pitti)
status: New → Triaged
Martin Pitt (pitti) wrote :

> do no actual drift correction at boot, as the kernel does that by itself

I found that the only place which potentially would do that is /etc/init.d/hwclock.sh, but this would only be run under SysV init which we never supported and don't even have binary packages for. Under upstart, /etc/init/hwclock.conf uses --noadjfile and parses the UTC setting from /etc/default/rcS (that needs to be fixed), under systemd the file is masked and systemd itself parses the third line to determine UTC vs. LOCAL.

I'm currently running an archive grep for "default/rcS|adjtime" to find and review all users of either.

Martin Pitt (pitti) wrote :
Download full text (3.2 KiB)

Archive grep finished. I reviewed all matches of "default/rcS" and "adjtime", notes are below. "rcSNOUTC" means "sources /etc/default/rcS, but does not use UTC flag" (often uses VERBOSE, sometimes FSCKFIX)

These are the packages that need fixing:

installation-guide: drop our delta to revert docs to rcS
live-build: drop ubuntu-no-adjtime.patch
lupin: scripts/local-bottom/lupin_setup needs updating
mbr: install-mbr.c needs updating; affects Debian (#813671)
sysvinit: drop our delta of reverting adjtime migration
util-linux: adjust debian/util-linux.hwclock{,-save}.upstart; docs are already adjtime

upstart: some hits in init/tests/data/*.json, unclear if affected

These packages aren't affected or already use adjtime (there's 11 of them):

adjtimex: already uses adjtime, NOT rcS (so moving there is a bug fix)
aide: uses adjtime already
android: already uses adjtime, NOT rcS (so moving there is a bug fix)
aoetools: rcsNOUTC
apache-directory-server: rcsNOUTC
apache2: rcSNOUTC
apmd: just old documentation, hwclock functionality gone
apt-cacher-ng: rcSNOUTC
backuppc: rcSNOUTC
binfmt-support: rcSNOUTC
bootcd: documentation about SULOGIN, unrelated
bootchart: rcsNOUTC
busybox: already uses adjtime, NOT rcS (so moving there is a bug fix)
chrony: already uses adjtime, NOT rcS (so moving there is a bug fix)
cinnamon-settings-daemon: already uses adjtime, NOT rcS (so moving there is a bug fix)
clock-setup: already migrates to adjtime
cntlm: rcSNOUTC
conman: rcSNOUTC
cpufrequtils: rcsNOUTC
debian-lan-config: already uses adjtime, NOT rcS (so moving there is a bug fix)
deluge: rcsNOUTC
discover: rcsNOUTC
dracut: already uses adjtime
drbl: rcsNOUTC
elasticsearch: rcsNOUTC
etcd: rcsNOUTC
fai: already uses adjtime, NOT rcS (so moving there is a bug fix)
fail2ban: rcsNOUTC
fcheck: excludes adjtime from checks, unrelated
ffproxy: rcsNOUTC
flash-kernel: rcSNOUTC
friendly-recovery: rcSNOUTC
fs2ram: rcSNOUTC
fso-frameworkd: rcsNOUTC
haproxy: rcSNOUTC
ipmitool: rcSNOUTC
jetty: rcSNOUTC
krb5: rcSNOUTC
lintian: just test files
live-config: already uses adjtime, NOT rcS (so moving there is a bug fix)
livecd-rootfs: live-build/ubuntu-cpc/hooks/051-hwclock.chroot hack (irrelevant here, but might need updating)
lizardfs: rcsNOUTC
lm-sensors: rcSNOUTC
ltsp: rcSNOUTC
mailman: rcSNOUTC
mate-settings-daemon: already uses adjtime, NOT rcS (so moving there is a bug fix)
mediatomb: rcsNOUTC
metainit: rcsNOUTC
minbif: rcSNOUTC
mountall: rcSNOUTC
mpt-status: rcsNOUTC
munge: rcsNOUTC
obs-build: creates emtpy rcS file
openafs: rcsNOUTC
phonefsod: rcSNOUTC
powerman: rcSNOUTC
powerpc-utils: tool for actually setting time skew
procps: rcSNOUTC
propellor: rcSNOUTC
refpolicy: sets SELinux policy for adjtime, unrelated
root-system: rcsNOUTC
salt: supports both locations
samhain: already uses adjtime, NOT rcS (so moving there is a bug fix)
sblim-sfcb: rcsNOUTC
selinux-basics: rcSNOUTC
shinken: rcsNOUTC
shishi: rcsNOUTC
sudo: rcSNOUTC
tcos: already uses adjtime, NOT rcS (so moving there is a bug fix)
tmpreaper: rcSNOUTC
tomcat6: rcSNOUTC
tomcat7: rcSNOUTC
torque: rcsNOUTC
ubuntu-policy: does not document UTC field in either place
ushare: rcsNOUTC
web2py: rcSNOUTC
wfrog: rcsNOUTC
wicd: rc...

Read more...

Martin Pitt (pitti) wrote :

> live-build: drop ubuntu-no-adjtime.patch

Actually, this isn't about setting UTC vs. LOCAL, just about the actual time drift, so this can stay. Dropping task.

affects: installation-guide (Debian) → mbr (Debian)
Changed in installation-guide (Ubuntu):
status: New → Fix Committed
no longer affects: live-build (Ubuntu)
Martin Pitt (pitti) on 2016-02-04
Changed in util-linux (Ubuntu):
status: New → In Progress
Changed in sysvinit (Ubuntu):
status: New → In Progress
Changed in systemd (Ubuntu):
status: Triaged → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package installation-guide - 20160121ubuntu2

---------------
installation-guide (20160121ubuntu2) xenial; urgency=medium

  * en/appendix/chroot-install.xml: Revert Ubuntu delta about setting UTC in
    /etc/default/rcS instead of /etc/adjtime. (LP: #1541532)

 -- Martin Pitt <email address hidden> Thu, 04 Feb 2016 22:15:31 +0100

Changed in installation-guide (Ubuntu):
status: Fix Committed → Fix Released
Martin Pitt (pitti) on 2016-02-04
Changed in systemd (Ubuntu):
status: In Progress → Fix Committed
Changed in mbr (Debian):
status: Unknown → New
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lupin - 0.57

---------------
lupin (0.57) xenial; urgency=medium

  * Set UTC or LOCAL in /etc/adjtime for systemd (based on change by Roger
    Leigh in clock-setup 0.111; LP: #1541532).

 -- Colin Watson <email address hidden> Thu, 04 Feb 2016 23:12:04 +0000

Changed in lupin (Ubuntu):
status: New → Fix Released
Martin Pitt (pitti) on 2016-02-05
Changed in sysvinit (Ubuntu):
status: In Progress → Fix Committed
Changed in util-linux (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 228-5ubuntu3

---------------
systemd (228-5ubuntu3) xenial; urgency=medium

  * Revert Ubuntu delta about setting UTC in /etc/default/rcS instead of
    /etc/adjtime. (LP: #1541532)
  * Upgrade fix: systemd.postinst: Bump Version comparison for migrating the
    UTC setting from /etc/default/rcS to /etc/adjtime, to run it for upgrades
    to 16.04.

 -- Martin Pitt <email address hidden> Thu, 04 Feb 2016 23:11:39 +0100

Changed in systemd (Ubuntu):
status: Fix Committed → Fix Released
Martin Pitt (pitti) on 2016-02-05
Changed in mbr (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: New → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysvinit - 2.88dsf-59.3ubuntu2

---------------
sysvinit (2.88dsf-59.3ubuntu2) xenial; urgency=medium

  * Revert Ubuntu delta about setting UTC in /etc/default/rcS instead of
    /etc/adjtime. (LP: #1541532)
  * debian/control: Add Breaks: systemd (<< 228-5ubuntu3) to initscripts to
    ensure that we upgrade systemd before, so that this can migrate the UTC
    setting. (This used to be done by util-linux, but having it in systemd is
    a smaller delta.)

 -- Martin Pitt <email address hidden> Thu, 04 Feb 2016 22:29:08 +0100

Changed in sysvinit (Ubuntu):
status: Fix Committed → Fix Released
Martin Pitt (pitti) on 2016-02-05
Changed in mbr (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mbr - 1.1.11-5ubuntu1

---------------
mbr (1.1.11-5ubuntu1) xenial; urgency=medium

  * install-mbr.c: Read "RTC is in local time" setting from /etc/adjtime
    instead of /etc/default/rcS. (Closes: #813671, LP: #1541532)

 -- Martin Pitt <email address hidden> Fri, 05 Feb 2016 13:40:36 +0100

Changed in mbr (Ubuntu):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package util-linux - 2.27.1-1ubuntu4

---------------
util-linux (2.27.1-1ubuntu4) xenial; urgency=medium

  * debian/util-linux.hwclock{,-save}.upstart: Check /etc/adjtime for UTC
    setting instead of /etc/default/rcS. (LP: #1541532). Also include
    /etc/default/hwclock as that may also contain the $BADYEAR setting.

 -- Martin Pitt <email address hidden> Thu, 04 Feb 2016 22:55:01 +0100

Changed in util-linux (Ubuntu):
status: Fix Committed → Fix Released
Doug Smythies (dsmythies) wrote :

The claim in comment number #4 is:
> This bug was fixed in the package installation-guide - 20160121ubuntu2
Then why can I not find the master source code at:
https://code.launchpad.net/~ubuntu-core-dev/installation-guide/ubuntu
?

Alkis Georgopoulos (alkisg) wrote :

With the switch to configure UTC from /etc/adjtime instead of /etc/default/rcS, I'm having the following regression:

I've installed Xenial some months ago and it's fully updated.
Without customizing it, my /etc/adjtime reads:
0.0 0 0
0

The regression is this:
# timedatectl set-local-rtc 1
Failed to set local RTC: Failed to set RTC to local/UTC: Input/output error

I can work around the issue with two ways:
1) Completely delete /etc/adjtime. Then `timedatectl set-local-rtc 1` generates it, and `timedatectl set-local-rtc 0` deletes it with no errors.
2) Add "LOCAL" or "UTC" to the end of /etc/adjtime. Then again `timedatectl set-local-rtc XXX` works as expected.

Am I supposed not to have that file?
Should I file a bug report against systemd so that it doesn't have parse errors if the LOCAL/UTC keyword is missing?

Hello Alkis,

Alkis Georgopoulos [2016-02-16 11:16 -0000]:
> Am I supposed not to have that file?

There are several tools and packages which set/use it, so it's
plausible that it's already there.

> Should I file a bug report against systemd so that it doesn't have
> parse errors if the LOCAL/UTC keyword is missing?

Indeed this is a bug in timedated. If you could report this upstream,
that would be great, thanks!

Alkis Georgopoulos (alkisg) wrote :

Hi Martin,

I reported it here: https://github.com/systemd/systemd/issues/2638

We also need to fix this in the systemd packaging in Debian/Ubuntu:
# grep printf /var/lib/dpkg/info/systemd.postinst
        printf "0.0 0 0.0\n0\nLOCAL" > /etc/adjtime

This is similar to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699554
and it should have a newline at the end:
        printf "0.0 0 0.0\n0\nLOCAL\n" > /etc/adjtime

Thanks!

bzipitidoo (bzipitidoo) wrote :

A few days ago, I upgraded a dual boot system from Lubuntu 15.10 to 16.04, and could not get the system to accept that the clock was set to the local timezone, not UTC. The upgrade stripped the UTC setting from /etc/default/rcS:

# assume that the BIOS clock is set to UTC time (recommended)
UTC=no

I put the UTC variable setting back in /etc/default/rcS, as advised many search results on this problem, and it had no effect. Now I find this bug report. Checking, my system had no /etc/adjtime file. Shouldn't this file have been created during the upgrade? It was created when I ran "timedatectl set-local-rtc 1" manually.

Martin Pitt (pitti) wrote :

bzipitidoo [2016-05-13 20:35 -0000]:
> Checking, my system had no /etc/adjtime file. Shouldn't
> this file have been created during the upgrade?

Yes, it should. There are some upgrade scenarios where it isn't
though, and unfortunately that is painfully hard to fix. This is being
tracked in bug 1572752.

Changed in mbr (Debian):
status: New → Fix Committed
Changed in mbr (Debian):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.