Install over PXE

Installing and upgrading FreeBSD.

Install over PXE

Postby recus » 25 Feb 2011, 20:21

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).
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby wblock@ » 26 Feb 2011, 01:58

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 [file]FreeBSD-8.2-RELEASE-i386-bootonly.iso[/file] to [file]bootonly.iso[/file]. Otherwise, this just worked for me:
Code: Select all
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 [file]tftp[/file] if that's all you have.

This was just thrown into the [file]default[/file] menu file as shown in PXE Booting Utilities With FreeBSD.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby recus » 28 Feb 2011, 00:33

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?
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby wblock@ » 28 Feb 2011, 01:13

[man=8]pxeboot[/man] says it needs NFS.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby SirDice » 28 Feb 2011, 07:42

recus wrote: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).


FreeBSD Jumpstart Guide
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby recus » 28 Feb 2011, 09:37



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 [FILE]/usr/tftpboot[/FILE]. The whole idea was to just boot over PXE and get [FILE]sysinstall[/FILE] working and installing over network, since the machine doesn't have a CDROM. When booting now I got:

Code: Select all
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: Select all
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?
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby SirDice » 28 Feb 2011, 10:53

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.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby wblock@ » 28 Feb 2011, 16:06

recus wrote:But - my goal is to get all this done without having to use NFS. Do you think it's possible?


Well, yes, did it in post #2. But if you insist on [man=8]pxeboot[/man], it's going to take some work. The pxeboot man page says
The pxeboot bootloader retrieves the kernel, modules, and other files either via NFS over UDP or by TFTP, selectable through compile-time options.


Maybe you can configure it to retrieve an mfsroot image via TFTP.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby jem » 28 Feb 2011, 18:31

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 [FILE]/usr/src/sys/boot/i386/loader/Makefile[/FILE].


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.
jem
Member
 
Posts: 342
Joined: 23 Oct 2009, 11:24

Postby recus » 01 Mar 2011, 01:20

Just a thought, wouldn't it be in the interest of security to be able to boot this way without NFS?
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby jem » 02 Mar 2011, 14:34

While continuing to work on this today, I discovered the following document:

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

This comment stood out:

The main disadvantage of using tftp to fetch a memory file system is that all clients will fetch the same files, load the same kernel and memory file system, regardless of hardware, version of FreeBSD or the purpose of the client.


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.
jem
Member
 
Posts: 342
Joined: 23 Oct 2009, 11:24

Postby wblock@ » 02 Mar 2011, 15:55

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


[man=8]pxeboot[/man] 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.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby jem » 03 Mar 2011, 08:51

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 [FILE]/boot/loader.rc[/FILE], 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: Select all
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
jem
Member
 
Posts: 342
Joined: 23 Oct 2009, 11:24

Postby wblock@ » 03 Mar 2011, 15:29

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.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby loop » 04 Mar 2011, 02:18

recus wrote: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).


I'm installing 8.2 right now in fact, using this guide.

Still needs NFS though.
loop
Junior Member
 
Posts: 52
Joined: 19 Nov 2008, 00:26

Postby recus » 27 Dec 2011, 12:28

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.
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby wblock@ » 27 Dec 2011, 16:08

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 [man=8]pxeboot[/man] would be really useful.
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby recus » 15 Jan 2012, 22:25

Got some response I can't figure out while trying to install 9.0-RELEASE over PXE.
Code: Select all
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?
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby wblock@ » 16 Jan 2012, 03:06

Code: Select all
mount_nfs: no <host>:<dirpath> nfs-name

Network or NFS server problem?
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby recus » 16 Jan 2012, 11:53

wblock@ wrote:
Code: Select all
mount_nfs: no <host>:<dirpath> nfs-name

Network or NFS server problem?


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.
recus
Junior Member
 
Posts: 8
Joined: 31 Dec 2009, 12:28

Postby pbotanik » 19 Jan 2012, 10:23

Good afternoon. Faced with a multiversions [del]Freebsd[/del] 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?
pbotanik
Junior Member
 
Posts: 1
Joined: 18 Jan 2012, 16:39

Postby jhgorse » 11 Jul 2012, 07:37

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?
jhgorse
Junior Member
 
Posts: 1
Joined: 11 Jul 2012, 07:22


Return to Installing & Upgrading

Who is online

Users browsing this forum: No registered users and 0 guests