1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Install over PXE

Discussion in 'Installing & Upgrading' started by recus, Feb 25, 2011.

  1. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Is it possible to boot a computer with PXE and go directly to sysinstall? The documentation I find is only on diskless clients, and demands a lot of work (building own root on a NFS-mount etc).
     
  2. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
    A boot loader will have to load a memstick or CD image into memory on the target machine. You'll still have to have a PXE server, with at least TFTP and preferably HTTP for speed. And of course the target machine has to have enough RAM to hold the image and leave enough free to run the installer.

    Syslinux seems to have filename length problems, so I renamed FreeBSD-8.2-RELEASE-i386-bootonly.iso to bootonly.iso. Otherwise, this just worked for me:
    Code:
    label freebsd-install
      menu label FreeBSD Install
      linux memdisk
      initrd http://192.168.1.1/images/freebsd-install/bootonly.iso
      append iso raw
    
    Change that initrd line to use tftp if that's all you have.

    This was just thrown into the default menu file as shown in PXE Booting Utilities With FreeBSD.
     
  3. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Can this be done without involving Syslinux? I'm able to boot using PXE and fetching the file /boot/pxeboot (as configured in dhcpd) from the server using TFTP. But from there NFS is need, or am I mistaking?
     
  4. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
  5. SirDice

    SirDice Moderator Staff Member

    Messages:
    17,358
    Likes Received:
    0
    FreeBSD Jumpstart Guide
     
  6. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Ok, I wanted to get around the whole compiling of a new kernel and the most in chapter 3 of that link. So I copied the 8.2-install CD into /usr/tftpboot. The whole idea was to just boot over PXE and get sysinstall working and installing over network, since the machine doesn't have a CDROM. When booting now I got:

    Code:
    Lookup of /dev for devfs, error: 2
    init: not found in path
    /sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall
    After some grey hairs I found that telling the loader this made it work:

    Code:
    load /boot/kernel/kernel
    load -t mfs_root /boot/mfsroot
    set vfs.root.mountfrom="ufs:/dev/md0"
    boot
    But - my goal is to get all this done without having to use NFS. Do you think it's possible?
     
  7. SirDice

    SirDice Moderator Staff Member

    Messages:
    17,358
    Likes Received:
    0
    It may be possible if you use the old floppy boot but I'm not sure if that's supplied anymore. The installer itself is able to install from FTP, HTTP etc.

    In theory you may be able to PXE boot those install floppies and do the rest of the installation via FTP or HTTP.
     
  8. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
    Well, yes, did it in post #2. But if you insist on pxeboot(8), it's going to take some work. The pxeboot man page says
    Maybe you can configure it to retrieve an mfsroot image via TFTP.
     
  9. jem

    jem New Member

    Messages:
    345
    Likes Received:
    0
    I've been playing around with setting up FreeBSD PXE booting today as I'm also trying to create a boot environment that runs from RAM and simply presents me with a shell with all the tools available to manually set up a FreeBSD system. I've had a few stumbles along the way, and have worked out the following:

    1. The PXE ROM in the network card uses tftp to fetch the pxeboot loader.
    2. The pxeboot loader uses NFS to read /boot/loader.rc
    3. loader.rc and its includes tell pxeboto how to load the kernel, modules, mfsroot images etc. These will all be fetched using NFS also.
    4. By default, the kernel will attempt to mount the same filesystem it was loaded from as its root filesystem.

    pxeboot is by default only an NFS client, but you can recompile it to add tftp support instead of NFS. This might be useful if you want to use an mfsroot, because you obviously can't mount a filesystem using tftp. See /usr/src/sys/boot/i386/loader/Makefile.


    I've managed to get a host netbooting into sysinstall using the same mfsroot filesystem that the official installation media uses, but the Fixit option that I use for manual installs doesn't work as it expects the fixit environment to be on CD/DVD, USB or floppy.

    My next step is to look into creating a custom mfsroot that boots to a shell, not to sysinstall.
     
  10. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Just a thought, wouldn't it be in the interest of security to be able to boot this way without NFS?
     
  11. jem

    jem New Member

    Messages:
    345
    Likes Received:
    0
    While continuing to work on this today, I discovered the following document:

    http://www.locolomo.org/howto/pxeboot/article.html

    This comment stood out:

    This eliminates tftp as a possibility for me, as I'll want to use different kernels and mfsroot images for amd64 and i386 respectively.


    On another issue, I was able to find and use an alternative mfsroot image to the standard 'sysinstall' one from the FreeBSD install media.

    I used mfsBSD to generate an image suitable for 'dd'ing to a disk, then opened it up with mdconfig+mount and took the mfsroot.gz file out of it. This one boots into a root shell environment and has all the tools available to set up a system manually.
     
  12. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
    pxeboot(8) only looks at the root-path provided by the DHCP server, so yes, you only get that one filesystem. Being able to provide an alternate path would be nice. I think some of the Linux loaders use optional DHCP fields for that.
     
  13. jem

    jem New Member

    Messages:
    345
    Likes Received:
    0
    Well, dhcp can always give out a different NFS root-path for each host so no problem there.

    By default, when using tftp, the pxeboot loader will only look for /boot/loader.rc, but perhaps the Fourth language in the loader is flexible enough to use logic to determine which kernel file to load after that, basing it on the MAC address of the machine for example? That information is certainly exposed within the loader environment:

    Code:
    OK show
    LINES=24
    acpi_load=YES
    autoboot_delay=NO
    boot.netif.gateway=192.168.0.1
    boot.netif.hwaddr=08:00:c0:a8:00:52
    boot.netif.ip=192.168.0.82
    ...
    kernelname=/boot/kernel/kernel
    I can't imagine it would be too difficult to make pxeboot search for kernels to load in a similar way to pxelinux, by searching for ever less IP-address specific file names until it finds a match, e.g.

    • kernel.c0a80052
    • kernel.c0a800
    • kernel.c0a8
     
  14. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
    Using MAC works fine for diskless workstations, but it doesn't give you any runtime choice as to which kernel/filesystem is used. If pxeboot took an optional parameter, a path to a TFTP directory to boot from, it would be useful. No idea how hard that would be to implement.
     
  15. loop

    loop New Member

    Messages:
    52
    Likes Received:
    0
    I'm installing 8.2 right now in fact, using this guide.

    Still needs NFS though.
     
  16. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Can someone explain to me why NFS is preferred for this operation and not http, ftp or tftp? Would be far more secure and easier to administer.
     
  17. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
    Possibly because there's built-in support for using NFS, while there isn't anything for using a TFTP, FTP, or HTTP address as a filesystem. Adding support for that to pxeboot(8) would be really useful.
     
  18. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Got some response I can't figure out while trying to install 9.0-RELEASE over PXE.
    Code:
    Trying to mount root from nfs: []... 
    fxp0: link state changed to DOWN 
    NFS ROOT: 192.168.1.2:/usr/local/pxeboot 
    fxp0: link state changed to UP 
    Interface fxp0 IP-Address 192.168.1.3 Broadcast 192.168.1.255 
    Entropy harvesting: interrupts ethernet point_to_point kickstart. 
    Starting file system checks: 
    mount_nfs: no <host>:<dirpath> nfs-name 
    Mounting root filesystem rw failed, startup aborted 
    ERROR: ABORTING BOOT (sending SIGTERM to parent!) 
    Jan 15 21:44:45 init: /bin/sh on /etc/rc terminated abnormally, going to singel user mode 
    Enter full pathname of shell or RETURN for /bin/sh: 
    
    Once in the shell I can type ls and df -h and see that the mounted bootonly iso is there over NFS. But what went wrong?
     
  19. wblock@

    wblock@ Administrator Staff Member Developer

    Messages:
    11,156
    Likes Received:
    5
    Code:
    mount_nfs: no <host>:<dirpath> nfs-name
    
    Network or NFS server problem?
     
  20. recus

    recus New Member

    Messages:
    8
    Likes Received:
    0
    Seems to me to be NFS. Network up, got pxeboot from tftp on same address as NFS. Tried 8.2-RELEASE to eliminate 9.0 issues, but same output.
     
  21. pbotanik

    pbotanik New Member

    Messages:
    1
    Likes Received:
    0
    Good afternoon. Faced with a multiversions Freebsd FreeBSD. Is it possible to install version 8.2 amd64 and 8.2 i386 via pxeboot server do not use NFS server? Perhaps there is another way?
     
  22. jhgorse

    jhgorse New Member

    Messages:
    1
    Likes Received:
    0
    Perhaps consider using iPXE which has builtin support for http, SAN, and so on.
    http://ipxe.org/

    There are still some caveats regarding the "kernel memdisk" method for booting ISO files. I have only successfully been able to boot an mfsbsd and bootonly ISOs using this method. I presume this has something to do with the setup of the ISO or the lack of correct kernel/initrd/kernel flag arguments within the pxelinux.cfg menu item for the other ISOs.

    Does anyone know what kernel file and flags the FreeBSD boot ISO requires (i)pxelinux to us in order to mount the ISO as root?