Boot an operating system directly off of a server

So I have been doing some web browsing but all I can come up with are instances of people setting up a server to install an operating system.

What I am trying to achieve is to actually boot the operating system directly off of the server.

In other words there is no local storage on the machine connecting to the install.

I have seen the boot from LAN option in the bios but I have no idea what type of system to setup to actually enable booting.

Ideally i would take a snapshot of my current install and just drop it into wherever I have to.

How is this done?
What kind of system do I have to run?
Where do I start?
Do I use PXE LAN?

Any documentation on this matter would be greatly appreciated, thanks .

The server will have a Threadripper CPU I have and run on TrueNAS Core

I should preface that the reasoning behind this convoluted setup is being able to easily swap operating systems with out installing multiple drives.

I’m considering following this and repeating it for each OS instance.
https://www.xmodulo.com/diskless-boot-linux-machine.html

Are you looking to build a thin client, where all the computation is done on the server, or do you want to do the computation on the local machine?


Either way, you’ll be using a pxe server for this. Tftp and nfs will be important.

2 Likes

VDI is what you are looking for.

Compute on the local machine.

So then VDI is not what you’re looking for.

I haven’t done your specific use case before, but this should be a good jumping off point:

https://networkboot.org/fundamentals/

2 Likes

I was looking into this a couple of years ago too. It makes sense to utilize PXE since it is baked into UEFI or better yet use a special bootloader. The problem is that when you begin to search for PXE you only find a bazillion entry level tutorials about using it for remote installation media, nothing for booting entire OSs. It bothers me, because it should not be hard from a technical perspective, at least not on Linux. I think it would be okay to load the bootloader from a local disc as well. You could custom build them once and then just provision them to clients on a small disk, like a SD-card, loading the data from the server could be based on some kind of authentication for the users. However such a solution I was unable to find, even though I think it would be really practical.

1 Like

I’ve had the same issues. I started looking into PXE boot for Raspberry Pi since it seems like it could make for a nice setup.

You get a Pi with a PoE adapter, configure it to boot off the network, then all configuration can be done through the server instead of on the Pi itself, you could share the boot drive with multiple Pi’s and never have to worry about a failed SD card.

Problem I always see is that most tutorials just tell you to set up an unsecured TFTP server, point the Pi at it and be done. However, that doesn’t seem like a good idea at all security-wise (I mean it’s probably fine at home but that’s no fun).

I haven’t done it (do pxe for os deployment like most though) but essentially I think you’ll need a custom Linux image (eg initial ram disk) to boot via PXE that then mounts its file systems via say, nfs or iscsi

I mean that’s all is deployment does anyway. Boot a very small image via pxe that then mounts or loads other resources via nfs, smb, etc.

Just so happens those images run a bunch of scripts to install to the local disk. But that’s not all you can do.

1 Like

Depending on the network card/bios on your client and/or how far you are ready to get into the internals of network /os/storage things you may have one or two options:

  • easy one, use PXE boot + NFS: the tricky part here as you already noted is to find docs that actually explain how to boot a live file system as opposed to an iso image for os install and also that are current enough and can handle UEFI boot. Luckily for you, as opposed to the old BIOS/PXElinux/custom configs the PXE part is only relevant up until it boots grub from the network, and from there on it is only a matter of getting the right grub params (including nfs)
    A primer for the general tasks involved (focused on PXE/BIOS boot, not UEFI): DisklessUbuntuHowto - Community Help Wiki

A much more detailed (and hence requiring a lot more knowledge) discussion about the challenges of pxe booting an UEFI system:
https://www-abclinuxu-cz.translate.goog/blog/kenyho_stesky/2018/10/diskless-uefi-boot?_x_tr_sl=cs&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=sc

  • more complicated, but potentially more rewarding: learn about iscsi and boot from an ISCSI LUN: this requires either iscsi offload support in the bios of the client/lan interface or getting to know IPXe:
    Diskless iSCSI boot with PXE HOWTO Ā« \1

In either case, you want to search google for ā€˜ubuntu diskless nfs’ more than pxe boot to find more relevant results to your use case

2 Likes

This Netbooting the Live Server Installer via UEFI PXE on Arm (aarch64, arm64) and x86_64 (amd64) | Ubuntu
is the most up to date doc (it is focused on ARM, but has details for x86 as well) I have found that explains how to set up and UEFI pxe env that gets you to grub over LAN

having said that, to make that howto boot an actual live ISO I had to change my grub.conf to:
whetr 172.30.2.7 is my truenas server sharing a copy of the content of the live iso on /mnt/hd01/share/tftpboot/ubuntu-21.04-desktop-amd64/ over nfs

menuentry "Boot Ubuntu Desktop (Focal 20.04.3) (Pull the iso from nfs)" {
        set gfxpayload=keep
        linux   /casper/vmlinuz boot=casper netboot=nfs rw root=/dev/nfs nfsroot=172.30.2.7:/mnt/hd01/share/tftpboot/ubuntu-21.04-desktop-amd64/ splash ip=dhcp  systemd.mask=tmp.mount ---
        initrd  /casper/initrd
}
1 Like

One more:
https://alexforencich.com/wiki/en/linux/diskless_pxe_nfs

1 Like

If you want to do this with Windows, you’ll need iSCSI or ATAoE (ATA Over Ethernet.) Note that signed AoE drivers aren’t easily obtained, but now that Coraid is back in business it may become easier.

I’ve used my Ubuntu Linux desktop workstation diskless for a while back in 2009, no special hardware, no special bios (nor UEFI, this is all before UEFI was a thing)

The setup i had was the following:

  • pxe relies on DHCP next server and filename to fetch the pxelinux bootloader over TFTP. These days dnsmasq is all you need - it has both a DHCP server and TFTP server built-in.
  • pxelinux utilizes the pxe ā€œundiā€ network stack to fetch, load and start executing the kernel and initrd image (in my case it was also from TFTP, but http can work these days too)
  • kernel starts, initramfs starts doing its thing… it contains networks card drivers and firmwares, small DHCP client, and an iscsi initiator. Initramfs hook invokes the initiator - and once the block device appears, it’s mounted, BusyBox calls pivot_root , old root is unmounted and actual init is exec’d.

I initially installed it using debootstrap (I had history with Gentoo and didn’t really know Ubuntu that well).


These days, I’d use an existing os and a VM to do an install into an iscsi target, with /boot on sshfs - so that new kernels and initrd/initramfs images can go someplace where pxelinux bootloader can pick them up.

… and I’d setup dropbear-initramfs - so that I can ssh into the system and poke around if there’s issues, and I’d probably be more security concious in my setup than I was back then.

For example I’d probably run luks encryption on the iscsi target… and I’d investigate maybe some kexec compatible key passing mechanism, so that I don’t have to rely on pxe/tftp for every reboot (e.g. can pxelinux do any kind of verified boot? How?)

… If also consider various redundancy options… e g. Maybe two servers and a zfs/btrfs mirror over iscsi


Back in the day, the setup kicked ass. Workstation was dead silent due too hard drive noise being in another room, and performance was pretty good relative to mechanical storage, because the iscsi target server was caching disk blocks in ram. So in effect, my root filesystem was on a silent 4GB cache HDD; (SSDs weren’t really a thing back then, I still have a pair of 32G SATA patriot warps from that time, latency on them is horrible).

iscsi target software was also running Linux and was exposing an LVM logical volume over iscsi.


FWIW, I never got a non Linux OS running diskless. From what I hear it’s easier these days on Windows 10, I don’t know how.

I did do an install from network where I load winpe over http using pxelinux, and install windows 10 onto local target disk from Samba, i think this is be the basis for a diskless bootable windows 10/11 setup, but I never got that far.

1 Like

Kind of a tangent but back on rhel 6 the anaconda installer let you connect to iscsi and since I was using consumer stuff, I put /boot on a USB and pointed the rest of the filesystems to a iscsi target.

Made hardware swapping fast since all I had to do was boot the USB on another system.

2 Likes