:: Re: [DNG] Help needed:[Fwd: eudev: …
Forside
Slet denne besked
Besvar denne besked
Skribent: Daniel Abrecht
Dato:  
Til: dng
Nye-emner: Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]
Emne: Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]
Hi,

What's the point of trying to detect if eudev is run in a container?
Is it just to not start it in that case?
Would it just fail to start in them otherwise?
Is that actually a problem?
And could eudev not just be uninstalled in a container?

In any case, I don't like the idea of doing hacks like looking at inode
numbers or trying to determine if there is a container or not. In
addition to this don't like the Idea of checking for being in a
container in general.

Instead, I would check for reasons why it doesn't work in a container,
choose a sensible thing to check for out of those reasons, and then
check for that.

In this case, I would assume the following, although I haven't checked:
1) the container hypervisor (lxc/lxc, docker, libvirt-lxc, etc.) is
responsible for managing/creating device files
2) eudev exists for managing/creating device files in other kinds of
systems
3) device files can't be created in a container
4) 3. is due to the container hypervisor removing the cap_mknod
capability from containers

Given those assumptions, I think the sensible thing would be to either
check for the mknod capability, or check if device nodes can't be
created in /dev/ due to a lack of permissions. I think that's closer to
the reason why one may not want to start eudev than trying to checking
if we're in a container.

Regards,
Daniel Abrecht