xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
361 stars 171 forks source link

timezone not set in RedHat 8.6 diskless image #7321

Closed markprez closed 1 year ago

markprez commented 1 year ago

Running xcat 2.16.5

[root@c685csm06 xcat_clusters]# lsxcatd -v
Version 2.16.5 (git commit 43c3a768919ccea0352aadeb5ddaa47ca9f08c7e, built Fri Jan 20 00:27:17 EST 2023)

After running genimage/packimage on a RH86 osimage the timezone is not set. I saw this on 2 systems, tried these 2 setting:

tabdump site | grep timez
"timezone","US/Eastern",,
"timezone","America/New_York",,
ls -ltr /install/custom/ist.redhat.8.6.netboot.container.DL/rootimg/etc/localtime
lrwxrwxrwx 1 root root 25 Jan 27 11:52 /install/custom/ist.redhat.8.6.netboot.container.DL/rootimg/etc/localtime -> ../usr/share/zoneinfo/UTC
gurevichmark commented 1 year ago

The problem may be that exlist attribute is not defined for this image definition:

[root@c685csm06 xcat]# lsdef -t osimage ist.redhat.8.6.netboot.container.DL -i exlist
Object name: ist.redhat.8.6.netboot.container.DL
    exlist=
[root@c685csm06 xcat]#

But the code added by #7077 handles linking of $rootimg_dir/etc/localtime file only if we can find that file ?

:
:
335     if ($exlistloc) {
336         my @excludeslist = split ',', $exlistloc;
337         foreach my $exlistlocname (@excludeslist) {
338             my $exlist;
339             my $excludetext;
340             open($exlist, "<", $exlistlocname);
341             system("echo -n > $xcat_packimg_tmpfile");
342             while (<$exlist>) {
343                 $excludetext .= $_;
344             }
345             close($exlist);
346
347             # timedatectl requires /etc/localtime link to the zoneinfo in /usr/share/zoneinfo
348             if ($timezone[0]) {
349                 unlink("$rootimg_dir/etc/localtime");
350                 symlink("../usr/share/zoneinfo/$timezone[0]", "$rootimg_dir/etc/localtime");
351
352                 # Add the zoneinfo to the include list
353                 $excludetext .= "+./usr/share/zoneinfo/$timezone[0]\n";
:
:
besawn commented 1 year ago

@gurevichmark Good analysis - possibly we can split up the existing logic from #7077 so that the symbolic link manipulation happens just before the exlist processing block so it runs with or without an exlist associated with the image and the piece that includes the timezone files in the excludetext stays inside the exlist processing block. What do you think?

gurevichmark commented 1 year ago

Confirmation of the above. Can recreate on one of the regression VMs:

[root@f6u13k10 ~]# lsdef -t site clustersite -i timezone -c
clustersite: timezone=America/New_York
[root@f6u13k10 ~]#

[root@f6u13k10 ~]# chdef -t osimage rhels8.6.0-ppc64le-netboot-compute exlist=
1 object definitions have been created or modified.
[root@f6u13k10 ~]#

[root@f6u13k10 ~]# genimage rhels8.6.0-ppc64le-netboot-compute
:
:
the initial ramdisk for statelite is generated successfully.
[root@f6u13k10 ~]#

[root@f6u13k10 ~]# ls -l /install/netboot/rhels8.6.0/ppc64le/compute/rootimg/etc/localtime
lrwxrwxrwx 1 root root 25 Jan 27 15:03 /install/netboot/rhels8.6.0/ppc64le/compute/rootimg/etc/localtime -> ../usr/share/zoneinfo/UTC

[root@f6u13k10 ~]# packimage rhels8.6.0-ppc64le-netboot-compute                 
Packing contents of /install/netboot/rhels8.6.0/ppc64le/compute/rootimg
archive method:cpio
compress method:pigz

[root@f6u13k10 ~]# ls -l /install/netboot/rhels8.6.0/ppc64le/compute/rootimg/etc/localtime
lrwxrwxrwx 1 root root 25 Jan 27 15:03 /install/netboot/rhels8.6.0/ppc64le/compute/rootimg/etc/localtime -> ../usr/share/zoneinfo/UTC
[root@f6u13k10 ~]#