Control: severity -1 normal

On 09/06/2020 10.43, Lukasz Stelmach wrote:
> I assume, however,that in case of chroot environmets running udevadm
> isn't crucial for a successful installation. I was thinking, maybe run
> udevadm only if /sys is mounted like this?

systemd/udev already uses this check in various places, there is no need
to add another one effectively doing the same:

(implementation from systemd/sid, src/basic/virt.c)
int running_in_chroot(void) {
        int r;

        if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0)
                return 0;

        r = files_same("/proc/1/root", "/", 0);
        if (r < 0)
                return r;

        return r == 0;
}

In my armhf chroot this chroot detection test (/ does not match
/proc/1/root (by comparing device+inode)) works fine and disables udev
operations that are usually useless in a chroot). I can also try it
manually:

# stat -L /proc/1/root /
  File: /proc/1/root
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 10304h/66308d   Inode: 2           Links: 25
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-06-09 09:27:23.000000000 +0000
Modify: 2020-05-13 13:14:36.000000000 +0000
Change: 2020-05-13 13:14:36.000000000 +0000
 Birth: -
  File: /
  Size: 420             Blocks: 0          IO Block: 4096   directory
Device: 2dh/45d Inode: 115089130   Links: 21
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-06-09 19:48:43.000000000 +0000
Modify: 2020-06-09 19:48:37.000000000 +0000
Change: 2020-06-09 19:48:37.000000000 +0000
 Birth: -


Andreas

Reply via email to