tinyramfs icon indicating copy to clipboard operation
tinyramfs copied to clipboard

feature request: automatic detection of root device

Open apprehensions opened this issue 1 year ago • 2 comments

would this be possible?

also: since root device can be automatically detected, so can the file system module for it.

this could allow for configuration-less tinyramfs.

apprehensions avatar Jul 16 '22 09:07 apprehensions

It is possible, but that would be unreliable.

root device autodetection implies that we have to iterate over disk devices, mount them and then check /sbin/init. if it exist - switch_root into it, if not - continue.

It is unreliable because mount can fail due to fs module not being loaded. mount can also fail because disk device could be encrypted, so have to implement fs type checking. There're also more complex file systems like zfs or btrfs, which may have nested file systems/partitions/pools...

This is pretty hard to do properly. I'd rather have only static configuration defined by user. This is more reliable than being too smart and autodetect everything.

since root device can be automatically detected, so can the file system module for it.

Tinyramfs already autodetects filesystem module for rootfs: https://github.com/illiliti/tinyramfs/blob/6b9f73dbc0af7ea4e2e5a8944a92368c91c1561c/tinyramfs#L112-L120

But again, it is unreliable. It might be removed in the future because it doesn't work in live usb environment and environment where /proc isn't mounted.

illiliti avatar Jul 17 '22 02:07 illiliti

not exactly what i meant, what i meant was that at configuring time when tinyramfs is building the initramfs. i wouldn't think this is that hard because it can simply check what device is /.

apprehensions avatar Nov 29 '22 09:11 apprehensions