Open mikhailnov opened 12 months ago
It could also be NBD (network block device) instead of NFS.
I would try the following kernel command line. Obviously you would need the dmsquash-live and nfs dracut modules.
root=nfs:192.168.50.1:/nfs/client rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=dirtosquashfile
Thanks, I will try. Hm... I went to look for rd.live.image
in the code and found that live:nfs://
is a valid parameter in modules.d/90livenet/livenet-generator.sh
, but it is not documented in dracut.cmdline(7). Is not it what I wanted?
I would try the following kernel command line. Obviously you would need the dmsquash-live and nfs dracut modules.
root=nfs:192.168.50.1:/nfs/client rd.live.image rd.live.overlay.overlayfs=1 rd.live.dir=dirtosquashfile
Unfortunately, this does not work: it tries to mount the whole root from NFS, not from a squashfsfile on it.
First, it waited for /sysroot/proc
to appear:
Then I created a directory proc
in the root of the NFS share and tried again:
Here we see that it tries to change root into /sysroot
which is a mounted NFS share.
Here is what is inside the NFS share:
$ find /var/tmp/iso
/var/tmp/iso
/var/tmp/iso/LiveOS
/var/tmp/iso/LiveOS/squashfs.img
/var/tmp/iso/proc
Here is the kernel commandline:
@mikhailnov - it might be that https://github.com/dracutdevs/dracut/issues/1820 needs to be fixed first. I understand that your case might require systemd, but perhaps first you could try to see what happens without systemd (to confirm the bug).
I have been thinking a lot about dealing with sysroot.mount
in this case (I first tried to write my own dracut module before filing this issue) and do not have clear ideas what to do with it. Here is what I tried to do: https://abf.io/mikhailnov/dracut-sysroot-overlay/tree/32f1515520 , but systemd refused to mount when Where= did not match the name of the unit (when Where != /sysroot). Then I tried another approarch https://abf.io/mikhailnov/dracut-sysroot-overlay/tree/master , but it also failed.
Fixing https://github.com/dracutdevs/dracut/issues/1820 seems to require to deal with sysroot.mount
In this case we do not need sysroot.mount to be created from root=nfs:
cmdline, it must be created by dmsquash-live. Not creating it from root=nfs:
is in conflict with the wording of this parameter: it will be root
, but mount not the root.
In case of live=http://<...>
a squashfs file is downloaded by the livenet
dracut module into somewhere in /run
and then is mounted by dmsquash-live into /run/initramfs/squashfs
:
SQUASHED_LOOPDEV=$(losetup -f)
losetup -r "$SQUASHED_LOOPDEV" $SQUASHED
mkdir -m 0755 -p /run/initramfs/squashfs
mount -n -t squashfs -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs
A separate dracut module can be made to mount a network share with that squashfs on it, reusing modules.d/95nfs/nfs-lib.sh
and modules.d/95cifs/cifs-lib.sh
(functions to mount a share can be moved from e.g. modules.d/95cifs/cifsroot.sh
into modules.d/95cifs/cifs-lib.sh
).
Does this sound good?
Hello!
I want dracut to mount a squashfs live root from an NFS share, like it is done by the dmsquash-live module from a local disk. Do I understand correctly that dracut cannot do this?
Why I want it: store a big squashfs on NFS and use it via PXE: the whole OS will be started from this squash, then the content of this squash will be rsynced by Anaconda into the local disk.