]> git.proxmox.com Git - pve-container.git/commit
prestart-hook: detect cgroupv2 incompatible systemd version
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 5 Jul 2021 10:57:14 +0000 (12:57 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 5 Jul 2021 15:56:45 +0000 (17:56 +0200)
commitf7073b990654e62334f12b9b46f9a42891d7a369
tree03982a5ecf855b0ebd8e0d174f9328e0b3d8fa69
parent93535f1e668a3494bf69058fafecd5bfa71f1263
prestart-hook: detect cgroupv2 incompatible systemd version

Some container OS (e.g. CentOS 7, Ubuntu 16.04) are booted with
systemd, in a version which is not able to run with a pure cgroupv2
(a.k.a unified hierarchy) environment.

Detect those in the lxc-pve-prestart-hook, because there we already
have all mount-points set up.

This approach only leaves syslog/journal as place for notifying the
user since starting a container eventually runs `systemctl start
pve-container@VMID.service`, where we lose the prints to stdout and
stderr.

The alternative of shortly mounting all container mounts just to
obtain the systemd-version, before starting the container seems
prohibitively expensive.

The heuristic of /sbin/init needing to be a link to something ending
in systemd is taken from the systemd documentation[0] and was verified
on a few of our container-templates.

[0] https://www.freedesktop.org/software/systemd/man/systemd.html
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PVE/LXC/Setup.pm
src/PVE/LXC/Setup/Base.pm
src/lxc-pve-prestart-hook