#1092454 xen-tools: xen-create-image overwrites zoneinfo/Etc/UTC of host

Package:
xen-tools
Source:
xen-tools
Submitter:
Ken T Takusagawa
Date:
2026-09-14 12:49:01 UTC
Severity:
normal
Tags:
#1092454#5
Date:
2025-01-08 02:09:54 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
Creating a new image.
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
sudo xen-create-image --hostname=ubuntuxentest3 --memory=4096mb --lvm=v --dist=jammy --pygrub --size=4G --noswap --dhcp

   * What was the outcome of this action?
Before the action, on the host system (NOT the guest image created by xen-create-image):

$ ls -l /usr/share/zoneinfo/Etc/UTC
-rw-r--r-- 1 root root 114 Nov 23 09:04 /usr/share/zoneinfo/Etc/UTC

$ md5sum /usr/share/zoneinfo/Etc/UTC /usr/share/zoneinfo/America/New_York
38bb24ba4d742dd6f50c1cba29cd966a  /usr/share/zoneinfo/Etc/UTC
1ef5d280a7e0c1d820d05205b042cce0  /usr/share/zoneinfo/America/New_York

After the action:

$ ls -l /usr/share/zoneinfo/Etc/UTC
-rw-r--r-- 1 root root 3552 Jan  7 20:37 /usr/share/zoneinfo/Etc/UTC

$ md5sum /usr/share/zoneinfo/Etc/UTC /usr/share/zoneinfo/America/New_York
1ef5d280a7e0c1d820d05205b042cce0  /usr/share/zoneinfo/Etc/UTC
1ef5d280a7e0c1d820d05205b042cce0  /usr/share/zoneinfo/America/New_York

$ debsums -s tzdata
debsums: changed file /usr/share/zoneinfo/Etc/UTC (from tzdata package)

Ultimately, this causes time and date for the UTC time zone to be incorrect:

$ TZ=UTC date

   * What outcome did you expect instead?

xen-create-image should not overwrite /usr/share/zoneinfo/Etc/UTC with
a copy of the time zone file of the host.

*** End of the template - remove these template lines ***

#1092454#10
Date:
2025-01-08 04:53:57 UTC
From:
To:
apt install --reinstall tzdata
#1092454#15
Date:
2025-06-23 16:44:29 UTC
From:
To:
In hooks/common/60-copy-host-files /etc/localtime is copied without
taking into account that this is a symlink on the dom0 and the newly
created domU.
As the link in ${prefix}/etc/localtime at this point links to
/usr/share/zoneinfo/Etc/UTC the file on dom0 will be overwritten with
/etc/localtime.

A simple fix is to use 'cp -d' to copy /etc/localtime as a symlink.
The attached patch does this and was also suggested upstream in
https://github.com/xen-tools/xen-tools/pull/75

Best,
Valentin

#1092454#24
Date:
2026-09-14 12:47:04 UTC
From:
To:
I reproduced the setup and verified Valentin's patch (copy_as_symlink.patch):

- Applies cleanly against the current packaged source (4.9.2-1), no fuzz.
- hooks/common/60-copy-host-files still passes a shell syntax check after
  the change.
- Full package builds fine (dpkg-buildpackage -us -uc -b) and lintian is
  clean.
- Confirmed the fixed script actually ends up in the built .deb, not
  just that the patch applied to the source tree.

/etc/localtime being a symlink to /usr/share/zoneinfo/Etc/UTC is the
default on any UTC-configured host, so this isn't an edge case, it'll
hit most installs. The cp -d fix looks correct: it makes
${prefix}/etc/localtime a symlink to the same target path, which
resolves correctly once the guest's own tzdata is in place, instead of
dereferencing through to the host's file.

This is currently the one thing blocking the package's migration to
testing, so hopefully this helps get it applied.

Ivo