LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   pxe boot "ubuntu precise" from nfs root - / not found. (https://www.linuxquestions.org/questions/linux-server-73/pxe-boot-ubuntu-precise-from-nfs-root-not-found-4175424165/)

lievendp 08-27-2012 03:21 AM

pxe boot "ubuntu precise" from nfs root - / not found.
 
Hello,

Recently, I got myself a small QNAP nas to support my small fanless htpc with network booting.

As usual, I created an NFS directory where I debootstrapped the precise version from ubuntu, chrooted into it and then did the config for network and locales + tzdata, installed the latest generic kernel, busybox, initramfs-tools etc.

When I boot the system from network, tftp and dhcp work fine because it gets the pxelinux.0 and the new kernel + initramfs from another share on the nas. (in the tftp root directory) the kernel and initrd from the chroot install are then copied to this tftp root ofcourse.

But: the boot process halts with the error that it cannot find the root directory and drops me into busybox. (root=/dev/nfs nfsroot=<serverip><nfsroot>)
So I thought that the problem was with initramfs not supporting network boot.
I chrooted again into the debootstrapped system and went into /etc/initramfs-tools directory, there I changed the boot to NFS in the initramfs.conf file and did update-initramfs -u.

Problem 1: My main system is gentoo and even in chroot, the update-initramfs complained about not finding /lib/modules/3.4.?-gentoo/modules.dep which seemed normal to me because the chroot actually uses the running gentoo kernel. (uname -a confirmed it)
so I found no options in update-initramfs to work around it and created a softlink "ln -s /lib/modules/3.2.?-??-ubuntu-generic /lib/modules/3.4.?-gentoo"

Problem 2: in the chroot, it complains about mtab missing. logically, I have no mtab there, so I created one from fstab and the error also went away.

result: the update-initramfs complains no more but the problem remains and when I pxe-boot, I still get dropped to busybox with the complaint that /dev/nfs cannot be found.
There is no /dev/nfs when I do an ls /dev.

what worked from the busybox (initramfs):
ifconfig <ip>/<mask> eth0
mount -t nfs <nfsip>:<nfsdir> / -o nolock (I need nolock for the qnap nfs implementation)
=> while I'm writing here, it occurs to me that I did not give this nolock option anywhere in the kernel options for the pxe boot (pxelinux.cfg/default) or the initramfs.conf file.

my questions:
1) when I drop into the initramfs system, is it normal to have no network configured, having to manually do ifconfig? I suppose it is, the pxe-boot works and thus I do have network but the system config is probably later in the boot?
Am I missing a module for my nic? A cd-install of ubuntu precise to the harddisk (to be removed) of the htpc did not have problems with my nic.

2) Is it even possible to do the update-initramfs from the chroot in gentoo for this ubuntu system? Or do I have to install ubuntu somewhere and do the update-initramfs there so that the chroot is using the same kernel as the host system? Seems rather ridiculous to me :-)

Any tips are appreciated.

thanks.

lievendp 08-27-2012 03:23 AM

I may have forgotten to copy the newly created initramfs to the tftp root directory to use for pxe boot.. :o
Will try that this evening and post result here. (pfhew, I must have been on drugs or something)

lievendp 08-28-2012 04:20 PM

Meanwhile, I've spent many an hour to get this pxe boot working.

the guest os is ubuntu 12.04 chroot-installation as mentioned before.
the problem is that whatever I try, I get stuck after init-bottom has finished. Some debugging messages in the init script (/usr/share/initramfs-tools/init) show me that it gets stuck here:

exec run-init ${rootmnt} ${init} "$@" ${recovery:+--startup-event=recovery} <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1

this is how I added "debug" msg:
...
log_begin_msg "chain real fs"
echo "rootmnt: ${rootmnt}"
echo "init: ${init}"
exec run-init ${rootmnt} ${init} "$@" ${recovery:+--startup-event=recovery} <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
log_end_msg
panic "Could not execute run-init."

then I did an "update-initramfs -u" in the chroot and copied the new initrd to the pxelinux directory.

my etc/fstab from the chroot env. is like this:

#<filesystem> <mountpoint> <type> <options> <d> <p>
proc /proc proc defaults 0 0
#/dev/nfs / nfs defaults,nolock,nfsvers=3,rw 0 0
192.168.16.10:/vm/chroot2 / nfs4 defaults 0 0
none /tmp tmpfs defaults 0 0
none /var/run tmpfs defaults 0 0
none /var/lock tmpfs defaults 0 0
none /var/tmp tmpfs defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /sys sysfs defaults 0 0

I tried several things, no / mountpoint, normal nfs, whatever I try here seems to be ignored.
After a testrun, I can see that the nfs root has been mounted because the logs in the chroot have been updated with new entries.

and the mtab from chroot is created, it always shows like this:

192.168.16.10:/vm/chroot2 / nfs rw,vers=4,addr=192.168.16.10,clientaddr=192.168.16.134 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
none /tmp tmpfs rw 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /var/tmp tmpfs rw 0 0
rpc_pipefs /run/rpc_pipefs rpc_pipefs rw 0 0

In fact, this is on a second nfs server as my first one is a qnap I thought changing nfs server would help. but no.
when I use the qnap nfs, it correctly shows the ip and chroot mountpoint on that qnap.

for sake of completeness, this is default for the pxeboot:

cthulhu vm # cat /mnt/tftpboot/pxelinux.cfg/default
DISPLAY boot.txt
DEFAULT 1
LABEL 1
kernel ubuntu/precise/amd64/vmlinuz-3.2.0-29-generic
append initrd=ubuntu/precise/amd64/initrd.img-3.2.0-29-generic root=/dev/nfs nfsroot=192.168.16.10:/vm/chroot2,nolock ip=dhcp rw --
PROMPT 1
TIMEOUT 0

Also here, I tried specifying the nfs version with the v3 option in nfsroot parameter.

What am I missing.
all advice welcome.


All times are GMT -5. The time now is 09:33 AM.