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

Package:
xen-tools
Source:
xen-tools
Submitter:
Ken T Takusagawa
Date:
2025-06-23 17:27:02 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