From: Fabian Grünbichler Date: Mon, 30 May 2022 09:10:13 +0000 (+0200) Subject: fix #4088: ignore systemd minor version for detection X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=acbc6663423117463966ee2668a705fdb64b495c;p=pve-container.git fix #4088: ignore systemd minor version for detection else for containers with distros frequently updating to new upstream versions the systemd version might be mis-detected. Signed-off-by: Fabian Grünbichler Reviewed-by: Stoiko Ivanov Tested-by: Stoiko Ivanov --- diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm index 7c93dfb..8580bf0 100644 --- a/src/PVE/LXC/Setup/Base.pm +++ b/src/PVE/LXC/Setup/Base.pm @@ -514,7 +514,7 @@ sub clear_machine_id { } } -# tries to guess the systemd version based on the existence of +# tries to guess the systemd (major) version based on the existence of # (/usr)?/lib/systemd/libsystemd-shared.so. It was introduced in v231. sub get_systemd_version { my ($self) = @_; @@ -522,7 +522,7 @@ sub get_systemd_version { my $sd_lib_dir = $self->ct_is_directory("/lib/systemd") ? "/lib/systemd" : "/usr/lib/systemd"; my $libsd = PVE::Tools::dir_glob_regex($sd_lib_dir, "libsystemd-shared-.+\.so"); - if (defined($libsd) && $libsd =~ /libsystemd-shared-(\d+)\.so/) { + if (defined($libsd) && $libsd =~ /libsystemd-shared-(\d+)(?:\..*)?\.so/) { return $1; }