#1027749 update-initramfs could diagnose attempt to run with /dev not mounted

#1027749#5
Date:
2023-01-02 18:23:44 UTC
From:
To:
When the config files specify MODULES=dep, update-initramfs
tries to autodetect which modules to load. To do this, all of
/proc/, /sys/, and /dev/ must be mounted. If either /proc/ or
/sys/ isn't mounted, update-initramfs fails with an error
message which explicitly mentions a filename in /proc/ or
/sys/, cluing the user in to what they forgot. However if
/dev/ is not mounted, the error is a generic one:
"mkinitramfs: failed to determine device for /".

Obviously this is user error, but I think it would be helpful
if update-initramfs explicitly complained about missing
/dev/, or at least that it failed to find a specific file in /dev/.

I think because update-initramfs is a tool you might
need to run in a weird situation where you're trying to
rescue a non-booting system it's perhaps worth checking
for something it would clearly not make sense to check
in a more average tool that can just assume the system
is in a sane state.

The situation where I ran into this was that on moving a
disk to new hardware I needed to rebuild the initrd to
get it to boot. So I booted a livecd, mounted the disk,
chrooted into it and ran update-initramfs. Once I
realised I'd forgotten to mount or bind-mount all these
other things into the chroot it worked fine :-)

thanks
-- PMM

#1027749#10
Date:
2024-07-28 21:46:33 UTC
From:
To:
There are many ways in which the environment could be broken, and I
don't think it is worth the trouble to check for this one specifically.

Ben.