Hello Camm, On Tue, 2004-02-24 at 10:01, Camm Maguire wrote: > Greetings! > > Adam C Powell IV <[EMAIL PROTECTED]> writes: > > > On Wed, 2004-02-18 at 19:06, Carlos O'Donell wrote: > > > > Searched a bit, and people seem to think this happens when devfs isn't > > > > mounted. But /dev is mounted with devfs. Any idea what else it could > > > > be? Or is cheating with pivot_root to get NFS root on a non-NFS-root > > > > kernel just never going to work? > > > > > > > > One other thing: /initrd/var won't unmount because it's busy, presumably > > > > with dhclient and/or mount stuff. Perhaps this is interfering? > > > > > > Don't use devfs. Your life will be happier. Any particular reason for > > > using devfs? > > > > Never mind, with some searching, got it working for any stock Debian > > kernel-image package, with devfs, with the network driver as a module. > > There's no need to compile a kernel any more to boot nfs-root, and it > > works well with the diskless package. > > > > I'll post details later. Not tested with 2.6. > > I'd be interested in these. And whether you are using initrd, which > we also use.
I've attached the new "nfs" script, which you should put in /etc/mkinitrd/scripts. Then edit /etc/mkinitrd/modules, adding at least your NIC driver, nfs, and if using DHCP, af_packet. Unfortunately, this doesn't quite work for woody, whose mkinitrd doesn't get all of the modules and their dependencies into the initrd correctly. I had to hack the mkinitrd scripts a bit to get it to work, but I think I reverted all of my changes so it works with un-hacked mkinitrd; if it gives you trouble, let me know. So with this script installed, you should be able to e.g. "apt-get install kernel-image-2.4.24-3-686-smp" and postinst will make the initrd which will mount everything nfs-root. Then just mknbi-linux with vmlinuz and the initrd, and you're good to go. (Well, assuming you've set up the tftp server to serve the NBI, and the NFS server to serve the root directory which you told diskless about...) One more thing: this bloats the initrd quite a bit, particularly with DHCP, so on arches like alpha and IA-64 it might not fit in 4MB. The workaround is to expand the maximum initrd size, but that's a kernel compile-time parameter, which kinda defeats the purpose... :-( I'll put all this in the Wiki when I get some time. Zeen, -Adam P. GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6 Welcome to the best software in the world today cafe! http://lyre.mit.edu/~powell/The_Best_Stuff_In_The_World_Today_Cafe.ogg
#!/bin/sh # This little mkinitrd script is copyright Adam Powell February, 2004, # based on Russell Coker's (uncopyrighted?) work written up at # http://lists.debian.org/debian-devel/2001/debian-devel-200109/msg00307.html . # No warrantee, use at your own risk, distribute under GPL version 2 or later. # This puts a bunch of stuff in /scripts/nfs in the initrd, which is run by # /sbin/init after /linuxrc when a system net-boots. # Parameters NFS_SERVER=10.5.5.1 # make a directory for mounting the NFS root file system mkdir $INITRDDIR/new-root install -d $INITRDDIR/etctmp/network cp /etc/network/interfaces /etc/network/options $INITRDDIR/etctmp/network mv $INITRDDIR/etc/* $INITRDDIR/etctmp # These three lines are only needed for dhclient cp /etc/dhclient.conf $INITRDDIR/etctmp cp /etc/dhclient-script $INITRDDIR/etctmp chmod 755 $INITRDDIR/etctmp/dhclient-script # dhclient-script uses uname, expr and sleep which aren't in the initrd, but # it seems to work out anyway. # my script needs ifconfig, pivot_root, and mount which aren't installed by # default, change ifconfig to dhclient, pump, etc for dynamic IP addresses cp /sbin/ifconfig /sbin/dhclient /sbin/ifup /sbin/route /sbin/portmap $INITRDDIR/sbin cp /bin/cp /bin/mkdir /bin/run-parts $INITRDDIR/bin # The first two are needed for cp, the last two for portmap cp /lib/libacl.so.1 /lib/libattr.so.1 /lib/libwrap.so.0 /lib/libnsl.so.1 $INITRDDIR/lib # Create this script to be run on the initrd after modules have been loaded cat > $INITRDDIR/scripts/nfs << END #!/bin/sh mount -nt proc proc proc # This sets up /etc and /var as tmpfs or ramfs, so ifup and others can use them mount -nt tmpfs tmpfs /etc || mount -nt ramfs ramfs /etc mount -nt tmpfs tmpfs /var || mount -nt ramfs ramfs /var cp -a /etctmp/* /etc/ mkdir /etc/network/if-down.d mkdir /etc/network/if-post-down.d mkdir /etc/network/if-pre-up.d mkdir /etc/network/if-up.d mkdir /var/lib mkdir /var/lib/dhcp echo "Configuring network" ifup -a portmap # Uncomment these for network diagnostics #echo "Network configuration, test..." #ifconfig #route #ping -c 5 www.debian.org echo "Mounting root" mount -n -o ro -t nfs $NFS_SERVER:/var/lib/diskless/default/root /new-root mount -n none -t devfs /new-root/dev cd /new-root umount /proc echo "Switching to new root" pivot_root . initrd # This stuff is from diskless /sbin/init, because it might be necessary to have # resolv.conf and ifstate right. mount -nt proc proc proc . /etc/diskless-image/config IP=\`ifconfig | grep -A1 eth0 | grep -v eth0 | sed 's/^.*inet addr:\([0-9\.]\+\).*$/\1/'\` echo "Client IP address is \$IP" # Mount client's /etc directory echo -n "Mounting NFS-root directories..." mount -n \$nfsserver:/\$nfshostsdir/\$IP/etc /etc -orw,nolock mount -n \$nfsserver:/\$nfshostsdir/\$IP/var /var -orw,nolock # Put state files where they should go cp -f /initrd/etc/resolv.conf /etc cp -f /initrd/etc/network/ifstate /etc/network cp -f /initrd/var/lib/dhcp/* /var/lib/dhcp # Clean up old mount points (though /initrd/var doesn't unmount) umount /var umount /etc umount /initrd/etc umount /initrd/var # Signal to init that root is already mounted echo 256 > proc/sys/kernel/real-root-dev END chmod 755 $INITRDDIR/scripts/nfs

