3

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

MishaP
  • 131
  • 1
  • 3

1 Answers1

1

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

Pat
  • 3,339
  • 2
  • 16
  • 17
  • Hmm, if it is a kernel/initrd set issue, wouldn't I get a kernel panic if I only passed the kernel/initrd set in `/tftpboot/pxelinux.cfg/default`? Right now, I am able to get the system to boot into `(initramfs)` prompt if I use the server's kernel/inird set without any kernel panic, but as soon as I add my squashfs, it starts to panic. – MishaP Nov 02 '15 at 22:33
  • if you get a kernel panic the "set" is not right for PXE boot; it is usually the kernel/initrd set but it could also include the squashfs. bottom line get a working set and customize from there. the other way around (assembling a PXE set from scratch) is way harder – Pat Nov 03 '15 at 01:52
  • I don't think it's harder, I remember doing it with my dad when I was ~10 years old. I just can't find instructions about how to do it. IMO debloating any flavor of linux is more difficult than it sounds. The bloat consists of 100s or 1000s of libraries and packages, all of which are a few KB each, but add up to 1GB+. It seems that if I had a decent instruction manual, the result would be achieved quicker and cleaner from scratch, than by debloating. – MishaP Nov 16 '15 at 23:37