:: [devuan-dev] bug#392: When pid1==ru…
Top Page
Delete this message
Reply to this message
Author: KORN Andras
Date:  
To: 392
Subject: [devuan-dev] bug#392: When pid1==runit, mis-detects container and doesn't start
Hi,

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


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.

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


Sure:

Package: virt-what
Status: install ok installed
Priority: extra
Section: admin
Installed-Size: 48
Maintainer: Debian Libvirt Maintainers <pkg-libvirt-maintainers@???>
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.