Bug 885246 - On Live CD /etc/localtime not a symlink to a time zone file
Summary: On Live CD /etc/localtime not a symlink to a time zone file
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: livecd-tools
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-07 21:50 UTC by Steve Tyler
Modified: 2014-02-05 23:18 UTC (History)
15 users (show)

Fixed In Version: livecd-tools-18.15-1
Clone Of:
Environment:
Last Closed: 2014-02-05 23:18:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
/var/log/messages with systemd message about /etc/localtime (76.98 KB, text/plain)
2012-12-07 21:54 UTC, Steve Tyler
no flags Details
strace-livecd-creator-snippet-1.txt (6.03 KB, text/plain)
2013-01-16 06:16 UTC, Steve Tyler
no flags Details

Description Steve Tyler 2012-12-07 21:50:35 UTC
Description of problem:
On the F18-Beta Live CD, /etc/localtime is a time zone file instead of a symlink to a time zone file. systemd expects /etc/localtime to be a symlink, and when it is not, Date & Time in System Settings incorrectly shows Europe/London instead of America/New_York.

Version-Release number of selected component (if applicable):
Fedora-18-Beta-x86_64-Live-Desktop.iso

How reproducible:
Always.

Steps to Reproduce:
1. Boot Live CD.
2. Start System Settings (gnome-control-center).
3. Click Date & Time.
  
Actual results:
Time zone is Europe/London.

Expected results:
Time zone is America/New_York.

Additional info:
The timedatectl commands reports "n/a" for the time zone.

[liveuser@localhost ~]$ ls -lF /etc/localtime
-rw-r--r--. 1 root root 3519 Oct 23 10:23 /etc/localtime
[liveuser@localhost ~]$ date
Fri Dec  7 16:27:12 EST 2012
[liveuser@localhost ~]$ zdump /etc/localtime
/etc/localtime  Fri Dec  7 16:27:22 2012 EST
[liveuser@localhost ~]$ timedatectl
      Local time: Fri, 2012-12-07 16:27:31 EST
  Universal time: Fri, 2012-12-07 21:27:31 UTC
        RTC time: Fri, 2012-12-07 21:27:31
        Timezone: n/a
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no

Tested with:
$ qemu-kvm -m 2048 -hda f18-test-1.img -cdrom ~/xfr/fedora/F18/F18-Beta/Final/Fedora-18-Beta-x86_64-Live-Desktop.iso -usb -vga qxl -boot menu=on -usbdevice mouse

Comment 1 Steve Tyler 2012-12-07 21:54:28 UTC
Created attachment 659617 [details]
/var/log/messages with systemd message about /etc/localtime

[snippet from attached /var/log/messages]
...
Dec  7 16:26:17 localhost systemd-timedated[1746]: /etc/localtime should be a symbolic link to a timezone data file in /usr/share/zoneinfo/.
...

Comment 2 Brian Lane 2012-12-10 18:27:28 UTC
livecd-creator checks to see whether /etc/localtime is a symlink or not before it makes changes. So if this is wrong it is caused by whatever is writing the original /etc/localtime file/symlink, not livecd-creator.

See commit:
http://git.fedorahosted.org/cgit/livecd/commit/?h=f18-branch&id=e346b72bbb9aa8067b84ea0da4cd288ba35df37c

Taking a second look at that, it should probably fall back to symlink instead of copying. It looks like systemd is providing /etc/localtime so reassigning there.

Comment 3 Steve Tyler 2012-12-11 05:07:42 UTC
(In reply to comment #2)
> ... it is caused by whatever is writing the original /etc/localtime file/symlink ...

Thanks for pointing that out.

system-config-date was writing a time zone file instead of a symlink:
Bug 824033 - RFE: Make /etc/localtime a symlink
Bug 863676 - /etc/localtime link overwritten with incorrect timezone file during firstboot

That bug was fixed in system-config-date-1.10.2-1, which was pushed to stable 2012-11-02:
https://admin.fedoraproject.org/updates/FEDORA-2012-16696/system-config-date-1.10.2-1.fc18,python-slip-0.2.21-1.fc18

The Live CD has those versions:
system-config-date-1.10.2-1.fc18
python-slip-0.2.21-1.fc18

And:
systemd-195-8.fc18

Comment 4 Lennart Poettering 2013-01-13 23:02:57 UTC
OK, since this is apparently closed in s-c-d I guess I can close this now?

Comment 5 Steve Tyler 2013-01-14 03:56:00 UTC
This is not fixed on the F18 Final Live CD.
/etc/localtime is a file and not a symlink.
Reopening until I can verify that it is fixed post F18.

Brian and Lennart: You guys are the experts. What component is responsible for creating /etc/localtime on the Live CD?

Revising bug summary to make it clear that this bug applies to the Live CD:
On Live CD /etc/localtime not a symlink to a time zone file

Tested in a VM with:
$ qemu-kvm -m 2048 -hda f18-test-2.img -cdrom ~/xfr/fedora/F18/F18-Final/Final/Fedora-18-x86_64-Live-Desktop.iso -vga qxl -boot menu=on -usbdevice mouse

Comment 6 Lennart Poettering 2013-01-14 17:59:28 UTC
(In reply to comment #5)
> This is not fixed on the F18 Final Live CD.
> /etc/localtime is a file and not a symlink.
> Reopening until I can verify that it is fixed post F18.
> 
> Brian and Lennart: You guys are the experts. What component is responsible
> for creating /etc/localtime on the Live CD?

I am hardly an expert on the livecd. I have no clue.

Comment 7 Brian Lane 2013-01-14 19:44:01 UTC
see comment 2.

livecd-creator uses yum to install the packages, then it looks at what is there to decide whether or not to use symlink or file replacement. It would appear that systemd is creating a file.

Comment 8 Steve Tyler 2013-01-14 20:14:30 UTC
What happens if /etc/localtime does not exist?

$ less -N livecd-tools-18.14/imgcreate/kickstart.py
...
    152         # /etc/localtime is a symlink with glibc > 2.15-41
    153         if os.path.islink(self.path("/etc/localtime")):
    154             os.unlink(self.path("/etc/localtime"))
    155             os.symlink("/usr/share/zoneinfo/%s" %(tz,),
    156                        self.path("/etc/localtime"))
    157         else:
    158             try:
    159                 shutil.copy2(self.path("/usr/share/zoneinfo/%s" %(tz,)),
    160                                 self.path("/etc/localtime"))
    161             except (OSError, shutil.Error) as e:
    162                 logging.error("Error copying timezone: %s" %(e.strerror,))
...


Source is here:
http://git.fedorahosted.org/cgit/livecd

Comment 9 Steve Tyler 2013-01-14 20:22:41 UTC
(In reply to comment #8)
...
> Source is here:
> http://git.fedorahosted.org/cgit/livecd

BTW, the link to livecd at http://git.fedorahosted.org/ is broken:
http://git.fedorahosted.org/git/livecd

Comment 10 Brian Lane 2013-01-14 20:31:55 UTC
Again, see comment 2. Right now it is falling back to file, but really it should fall back to symlink. But that isn't going to help when there is already a file there.

Comment 11 Lennart Poettering 2013-01-14 21:13:36 UTC
(In reply to comment #10)
> Again, see comment 2. Right now it is falling back to file, but really it
> should fall back to symlink. But that isn't going to help when there is
> already a file there.

But where does that file come from?

Comment 12 Brian Lane 2013-01-14 21:54:57 UTC
oops, didn't mean to make that comment private.

rpm says systemd owns that file:

$ rpm -qf /etc/localtime
systemd-195-13.fc18.x86_64

Comment 13 Steve Tyler 2013-01-14 22:31:12 UTC
Confirmed with an updated F18 install.
/etc/localtime is an empty file in the systemd package:

[joeblow@localhost ~]$ rpm -qlv systemd | grep localtime
-rw-r--r--    1 root    root                        0 Jan  3 14:51 /etc/localtime
-rw-r--r--    1 root    root                      965 Jan  3 14:51 /usr/share/man/man5/localtime.5.gz
[joeblow@localhost ~]$ rpm -q systemd
systemd-195-15.fc18.x86_64

Comment 14 Lennart Poettering 2013-01-15 23:20:25 UTC
(In reply to comment #12)
> oops, didn't mean to make that comment private.
> 
> rpm says systemd owns that file:
> 
> $ rpm -qf /etc/localtime
> systemd-195-13.fc18.x86_64

But systemd only ghosts it, so that if it exists it is owned by some package.

But this bug is about it being existant as a regular file, so who created it on the livecds? systemd didn't...

Comment 15 Brian Lane 2013-01-16 00:04:51 UTC
Is there a way to get rpm to show non-ghost ownership of files? On f15 it was owned by glibc, but they seem to have dropped it for f18.

Comment 16 Steve Tyler 2013-01-16 06:16:27 UTC
Created attachment 679376 [details]
strace-livecd-creator-snippet-1.txt

strace shows that /etc/localtime does not exist before livecd-creator creates it.

Both lstat() and stat() return -1 ENOENT (No such file or directory) for:
"/var/tmp/imgcreate-qfRHDC/install_root/etc/localtime"

Subsequently, livecd-creator creates it by copying from:
"/var/tmp/imgcreate-qfRHDC/install_root/usr/share/zoneinfo/US/Eastern"

In the attachement, the first column is the line number in the full strace log, which is 1.6 GB. The snippet includes some surrounding records to provide context.

strace command:
# strace -tt -f -s 256 -o x1.strace livecd-creator -v --nocleanup -c /usr/share/spin-kickstarts/fedora-live-mini.ks

Comment 17 Jóhann B. Guðmundsson 2013-01-16 10:36:38 UTC
(In reply to comment #14)
> (In reply to comment #12)
> > oops, didn't mean to make that comment private.
> > 
> > rpm says systemd owns that file:
> > 
> > $ rpm -qf /etc/localtime
> > systemd-195-13.fc18.x86_64
> 
> But systemd only ghosts it, so that if it exists it is owned by some package.
> 
> But this bug is about it being existant as a regular file, so who created it
> on the livecds? systemd didn't...

It might also be done in the ks file itself for the relevant spin

Comment 18 Brian Lane 2013-01-16 19:09:30 UTC
Thanks for tracking that down Steve.

Comment 19 Fedora Update System 2013-04-03 18:06:26 UTC
livecd-tools-18.15-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/livecd-tools-18.15-1.fc18

Comment 20 Fedora Update System 2013-04-23 00:28:24 UTC
livecd-tools-18.15-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora End Of Life 2013-12-21 15:42:50 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 22 Fedora End Of Life 2014-02-05 23:18:08 UTC
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.