The TL;DR is that you forgot to give it the inst.stage2 parameter for the rescue image. the initrd and kernel are not enough to boot Fedora into rescue mode, it requires the second stage loader of Anaconda. Replace your root=nfs
thing with inst.stage2=nfs:192.168.16.252:/pxedev/fedora25/
and you should be off to the races.
Longer answer:
PXE booting is a bit of a challenge, since it requires a lot of moving parts:
- DHCP Server that's capable of handing out the next-server parameter.
- A working TFTP server
- Copies of the kernel image and initial ramdisk
- Functional HTTP server that serves the contents of the mounted ISO image (NFS can be used as an alternative)
What follows is how I make it work.
Software Installation
dnf -y install dhcp-server tftp-server httpd syslinux-tftpboot
ISC DHCPd Section
n.b.: YMMV with other DHCP servers.
The next-server
parameter is the IP of your TFTP server.
Subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option routers 192.168.0.1;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.0.2;
filename "pxelinux.0";
}
}
TFTPd section
Fedora puts the TFTP root in /var/lib/tftpboot
, which is where you'll need to create a couple directories to contain your boot images and pxe config.
I usually make my subdirectories something like this:
$OSVER/$ARCH
so I can have multiple versions of Fedora PXE bootable at any given time.
Then, like you, I copy the initrd
and vmlinuz
files from the images/pxelinux
directory off of the ISO image and into the appropriate subdirectories for tftpboot.
Next, in your tftpboot directory, make a directory called pxelinux.cfg
. Inside this directory, you'll make your config file, called default
. In this file, you'll produce entries similar to this:
default vesamenu.c32
prompt 0
timeout 100
label local
menu label Boot from ^local drive
localboot 0xffff
label f25_x86_64
menu label Fedora 25 x86_64 (Generic)
kernel f25/x86_64/vmlinuz
append initrd=f25/x86_64/initrd.img repo=http://192.168.0.2/os/fedora/25/x86_64/ ks=http://192.168.0.2/ks/f25-x86_64-ks.cfg
label f25_rescue
menu label Fedora 25 ^Rescue Mode
kernel f25/x86_64/vmlinuz
append initrd=f25/x86_64/initrd.img inst.stage2=http://192.168.0.2/os/fedora/25/x86_64 rescue
The stage 2 images are large enough that delivering them over PXE is occasionally problematic, so I deliver them through HTTP.
Next, you'll want to move all the *.c32
files from /tftpboot/
to /var/lib/tftpboot
as syslinux-tftpboot isn't aware of tftp-server's different root directory for some reason.
HTTPD section
Get the ISO image available via HTTPD:
The easiest way to do this is to mkdir /var/www/html/os/fedora/$FEDORAVERSION/$ARCH
and then mount -o loop,uid=48,gid=48,mode=0755 /path/to/fedora-server.iso /var/www/html/os/fedora/$FEDORAVERSION/$ARCH
Once all the daemons are configured and enabled, boom, it just works.
If you want to boot Fedora 27, you can basically sed -r -e s/25/27/g
on all the above configs, and it will work.