ltsp-build-client fails when /etc/localtime is a symlink to UTC

Bug #1660392 reported by Eddy G
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
LTSP5
Fix Released
Undecided
Unassigned

Bug Description

This was observed in Ubuntu 16.04.1 LTS:

When /etc/localtime is a symlink to UTC (the Ubuntu default), ltsp-build-client fails:

    cp: '/etc/localtime' and '/opt/ltsp/amd64/etc/localtime' are the same file
    error: LTSP client installation ended abnormally

Looking at the files:

    server2:~$ ls -l /etc/localtime /opt/ltsp/amd64/etc/localtime
    lrwxrwxrwx 1 root root 27 Jan 23 23:23 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC
    lrwxrwxrwx 1 root root 27 Jan 30 15:23 /opt/ltsp/amd64/etc/localtime -> /usr/share/zoneinfo/Etc/UTC

This is coming from 035-copy-timezone:

        if [ -f /etc/timezone ]; then
            cp /etc/timezone $ROOT/etc/timezone
            cp /etc/localtime $ROOT/etc/localtime
        fi

And in the case when /etc/localtime is a different symlink (that is, not to the Ubuntu default of UTC and the 'cp' doesn't fail), the above code messes up the *actual* UTC/GMT/Zulu timezone files (which are all symlinked to each other) in /usr/share/zoneinfo by copying the system timezone to it:

    server1:~$ ls -lL /usr/share/zoneinfo/America/New_York /usr/share/zoneinfo/UTC
    -rw-r--r-- 1 root root 3545 Oct 21 07:42 /usr/share/zoneinfo/America/New_York
    -rw-r--r-- 1 root root 3545 Oct 21 07:42 /usr/share/zoneinfo/UTC

Revision history for this message
Matthew Braun (powerplug) wrote :

Also related to the above bug is this code for LTSP clients (pkg ltsp-client-core) which also blindly copies to /etc/localtime:

/usr/share/ltsp/init-ltsp.d/50-set-time

if [ -n "$TIMEZONE" ] && [ -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
    cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime 2>/dev/null
fi

I think both the LTSP build and client code should be changed to create a symlink (after first checking it isn't already a symlink pointing to the correct file).

Revision history for this message
Michael Knichel (m-knichel) wrote :

I am experiencing similar behavior...
$ ls -l /etc/timezone
-rw-r--r-- 1 root root 17 Nov 13 13:34 /etc/timezone
$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 36 Nov 13 13:34 /etc/localtime -> /usr/share/zoneinfo/America/New_York
$ ls -l /opt/ltsp/amd64/etc/timezone
-rw-r--r-- 1 root root 17 Nov 17 14:00 /opt/ltsp/amd64/etc/timezone
$ ls -l /opt/ltsp/amd64/etc/localtime
lrwxrwxrwx 1 root root 27 Feb 6 2017 /opt/ltsp/amd64/etc/localtime -> /usr/share/zoneinfo/Etc/UTC

======= /var/lib/tftpboot/ltsp/amd64/lts.conf
[example]
key=value

[default]
SCREEN_02=shell
SCREEN_07=ldm
LDM_THEME = ltsp.AIT
FAT_RAM_THRESHOLD=3000
TIMEZONE=America/New_York
RCFILE_01="mkdir -p /media/local_disk && mount /dev/sda1 /media/local_disk"

======= ltsp-info
$ ltsp-info
server information:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial

server packages:
ii ldm-server 2:2.2.18-1
un ltsp-client <none>
un ltsp-client-core <none>
ii ltsp-docs 1.2-1
ii ltsp-server 5.5.7-1
ii ltsp-server-standalone 5.5.7-1
un ltsp-utils <none>
ii ltspfs 1.4-2

packages in chroot: /opt/ltsp/amd64
ii ldm 2:2.2.18-1
ii ldm-edubuntu-theme 2:2.0.47
un ldm-themes <none>
un ldm-ubuntu-themes <none>
ii ltsp-client 5.5.7-1
ii ltsp-client-core 5.5.7-1
ii ltspfsd 1.4-2
ii ltspfsd-core 1.4-2

found: /opt/ltsp/amd64/etc/lts.conf

found: /var/lib/tftpboot/ltsp/amd64/lts.conf

found image: /opt/ltsp/images/amd64.img

======= /etc/timezone
$ more /etc/timezone
America/New_York

======= /opt/ltsp/amd64/etc/timezone
$ more /opt/ltsp/amd64/etc/timezone
America/New_York

Revision history for this message
Vagrant Cascadian (vagrantc) wrote :
Changed in ltsp:
status: New → Fix Committed
Revision history for this message
Vagrant Cascadian (vagrantc) wrote :

fixed in 5.5.10

Changed in ltsp:
status: Fix Committed → Fix Released
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.