Bug#951257: udevadm: please exit nonzero with "Running in chroot, ignoring request." when /proc is not mounted
Trent W. Buck
trentbuck at gmail.com
Thu Feb 13 13:03:42 GMT 2020
Michael Biebl wrote:
> Am 13.02.20 um 13:29 schrieb Trent W. Buck:
>> Packages like udisks2 run "udevadm trigger" in their postinsts.
>> When building a Debian Live image, if /proc is mounted in the chroot, all is well.
>> When building a Debian Live image, if /proc is NOT mounted in the chroot,
>> udevadm gives annoying errors, and the whole build crashes.
>>
>> Without /proc:
>>
>> root at DESKTOP-P00TKMM:/# udevadm trigger
>> Failed to scan devices: No such file or directory
>
> This means, /sys is missing, not proc afaics.
Thanks for the prompt reply.
My tests show /proc alone is enough to enable the existing "do nothing" code.
Giving a longer excerpt from from boring-full-transcript.txt.xz:
78root at DESKTOP-P00TKMM:/# udevadm trigger
Failed to scan devices: No such file or directory
root at DESKTOP-P00TKMM:/# mount -t proc none /proc
root at DESKTOP-P00TKMM:/# udevadm trigger
Running in chroot, ignoring request.
root at DESKTOP-P00TKMM:/# udevadm --version
241
root at DESKTOP-P00TKMM:/# udevadm control --help
Running in chroot, ignoring request.
root at DESKTOP-P00TKMM:/# umount /proc
root at DESKTOP-P00TKMM:/# udevadm control --help
udevadm control OPTION
Control the udev daemon.
-h --help Show this help
-V --version Show package version
-e --exit Instruct the daemon to cleanup and exit
-l --log-priority=LEVEL Set the udev log level for the daemon
-s --stop-exec-queue Do not execute events, queue only
-S --start-exec-queue Execute events, flush queue
-R --reload Reload rules and databases
-p --property=KEY=VALUE Set a global property for all events
-m --children-max=N Maximum number of children
--ping Wait for udev to respond to a ping message
-t --timeout=SECONDS Maximum time to block for a reply
root at DESKTOP-P00TKMM:/# udevadm control --reload
root at DESKTOP-P00TKMM:/# echo $?
1
root at DESKTOP-P00TKMM:/#
>> It sounds like best current practice is for postinsts to ignore ALL
>> errors[0], which (I think) is worse, because udevadm can be smarter
>> than the postinst about what is a "real" error.
>
> I guess you'd have to convince upstream that this is a good idea to add
> such a check.
>
> Once upstream has such a patch, we can cherry-pick it.
Blergh, I guess I'll have to make a github account and install a GUI
browser so I can interact with upstream directly.
PS: I just dug into the error message from udevadm-trigger.c.
It looks like src/basic/virt.c running_in_chroot() checks $SYSTEMD_IGNORE_CHROOT
...so an easy workaround might be to simply "export SYSTEMD_IGNORE_CHROOT=true"?
Hrm, nope, that variable does the OPPOSITE, per
https://bugzilla.redhat.com/show_bug.cgi?id=1379852#co
PPS: making a regular file at /proc/1/root is sufficient:
(debootstrap chroot)root at not-omega:/# udevadm trigger
Failed to scan devices: No such file or directory
(debootstrap chroot)root at not-omega:/# SYSTEMD_IGNORE_CHROOT=true udevadm trigger
Failed to scan devices: No such file or directory
(debootstrap chroot)root at not-omega:/# mkdir /proc/1
(debootstrap chroot)root at not-omega:/# ln -s / /proc/1/root
(debootstrap chroot)root at not-omega:/# udevadm trigger
Failed to scan devices: No such file or directory
(debootstrap chroot)root at not-omega:/# rm /proc/1/root
(debootstrap chroot)root at not-omega:/# ln -s /definitely-not-the-root-filesystem /proc/1/root
(debootstrap chroot)root at not-omega:/# udevadm trigger
Failed to scan devices: No such file or directory
(debootstrap chroot)root at not-omega:/# rm /proc/1/root
(debootstrap chroot)root at not-omega:/# echo 'Honestly, this IS a chroot' >/proc/1/root
(debootstrap chroot)root at not-omega:/# udevadm trigger
Running in chroot, ignoring request.
More information about the Pkg-systemd-maintainers
mailing list