Subject: When pid1==runit, mis-detects container and doesn't start

From: KORN Andras <[email-masked]>
Date: Sun, 9 Feb 2020 11:34:48 +0100

Package: eudev
Version: 3.2.9-4
Severity: important

Hi,

the /etc/init.d/eudev initscript has this bit:

if ! ps -p1|grep -q "init\|systemd"; then
  log_warning_msg "udevd does not support containers, not started"
  exit 0
fi

If running with runit as the init system (which is obviously neither
sysvinit nor systemd), the script exits without starting eudev, which
results in no keyboard and mouse under X and no local way of switching to a
text console.

Perhaps use virt-what to detect containers instead?

András

-- 
                   Can February March? No, but April May...

---

From: Svante Signell <[email-masked]>
Date: Mon, 10 Feb 2020 10:17:41 +0100

>   log_warning_msg "udevd does not support containers, not started"

Thank you for your report.

So the name of pid 1 for runit-init is runit?
Then the test could be
-q "init\|runit\|systemd"

What about other init systems, like openrc-init? Perhaps the test should be
reversed if ps -p1 | -q "container tests here" instead.

The Debian package has a worse bug, the test is
if [ ! -w /sys ]; then which is always true, making it impossible to start udev
manually.

> Perhaps use virt-what to detect containers instead?

I've been looking for methods to detect containers, but have not found virt-
what. Do you have a link or a description?

---

From: KORN Andras <[email-masked]>
Date: Mon, 10 Feb 2020 15:36:13 +0100

Hi,

> reversed if ps -p1 | -q "container tests here" instead.

runit is a perfectly viable init system for a container, so detecting that
pid1==runit gives no clue whether you're inside a container or not.

> what. Do you have a link or a description?

Sure:

Package: virt-what
Status: install ok installed
Priority: extra
Section: admin
Installed-Size: 48
Maintainer: Debian Libvirt Maintainers <[email-masked]>
Architecture: amd64
Version: 1.19-1
Depends: dmidecode, libc6 (>= 2.4)
Description: detect if we are running in a virtual machine
 Virt-what is a shell script which can be used to detect if the program is
 running in a virtual machine (VM).
 .
 The program prints out a list of "facts" about the virtual machine, derived
 from heuristics. One fact is printed per line.
Description-md5: 5d47386fbabb50c244e6526dada61a44
Homepage: https://people.redhat.com/~rjones/virt-what/

% apt-cache policy virt-what                                                                                                                                                                                                                                                         =79%
virt-what:
  Installed: 1.19-1
  Candidate: 1.19-1
  Version table:
 *** 1.19-1 500
        500 http://packages.devuan.org/merged unstable/main amd64 Packages
        100 /var/lib/dpkg/status
     1.15-1+deb9u1 500
        500 http://packages.devuan.org/merged ascii/main amd64 Packages

Note that while virt-what detects lxc, it doesn't currently correctly detect
all versions of linux-vserver.

Best regards,

András

Ps. I only found your reply by accident. I'm not subscribed do the Devuan
mailing lists and bugs.devuan.org doesn't seem to have Cc'd me. Please Cc me
explicitly.

-- 
  Illegal copies are not theft. Theft removes the original; a copy is a copy.