Could it be possible to support booting from a root over nfs with the real_root parameter? I'm trying to boot cluster nodes with genkernel but I can't use the initrd (which would be great : genkernel single kernel+initrd, autodetection, everything... :) ) because it seems the linuxrc has trouble with nfsroot... Thanks! (last tried on genkernel-3.1.0e)
What I see that is needed to support this is : -- ability to setup networking in the initrd, perhaps with busybox's "udchpc" dhcp client and a kernel parameter OR : I think there is already a standard ip=X:X:X.. parameter for the kernel to autoconfigure itself, perhaps this would "just work" right now if "kernel level autoconfiguration" is activated? --> change genkernel default kernel config -- the linuxrc should not test if real_root is a block device if, say, we use a real_root=SERVERIPADDRESS:/directory/ format (regexp test it?) -- the linuxrc should be able to mount "ro" an nfs mount, since some setups are setting a read-only system and then mount a "rw" /root, /home, /var, /tmp, using the fstab during the init process. ---> "mount rw $REALROOT" would become "mount $REALROOT" and it would work directly, since we use "SERVERIPADDRESS:/directory" for the real_root= kernel param I think busybox needs to be compiled with the "mount nfs" option so that this works So those are the changes I think would work. I will try to get a patch for this soon.
In Genkernel 3.2.1
These are great news! I've tried it today and found some little problems with it. First, it seems that variables $IP and $NFSROOT are not set, so the function "findnfsmount()" is simply not run, since it starts with an " if IP!='' " test. I've added this to linuxrc : for x in ${CMDLINE} do case "${x}" in ip\=*) IP=`parse_opt "${x}"` ;; nfsroot\=*) NFSROOT=`parse_opt "${x}"` ;; This fixes the problem. Also, when using both "cdroot" and "real_root=/dev/nfs", one must make sure that "cdroot" comes _first_ on the kernel command-line, since "cdroot" sets REAL_ROOT="" (empty... no good!) : # Livecd options cdroot) CDROOT=1 REAL_ROOT='' ;; cdroot\=*) CDROOT=1 CDROOT_DEV=`parse_opt "${x}"` REAL_ROOT='' ;; When doing a "cdroot over nfs", I've had to add this, so we don't try to find a cdrom device and overwrite the $REAL_ROOT [ "${REAL_ROOT}"="/dev/nfs" ] || bootstrapCD Finally, added the nfs part in the big "if" test : if [ "${CDROOT}" -eq '1' -a "${got_good_root}" = '1' -a "${REAL_ROOT}" != "/dev/nfs" ] then # cdrom device already mounted no further checks necessary break else good_msg "Mounting root..." # Try to mount the device as ${NEW_ROOT} if [ "${REAL_ROOT}" = '/dev/nfs' ]; then findnfsmount If it wasn't there, it would just have breaked and returned without going through findnfsmount. (I don't find this very elegant though, maybe you have a better idea?) Thanks for your work, this feature will help save CDs!
Fixed in 3.2.4; thanks!
In initrd.scripts, there is a test which goes like if [ "${NFSROOT}" != '' ]; then if [ "${CDROOT}" != '' ]; then But CDROOT is set in initrd.defaults to CDROOT=0, so the condition is never true. Perhaps replace it with if [ "${CDROOT}" != '0' ]; then Also, good_msg "Attempting to mount NFS CD image on ${NFSPATH}" Gives me Attempting to mount NFS CD image on When booting : NFSPATH is not always set, so I propose using good_msg "Attempting to mount NFS CD image from ${NFSROOT}" The same is true for good_msg "Attemping to mount NFS root on ${NFSPATH}" I was also wondering about UNIONFS, seems it could provide the ability to directly boot a system from ro-NFS and have it rw on the client machine with a rw memory fs overlayed over the root... and, perhaps, on shutdown, the memory fs could be tarred somewhere on the server and then re-overlayed on the client at the next bootup... anyway, just another crazy idea :) Sorry for reopening this bug for the second time! Thanks!
No problem... nothing wrong with reopening a bug if it isn't fixed... =] As for unionfs... there's no automated way to do what you want... there *is* a method of using unionfs to write to any device genkernel can see, however. So you could specify unionfs=/dev/sda1 (where /dev/sda1 is a USB stick), but there's nothing to auto-save the memory portion of it to anywhere. The only thing that does saving is the unionfs= specification. Perhaps if you have a workable solution, or just a good idea on implementation, it would be good to open a new bug on it.
Fixed in 3.3, thanks! Feel free to reopen (again) if issues still occur. Regarding unionfs you're best opening a new bug if you have a good solution or idea for implementation as Chris suggested.