public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2] 8 to 9: use check for unified cgroup v2 support via pve-container
@ 2025-08-07 14:22 Shannon Sterz
  2025-08-07 14:54 ` [pve-devel] applied: " Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Shannon Sterz @ 2025-08-07 14:22 UTC (permalink / raw)
  To: pve-devel

...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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH manager v2] 8 to 9: use check for unified cgroup v2 support via pve-container
  2025-08-07 14:22 [pve-devel] [PATCH manager v2] 8 to 9: use check for unified cgroup v2 support via pve-container Shannon Sterz
@ 2025-08-07 14:54 ` Fiona Ebner
  0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2025-08-07 14:54 UTC (permalink / raw)
  To: pve-devel, Shannon Sterz

On Thu, 07 Aug 2025 16:22:46 +0200, Shannon Sterz wrote:
> ...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/
> 
> [...]

Applied, thanks! Made a separate commit running 'make tidy' first and
rebased on top of that to get a clean change.

[1/1] 8 to 9: use check for unified cgroup v2 support via pve-container
      commit: ea1f2523515d7639f754a0588ffd8800cdb3321f

and for stable-8:

[1/1] 8 to 9: use check for unified cgroup v2 support via pve-container
      commit: 24cd98ac41e83efd3c235cd50e47c66429bb106b


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-07 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 14:22 [pve-devel] [PATCH manager v2] 8 to 9: use check for unified cgroup v2 support via pve-container Shannon Sterz
2025-08-07 14:54 ` [pve-devel] applied: " Fiona Ebner

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