#703011 debianutils: ischroot can no longer detect vservers

Package:
debianutils
Source:
debianutils
Description:
Miscellaneous utilities specific to Debian
Submitter:
Andrew Ruthven
Date:
2021-09-16 19:57:03 UTC
Severity:
wishlist
Tags:
#703011#5
Date:
2013-03-13 11:29:03 UTC
From:
To:
[resubmitting as something seems to have gone wrong with creating the bug]
[third time's the charm?]

Dear Maintainer,

The ischroot code checks to see if it can access /proc/1/root to determine
if it is a running inside a chroot. Within vservers you can now read
/proc/1/root so it is no longer a sufficient test for vservers.

On newer vserver patches a better check is to look for a VxID line in
/proc/self/status.  If the line is present you're running a vserver
kernel.  If the value is 0, then you're on the physical host, anything
else means you're in a vserver.

Inside a vserver:

puck@build-sid-amd64:/$ grep VxID /proc/self/status
VxID: 12
puck@build-sid-amd64:/$

On the physical host:

build-servers:~$ grep VxID /proc/self/status
VxID: 0
puck@build-servers:~$

A patch that adds this behaviour is attached, please feel free to rewrite! Also,
method that I've supplied works for non-root users as well, but I haven't added
that support.

I've set this bug report to important as it is stopping initscripts from being
installable on a Wheezy vserver.

This is the case on Linux kernel 3.4 + 2.3.3.9 vserver patch.  The 3.2 kernel
set of patches is not affected by this change of behaviour.

Cheers!