grml / grml-debootstrap

wrapper around debootstrap
59 stars 27 forks source link

image should not contain folders /run /sys /proc /dev #276

Open adrelanos opened 3 months ago

adrelanos commented 3 months ago

Image should not contain folders /run /sys /proc /dev. These should be deleted at the end of the build process.

Rationale:

https://github.com/dracutdevs/dracut/blob/master/modules.d/90dmsquash-live/dmsquash-live-root.sh

    elif [ -d /run/initramfs/squashfs/proc ]; then
        FSIMG=$SQUASHED
        if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
            reloadsysrootmountunit=":>/xor_overlayfs;"
        fi
        overlayfs="required"

(Some dracut internals: Folder /run/initramfs/squashfs/proc is inside the LiveOS/squashfs.img, which can be based on grml-debootstrap (and created by mksquashfs). An image containing an already existing /proc folder can be useful for I don't know what. But either the /proc folder should be complete. This is probably for a complex use case we don't know about. Absent of this, best if the /proc folder doesn't exist. There should not be an empty folder /proc inside the image.)

Would a PR deleting these folders be welcome?

mika commented 3 months ago

Hm interesting. Long time ago™ /proc, /sys, /dev etc were all necessary because they weren't necessarily created during initrd phase automatically, but AFAICS at least since ~2006 those are all created at least in initramfs-tools based initramfs automatically during bootup, and for sure dracut (which showed up only after i-t) also will handle those automatically.

But, chroot-ing to such a system without having /proc, /sys + /dev available for mount --bind, mount -t proc none /proc could be annoying?

adrelanos commented 3 months ago

Interesting. I was thinking, for chrooting you'll need scripting to some tool anyhow.

Actually, I might have been wrong about dracut or it's a dracut bug. Let's see what they reply.

So while my argument might be be correct, it might also currently break dracut based live ISOs.

I am not so sure about this now anymore. Is there a standard or convention how other/most distributions / images handle this?

mika commented 3 months ago

I'm not aware of systems that don't provide /proc, /sys + /dev on their filesystem, might be done for some images where you don't directly chroot into and don't care about it therefore. But IMO tools failing because /proc, /sys + /dev as directories exist as such (instead of actually checking for their mount points or content) is wrong, so I'd tend to not change anything in grml-debootstrap.