timezone set to n/a on ubuntu core

Bug #1733881 reported by Sergio Cazzolato
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Confirmed
Undecided
Unassigned

Bug Description

In ubuntu core then I run the command timedatectl I see the timezone description set to n/a

test@localhost:~$ timedatectl
      Local time: Tue 2017-03-14 20:12:11 UTC
  Universal time: Tue 2017-03-14 20:12:11 UTC
        RTC time: n/a
       Time zone: n/a (UTC, +0000)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

In /etc/timezone I see "Etc/UTC"

It can be reproduced in pi3 stable/beta image

Related branches

description: updated
Revision history for this message
Oliver Grawert (ogra) wrote :

There are two issues here IMHO ...

first of all the test should actually look for the timezone, not at the description ... i.e. the first value before the commma between the brackets, since that is what is also used internally by i.e. the date command ...

second i think we should simply make /etc/timezone default to "UTC" instead of "Etc/UTC" at build time, that gives us a sane default and will result in:

Time zone: UTC (UTC, +0000)

Revision history for this message
Adam Conrad (adconrad) wrote :

This looks like it's probably a bug in xenial's systemd? Not sure why anyone cares deeply about the output of "timedatectl", but on bionic, I get:

(base)root@nosferatu:/etc# ls -l localtime
lrwxrwxrwx 1 root root 27 Nov 22 15:34 localtime -> /usr/share/zoneinfo/Etc/UTC
(base)root@nosferatu:/etc# cat timezone
Etc/UTC
(base)root@nosferatu:/etc# timedatectl
                      Local time: Wed 2017-11-22 15:36:25 UTC
                  Universal time: Wed 2017-11-22 15:36:25 UTC
                        RTC time: Wed 2017-11-22 15:36:25
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Revision history for this message
Adam Conrad (adconrad) wrote :

Oh, no, this probably isn't a systemd bug at all, this is probably due to you not having an /etc/localtime AT ALL. Which timedatectl won't be happy about, and will list as "n/a". Because you've literally not set a timezone.

(Note that /etc/timezone is just human-friendly input into tools that set timezones, /etc/localtime is the actual timezone, which usually either points to tzdata content, or contains a zonefile itself... If neither of these is true, then your timezone really is "unset", or "n/a", but defaults to UTC, so timedatectl is being accurate here)

Revision history for this message
stinger (dev-t) wrote :

@adconrad you are wrong,
If i set my timezone via timedatectl to Europe/Berlin, I get:

dev-t@pi3:~$ cat /etc/timezone
Europe/Berlin
dev-t@pi3:~$ ls -l /etc/timezone
lrwxrwxrwx 1 root root 22 Nov 27 05:24 /etc/timezone -> /etc/writable/timezone

dev-t@pi3:~$ date
Mon Nov 27 17:16:18 CET 2017

dev-t@pi3:~$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 23 Nov 27 05:24 /etc/localtime -> /etc/writable/localtime

dev-t@pi3:~$ timedatectl
      Local time: Mon 2017-11-27 16:16:05 UTC
  Universal time: Mon 2017-11-27 16:16:05 UTC
        RTC time: n/a
       Time zone: n/a (UTC, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

dev-t@pi3:~$ ls -l /etc/hostname
lrwxrwxrwx 1 root root 22 Nov 27 05:24 /etc/hostname -> /etc/writable/hostname
dev-t@pi3:~$ hostnamectl
   Static hostname: pi3
         Icon name: computer
        Machine ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
           Boot ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  Operating System: Ubuntu Core 16
            Kernel: Linux 4.4.0-1077-raspi2
      Architecture: arm

Changed in snappy:
status: New → Confirmed
Revision history for this message
Adam Conrad (adconrad) wrote :

I'm not sure which part of your response showed that I was "wrong". Does /etc/localtime point to a zoneinfo file? What is the content of /etc/writable/localtime?

Revision history for this message
Oliver Grawert (ogra) wrote :

due to the nature of ubuntu-core we can not directly point to a zone file

there is no overlay fs due to the use of apparmor, /etc is not writable as a whole and we only have single files bind mounted ... for hostname, localtime and timezone we proxy the linking via the /etc/writable bind-mount, the link in there should definitely point to a zone file but i think timedatectl is actually not capable to handle multiple layers of symlinks by choice of upstream ...

Michael Vogt (mvo)
affects: snappy → snapd
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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