:: Re: [DNG] Help needed:[Fwd: eudev: …
Pàgina inicial
Delete this message
Reply to this message
Autor: aitor
Data:  
A: svante.signell, Devuan dng ml
Assumpte: Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]
Hi again,

En 19 de febrero de 2020 17:11:28 aitor <aitor_czr@???> escribió:

> Hi Svante,
>
> En 19 de febrero de 2020 16:16:39 Svante Signell via Dng
> <dng@???> escribió:
>
>> Hello,
>>
>>
>> No replies so far from the devuan-dev list. Maybe with a larger audience I can
>> get some help!
>>
>>
>> Thanks!
>>
>>
>>
>>
>>
>>
>> ----------
>> eudev: Methods to detect if running in a container.
>> De: Svante Signell svante.signell@???
>> Fecha: 18 feb., 12:24
>> Para: devuan-dev devuan-dev@???
>>
>>
>> Hello,
>>
>>
>> I'm trying to solve the problem of detecting if you are within a container,
>> like
>> docker or LXC when running the eudev init script. If true udevd should not be
>> cstarted. The current version of eudev (3.2.9-4) has a buggy check for
>> containers, and people running runit as init have problems, see #392.
>>
>>
>> eudev-3.2.7-6 has the following test:
>> if ! ps --no-headers --format args ax | egrep -q '^\['; then
>> log_warning_msg "udev does not support containers, not started"
>> exit 0
>> fi
>> I don't know the origin of this test and have not found anything about the
>> output within a container.
>>
>>
>> udev-244-3 has the following test:
>> if [ ! -w /sys ]; then
>> log_warning_msg "udev does not support containers, not started"
>> exit 0
>> fi
>> This test is buggy since /sys is a directory not a file and /sys is always
>> writable when running. Any command triggers this test:
>> /etc/init.d/udev status
>> udev does not support containers, not started ... (warning).
>>
>>
>> Googling around the following tests shows:
>> https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
>> https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
>> https://en.wikipedia.org/wiki/Docker_(software)
>>
>>
>> 1) cat /proc/1/sched | head -n 1
>> # Container: bash (5276, #threads: 1)
>> # No container: init (1, #threads: 1)
>>
>>
>> 2) grep 'docker\|lxc' /proc/1/cgroup
>> Note 1: On a beowulf image it is empty??
>> Note 2: On a systemd-free Debian/bullseye image it shows
>> 1:name=elogind:/1
>> 0::/
>> Note 3: On a systemd-free Debian/buster image:
>> <same as above> after removing systemd-shim and cgmanager
>>
>>
>> 3) cat /proc/1/environ | tr '\0' '\n' | grep ^container
>>
>>
>> Any help on this subject is appreciated, especially the output of the above
>> tests when running in a container.
>>
>>
>> Thanks!
>
> The short answer from my mobile: maybe i can help you later at home,
> because i remember some similar issue related with the chroot jail of the
> live-sdk (another type of container after all) and the dev-assistant of the
> vdev packaging.
>
> Cheers,
>
> Aitor.
>
>
>
>>
>>
>> ----------
>> _______________________________________________
>> Dng mailing list
>> Dng@???
>> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>
>
> Enviado con AquaMail para Android
> https://www.mobisystems.com/aqua-mail
>
>
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Now i can remember the issue: some script in the vdev.install file trying
to detect if dev-assisntant is running or not, the "ps" throws an empty
output even being it running. So, i used this behaviour in the
dev-assistant script; that is if the output of the "ps" command is empty it
means that we are in the chroot jail of the live-sdk and debconf will not
ask anything to the user going ahead with the instalation of vdev/udev/eudev.

Hope this helps,

Aitor.


Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail