PXE boot kernel panic

initramfskernelnetbootpxe-boottftp

I am having trouble setting up a PXE boot server. I've got isc-dhcp-server running, tftp-hpa serves the files over tftp (verified works), and apache2 hosts the rootfs image. The PXE client seems to download the kernel and initrd files correctly, then kernel panics.

Here is my /tftpboot/pxelinux.cfg/default:

default pxeboot

label pxeboot
kernel vmlinuz-3.16.0-4-amd64
append initrd=vmlinuz-3.16.0-4-amd64 ip=dhcp boot=live fetch=http://xxx.xxx.xxx.xxx/filesystem.squashfs

My server is an Ubuntu 15.04 mini installation.

I initially followed the following instructions to create the fimesystem.squashfs root file system image: http://djlab.com/2014/10/debian-pxe-boot-image-from-scratch/

I then followed these instructions to install DHCP and TFTP: https://help.ubuntu.com/community/DisklessUbuntuHowto

But I had to modify the /etc/default/tftpd-hpa to make TFTP serve files to this:

# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="xxx.xxx.xxx.xxx:69"
TFTP_OPTIONS="--secure"
RUN_DAEMON="yes"

If I change TFTP_OPTIONS as per DisklessUbuntuHowToinstructions, tftp no longer starts. Then I fired up an apache2 server, and that seems to show the files that I put in /var/www/html/ as intended, and I can download files from http://xxx.xxx.xxx.xx/filesystem.squashfs, but the kernel panics while booting.

I initially took the kernel and initrd images from my host /boot/ dir, because my chroot/boot/ dir was empty, but then I installed a kernel on chroot using these instructions: http://willhaley.com/willhaley/blog/create-a-custom-debian-live-environment/

chroot chroot
apt-get install --no-install-recommends --yes \
linux-image-3.16.0-4-amd64 live-boot

Then I copied the kernel and initrd images from the chroot/boot/ dir, but kernel still panics. If I modify my /tftpboot/pxelinux.cfg/default to:

default pxeboot

label pxeboot
kernel vmlinuz-3.16.0-4-amd64
append initrd=vmlinuz-3.16.0-4-amd64

and use the kernel and initrd images from the host /boot, the client loads the two images, and dumps me into an (initramfs) prompt. If I use the chroot/boot/ images, it still kernel panics.

I've never debugged kernel panics before, so I don't even know what log files to check. Any help would be appreciated,

Misha

EDIT: Here is a video of the PXE client booting and kernel panic-ing: https://www.youtube.com/watch?v=WlhEmNx8J8M

Best Answer

your kernel panics because it is not a a PXE compatible kernel/initrd set. If I were you I would not reinvent the wheel; take a proved PXE compatible distro and customize initrd to your needs and add the required squashfs. For a big list of PXE compatible distros and their corresponding parameters see Serva