diff -Nru systemd-237/debian/changelog systemd-237/debian/changelog --- systemd-237/debian/changelog 2021-08-26 14:20:40.000000000 +0000 +++ systemd-237/debian/changelog 2021-12-10 09:15:49.000000000 +0000 @@ -1,3 +1,17 @@ +systemd (237-3ubuntu10.53) bionic; urgency=medium + + [ Ratchanan Srirattanamet ] + * d/p/debian/timedatectl-lp1650688.patch, + d/p/debian/UBUNTU-Fix-timezone-setting-on-read-only-etc.patch: + Fix timedated unable to retrieve & properly set timezone on + read-only /etc (e.g. Ubuntu Core and system-image-based systems) + (LP: #1650688) + + [ Lukas Märdian ] + * Support detection for ARM64 Hyper-V guests (LP: #1952599) + + -- Lukas Märdian Fri, 10 Dec 2021 10:15:49 +0100 + systemd (237-3ubuntu10.52) bionic; urgency=medium * d/extra/dhclient-enter-resolved-hook: diff -Nru systemd-237/debian/patches/debian/timedatectl-lp1650688.patch systemd-237/debian/patches/debian/timedatectl-lp1650688.patch --- systemd-237/debian/patches/debian/timedatectl-lp1650688.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-237/debian/patches/debian/timedatectl-lp1650688.patch 2021-12-10 09:15:07.000000000 +0000 @@ -0,0 +1,51 @@ +Description: Fix retrieving timezone on read-only /etc + get_timezone() retrieve it by reading the link destination of + /etc/localtime, which on systems with read-only /etc will always point + to /etc/writable. Makes this function aware of the /etc/writable + redirection and handle it. + . + [ratchanan@ubports.com: add descrtiption and other metadata.] + [ratchanan@ubports.com: backport the patch for bionic] +Author: Michael Vogt +Origin: backport, https://bugs.launchpad.net/snappy/+bug/1650688/comments/46 +Bug-Ubuntu: https://bugs.launchpad.net/snappy/+bug/1650688 +Forwarded: not-needed (part of read-only /etc workaround) +Last-Update: 2021-09-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -1380,13 +1380,32 @@ + } + } + ++/* Hack for Ubuntu phone: check if path is an existing symlink to ++ * /etc/writable; if it is, update that instead */ ++static const char* writable_filename(const char *path) { ++ ssize_t r; ++ static char realfile_buf[PATH_MAX]; ++ _cleanup_free_ char *realfile = NULL; ++ const char *result = path; ++ int orig_errno = errno; ++ ++ r = readlink_and_make_absolute(path, &realfile); ++ if (r >= 0 && startswith(realfile, "/etc/writable")) { ++ snprintf(realfile_buf, sizeof(realfile_buf), "%s", realfile); ++ result = realfile_buf; ++ } ++ ++ errno = orig_errno; ++ return result; ++} ++ + int get_timezone(char **tz) { + _cleanup_free_ char *t = NULL; + const char *e; + char *z; + int r; + +- r = readlink_malloc("/etc/localtime", &t); ++ r = readlink_malloc(writable_filename("/etc/localtime"), &t); + if (r < 0) { + if (r != -EINVAL) + return r; /* returns EINVAL if not a symlink */ diff -Nru systemd-237/debian/patches/debian/UBUNTU-Fix-timezone-setting-on-read-only-etc.patch systemd-237/debian/patches/debian/UBUNTU-Fix-timezone-setting-on-read-only-etc.patch --- systemd-237/debian/patches/debian/UBUNTU-Fix-timezone-setting-on-read-only-etc.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-237/debian/patches/debian/UBUNTU-Fix-timezone-setting-on-read-only-etc.patch 2021-12-10 09:15:07.000000000 +0000 @@ -0,0 +1,25 @@ +Description: Fix timezone setting on read-only etc + Due to our read-only /etc workaround, the localtime link on such + system ends up in /etc/writable, not /etc. To make the link target + correct in both normal and such systems, makes the path absolute. + . + On Ubuntu Core, this eliminates the need for the wrapper script, and + makes the DBus interface work properly. +Author: Ratchanan Srirattanamet +Origin: other +Bug-Ubuntu: https://bugs.launchpad.net/snappy/+bug/1650688 +Forwarded: not-needed (part of read-only /etc workaround) +Last-Update: 2021-09-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/timedate/timedated.c ++++ b/src/timedate/timedated.c +@@ -118,7 +118,7 @@ + return r; + } + +- p = strappend("../usr/share/zoneinfo/", c->zone); ++ p = strappend("/usr/share/zoneinfo/", c->zone); + if (!p) + return log_oom(); + diff -Nru systemd-237/debian/patches/lp1952599/0001-virt-Support-detection-for-ARM64-Hyper-V-guests.patch systemd-237/debian/patches/lp1952599/0001-virt-Support-detection-for-ARM64-Hyper-V-guests.patch --- systemd-237/debian/patches/lp1952599/0001-virt-Support-detection-for-ARM64-Hyper-V-guests.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-237/debian/patches/lp1952599/0001-virt-Support-detection-for-ARM64-Hyper-V-guests.patch 2021-12-10 09:15:07.000000000 +0000 @@ -0,0 +1,24 @@ +From: Boqun Feng +Date: Wed, 13 Oct 2021 11:32:09 +0800 +Subject: virt: Support detection for ARM64 Hyper-V guests + +The detection of Microsoft Hyper-V VMs is done by cpuid currently, +however there is no cpuid on ARM64. And since ARM64 is now a supported +architecture for Microsoft Hyper-V guests[1], then use DMI tables to +detect a Hyper-V guest, which is more generic and works for ARM64. + +[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7aff79e297ee1aa0126924921fd87a4ae59d2467 +--- + src/basic/virt.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/src/basic/virt.c ++++ b/src/basic/virt.c +@@ -166,6 +166,7 @@ static int detect_vm_dmi(void) { + { "Parallels", VIRTUALIZATION_PARALLELS }, + /* https://wiki.freebsd.org/bhyve */ + { "BHYVE", VIRTUALIZATION_BHYVE }, ++ { "Microsoft", VIRTUALIZATION_MICROSOFT }, + }; + unsigned i; + int r; diff -Nru systemd-237/debian/patches/lp1952599/0002-virt-Fix-the-detection-for-Hyper-V-VMs.patch systemd-237/debian/patches/lp1952599/0002-virt-Fix-the-detection-for-Hyper-V-VMs.patch --- systemd-237/debian/patches/lp1952599/0002-virt-Fix-the-detection-for-Hyper-V-VMs.patch 1970-01-01 00:00:00.000000000 +0000 +++ systemd-237/debian/patches/lp1952599/0002-virt-Fix-the-detection-for-Hyper-V-VMs.patch 2021-12-10 09:15:07.000000000 +0000 @@ -0,0 +1,35 @@ +From: Boqun Feng +Date: Tue, 23 Nov 2021 15:09:26 +0800 +Subject: virt: Fix the detection for Hyper-V VMs + +Use product_version instead of product_name in DMI table and the string +"Hyper-V" to avoid misdetection. + +Fixes: #21468 + +Signed-off-by: Boqun Feng +--- + src/basic/virt.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/src/basic/virt.c ++++ b/src/basic/virt.c +@@ -148,7 +148,8 @@ static int detect_vm_dmi(void) { + "/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */ + "/sys/class/dmi/id/sys_vendor", + "/sys/class/dmi/id/board_vendor", +- "/sys/class/dmi/id/bios_vendor" ++ "/sys/class/dmi/id/bios_vendor", ++ "/sys/class/dmi/id/product_version" /* For Hyper-V VMs test */ + }; + + static const struct { +@@ -166,7 +167,7 @@ static int detect_vm_dmi(void) { + { "Parallels", VIRTUALIZATION_PARALLELS }, + /* https://wiki.freebsd.org/bhyve */ + { "BHYVE", VIRTUALIZATION_BHYVE }, +- { "Microsoft", VIRTUALIZATION_MICROSOFT }, ++ { "Hyper-V", VIRTUALIZATION_MICROSOFT }, + }; + unsigned i; + int r; diff -Nru systemd-237/debian/patches/series systemd-237/debian/patches/series --- systemd-237/debian/patches/series 2021-08-26 14:20:32.000000000 +0000 +++ systemd-237/debian/patches/series 2021-12-10 09:15:07.000000000 +0000 @@ -97,6 +97,8 @@ journal-do-not-remove-multiple-spaces-after-identifi.patch stop-mount-error-propagation.patch Support-system-image-read-only-etc.patch +debian/timedatectl-lp1650688.patch +debian/UBUNTU-Fix-timezone-setting-on-read-only-etc.patch fix-race-daemon-reload-11121.patch virt-detect-WSL-environment-as-a-container-id-wsl.patch CVE-2019-3842.patch @@ -263,3 +265,5 @@ lp1934147/0002-cgroup-do-catchup-for-unit-cgroup-inotify-watch-file.patch lp1934147/0003-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch lp1934981-correct-suspend-then-sleep-string.patch +lp1952599/0001-virt-Support-detection-for-ARM64-Hyper-V-guests.patch +lp1952599/0002-virt-Fix-the-detection-for-Hyper-V-VMs.patch