public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2] 8 to 9: use check for unified cgroup v2 support via pve-container
Date: Thu,  7 Aug 2025 16:22:46 +0200	[thread overview]
Message-ID: <20250807142246.341381-1-s.sterz@proxmox.com> (raw)

...instead of re-implementing a custom check here. This has the
side-effect that the check implemented by pve-container is much more
robust and is less likely to yield false positive. So users won't get
warnings about containers that actually do have the required unified
cgroup v2 support.

This was reported for an OpenSUSE Slowroll container on the forum:
https://forum.proxmox.com/threads/169302/

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---

changes since v1, thanks @ Fiona Ebner:

- move away from implementing the check here and just use the one from
  pve-container directly

 PVE/CLI/pve8to9.pm | 61 +++++++---------------------------------------
 1 file changed, 9 insertions(+), 52 deletions(-)

diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm
index 994189f13..d2a7346c0 100644
--- a/PVE/CLI/pve8to9.pm
+++ b/PVE/CLI/pve8to9.pm
@@ -1267,50 +1267,6 @@ sub check_containers_cgroup_compat {
     my $supports_cgroupv2 = sub {
         my ($conf, $rootdir, $ctid) = @_;

-        my $get_systemd_version = sub {
-            my ($self) = @_;
-
-            my @dirs = (
-                '/lib/systemd',
-                '/usr/lib/systemd',
-                '/usr/lib/x86_64-linux-gnu/systemd',
-                '/usr/lib64/systemd',
-            );
-            my $libsd;
-            for my $dir (@dirs) {
-                $libsd = PVE::Tools::dir_glob_regex($dir, "libsystemd-shared-.+\.so");
-                last if defined($libsd);
-            }
-            if (
-                defined($libsd) && $libsd =~ /libsystemd-shared-(\d+)(\.\d-\d)?(\.fc\d\d)?\.so/
-            ) {
-                return $1;
-            }
-
-            return undef;
-        };
-
-        my $unified_cgroupv2_support = sub {
-            my ($self) = @_;
-
-            # https://www.freedesktop.org/software/systemd/man/systemd.html
-            # systemd is installed as symlink to /sbin/init
-            my $systemd = CORE::readlink('/sbin/init');
-
-            # assume non-systemd init will run with unified cgroupv2
-            if (!defined($systemd) || $systemd !~ m@/systemd$@) {
-                return 1;
-            }
-
-            # systemd version 232 (e.g. debian stretch) supports the unified hierarchy
-            my $sdver = $get_systemd_version->();
-            if (!defined($sdver) || $sdver < 232) {
-                return 0;
-            }
-
-            return 1;
-        };
-
         my $ostype = $conf->{ostype};
         if (!defined($ostype)) {
             log_warn("Found CT ($ctid) without 'ostype' set!");
@@ -1319,7 +1275,7 @@ sub check_containers_cgroup_compat {
         }

         my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir);
-        return $lxc_setup->protected_call($unified_cgroupv2_support);
+        return $lxc_setup->unified_cgroupv2_support();
     };

     my $log_problem = sub {
@@ -1604,7 +1560,9 @@ sub check_bootloader {

     if (!-d '/sys/firmware/efi') {
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
-            log_info("systemd-boot package installed on legacy-boot system is not necessary, consider remoing it");
+            log_info(
+                "systemd-boot package installed on legacy-boot system is not necessary, consider remoing it"
+            );
             return;
         }
         log_skip("System booted in legacy-mode - no need for additional packages");
@@ -1618,8 +1576,8 @@ sub check_bootloader {
         }
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
             log_warn("systemd-boot meta-package installed this will cause issues on upgrades of"
-                ." boot-related packages. Install 'systemd-boot-efi' and 'systemd-boot-tools' explicitly"
-                ." and remove 'systemd-boot'");
+                . " boot-related packages. Install 'systemd-boot-efi' and 'systemd-boot-tools' explicitly"
+                . " and remove 'systemd-boot'");
             return;
         }
     } else {
@@ -1639,7 +1597,8 @@ sub check_bootloader {
         }
         if (!-f "/usr/share/doc/grub-efi-amd64/changelog.Debian.gz") {
             log_warn("System booted in uefi mode but grub-efi-amd64 meta-package not installed,"
-                . " new grub versions will not be installed to /boot/efi! Install grub-efi-amd64.");
+                . " new grub versions will not be installed to /boot/efi! Install grub-efi-amd64."
+            );
             return;
         } else {
             log_pass("bootloader packages installed correctly");
@@ -1831,9 +1790,7 @@ sub check_lvm_autoactivation {
                 . "\t/usr/share/pve-manager/migrations/pve-lvm-disable-autoactivation"
                 . "\n");
     } else {
-        log_pass(
-            "No problematic volumes found."
-        );
+        log_pass("No problematic volumes found.");
     }

     return undef;
--
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-08-07 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 14:22 Shannon Sterz [this message]
2025-08-07 14:54 ` [pve-devel] applied: " Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250807142246.341381-1-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal