2

For reasons beyond my level of comprehension, I can't seem to boot a rescue instance of fedora 25 over pxe. After countless attempts using the workstation version, I reverted to the server dvd because in the end, the only thing I need is booting pxe fedora to work on my local disk partitions. Alas, no luck there.

Currently looking for the exact meaning of the different keywords in the append line. (pxe, grub, ...) in the hopes of finding the correct magic formula but my googlefu seems to let me down too.

Not having issues with other distros but I'd like to understand why fedora is such a pain.

i.e.: on centos7 pxe (nfs) boot rescue is so very easy:

LABEL c7r
  kernel centos/7/vmlinuz
  append initrd=centos/7/initrd.img method=nfs:192.168.16.252:/pxedev/centos/7 rescue

some attempt on fedora 25:

LABEL f25r
  kernel fedora/25s/vmlinuz
  append initrd=fedora/25s/initrd.img ip=dhcp root=nfs:192.168.16.252:/pxedev/fedora25s/ rescue

installation from PXE (nfs) wasn't difficult:

LABEL f25ws
  kernel fedora/25/vmlinuz
  append initrd=fedora/25/initrd.img ip=dhcp inst.stage2=nfs:192.168.16.252:/pxedev/fedora25/

So I'm missing the required info for pxe rescue of fedora 25. For the server version, I downloaded the dvd: "Fedora-Server-dvd-x86_64-25-1.3.iso" which I then extracted completely in the folder and took the kernel and initramfs from the "images/pxeboot" directory.

5
  • Are you sure the image supports PXE? Do not know about Fedora, however for instance in Debian not all official images support PXE. Mar 12, 2017 at 10:29
  • that's part of the problem, there doesn't seem to be a recent and/or accurate & complete reference. At least, I can't find it. I could however do the install from the ws dvd over pxe using the inst.stage2=nfs etc. It would be nice if there was a coverage of this on the net, I'd be very interested in booting the os from pxe and having the system on nfs over the network. (was possible with debian but haven't tried for some time now)
    – lievendp
    Mar 12, 2017 at 13:02
  • Yes, the Fedora 25 (and 26 and 27) support PXE boot in general, and PXE to rescue mode.
    – Nick
    Feb 15, 2018 at 5:07
  • I should add that Fedora 25 server and up support PXE boot and PXE into rescue mode. The Workstation Live ISOs do not appear to support PXE in any real way.
    – Nick
    Mar 8, 2018 at 5:49
  • @Nick : that's how it appeared to me idd. Nowadays however, I just pxe-install the fedora server (latest avial) and apply a kickstart file to add the groupinstall for workstation. that works fine at home
    – lievendp
    Mar 9, 2018 at 8:18

1 Answer 1

5

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:

  1. DHCP Server that's capable of handing out the next-server parameter.
  2. A working TFTP server
  3. Copies of the kernel image and initial ramdisk
  4. 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.

7
  • For rescue, assuming Fedora is similar to RHEL, the minimum required content in the inst.stage2= location would be: 1.) the .treeinfo file from the installation media, 2.) the LiveOS sub-directory, 3.) the squashfs.img file in the LiveOS sub-directory.
    – telcoM
    Feb 15, 2018 at 6:53
  • RHEL has been based off of Fedora for a couple of major revisions now (maybe more), so I would presume your comment is accurate for CentOS 6 and 7. I haven't watched the traffic too closely, but I'm not sure LiveOS is necesary. The squashfs.img contains everything necessary IIRC.
    – Nick
    Feb 16, 2018 at 0:47
  • The squashfs.img must be located in the LiveOS subdirectory, and as far as I know, there is no way to specify otherwise. In other words: <inst.stage2>/.treeinfo and <inst.stage2>/LiveOS/squashfs.img must be there, no matter what is the value of the inst.stage2 option. I think I initially chose a poor way to describe it.
    – telcoM
    Feb 16, 2018 at 5:50
  • OK, I understand now what you're getting at. Thanks for clarifying.
    – Nick
    Feb 17, 2018 at 23:37
  • Thanks for elaborating, Nick. :-) While I'm aware of the process of pxe booting and booting linux in general (at least for 75%) I found this particular issue with fedora ws only. Currently I moved on by just providing the latest fedora server edt. in my pxe boot environment, supplemented by kickstart for the configuration to add desktops group software.
    – lievendp
    Feb 18, 2018 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .