Check inode number to see if we are in init namespace (#35306)
This is a more comprehensive fix compared to #35273. Also adds a minimal test only. Based on Luca's #35273 but generalizes the code a bit. In v258 we really should get rid of the old heuristics around userns and cgroupns detection, but given we are late in the v257 cycle this keeps them in.
This commit is contained in:
@@ -5,3 +5,7 @@ set -o pipefail
|
||||
|
||||
SYSTEMD_IN_CHROOT=1 systemd-detect-virt --chroot
|
||||
(! SYSTEMD_IN_CHROOT=0 systemd-detect-virt --chroot)
|
||||
|
||||
if ! systemd-detect-virt -c; then
|
||||
unshare --mount-proc --fork --user --pid systemd-detect-virt --container
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user