PiServer

Last updated 5-17-2023

If you google “piserver” you will get a lot of links with outdated information. Piserver will be found in the current Raspberry Pi OS under the menu category “Preferences” but the version supplied does not yet recognize the Pi 4B model and no longer is supplied in the default OS images . However, the source files have been updated to recognize the Pi 4B and you just have to build them for armhf, i386, or amd64 depending on what you want to use as your PXE server. You really do want to use the Pi 4B or Pi 400 models for your clients because they have true gigabit ethernet ports and will PXE boot faster than the Pi 3, 3B, 3B+ models with very little price difference.

First I will quote from Gordon Hollingswoth’s January 04, 2018 article :

“Use this tool to easily set up a network of client Raspberry Pis connected to a single x86-based server via Ethernet. With PiServer, you don’t need SD cards, you can control all clients via the server, and you can add and configure user accounts — it’s ideal for the classroom, your home, or an industrial setting.

PiServer diagram

Client? Server?

Before I go into more detail, let me quickly explain some terms.

  • Server — the server is the computer that provides the file system, boot files, and password authentication to the client(s)
  • Client — a client is a computer that retrieves boot files from the server over the network, and then uses a file system the server has shared. More than one client can connect to a server, but all clients use the same file system.
  • User – a user is a username/password combination that allows someone to log into a client to access the file system on the server. Any user can log into any client with their credentials, and will always see the same server and share the same file system. Users do not have sudo capability on a client, meaning they cannot make significant changes to the file system and software.

I see no SD cards

Last year we described how the Raspberry Pi 3 Model B can be booted without an SD card over an Ethernet network from another computer (the server). This is called network booting or PXE (pronounced ‘pixie’) booting.

Why would you want to do this?

  • A client computer (the Raspberry Pi) doesn’t need any permanent storage (an SD card) to boot.
  • You can network a large number of clients to one server, and all clients are exactly the same. If you log into one of the clients, you will see the same file system as if you logged into any other client.
  • The server can be run on an x86 system, which means you get to take advantage of the performance, network, and disk speed on the server.

Sounds great, right? Of course, for the less technical, creating such a network is very difficult. For example, there’s setting up all the required DHCP and TFTP servers, and making sure they behave nicely with the rest of the network. If you get this wrong, you can break your entire network.

PiServer to the rescue

To make network booting easy, I thought it would be nice to develop an application which did everything for you. Let me introduce: PiServer!

PiServer has the following functionalities:

  • It automatically detects Raspberry Pis trying to network boot, so you don’t have to work out their Ethernet addresses.
  • It sets up a DHCP server — the thing inside the router that gives all network devices an IP address — either in proxy mode or in full IP mode. No matter the mode, the DHCP server will only reply to the Raspberry Pis you have specified, which is important for network safety.
  • It creates usernames and passwords for the server. This is great for a classroom full of Pis: just set up all the users beforehand, and everyone gets to log in with their passwords and keep all their work in a central place. Moreover, users cannot change the software, so educators have control over which programs their learners can use.
  • It uses a slightly altered Raspbian build which allows separation of temporary spaces, doesn’t have the default ‘pi’ user, and has LDAP enabled for log-in.

What can I do with PiServer?

Serve a whole classroom of Pis

In a classroom, PiServer allows all files for lessons or projects to be stored on a central x86-based computer. Each user can have their own account, and any files they create are also stored on the server. Moreover, the networked Pis doesn’t need to be connected to the internet. The teacher has centralised control over all Pis, and all Pis are user-agnostic, meaning there’s no need to match a person with a computer or an SD card.

Build a home server

PiServer could be used in the home to serve file systems for all Raspberry Pis around the house — either a single common Raspbian file system for all Pis or a different operating system for each. Hopefully, our extensive OS suppliers will provide suitable build files in future.

Use it as a controller for networked Pis

In an industrial scenario, it is possible to use PiServer to develop a network of Raspberry Pis (maybe even using Power over Ethernet (PoE)) such that the control software for each Pi is stored remotely on a server. This enables easy remote control and provisioning of the Pis from a central repository.” https://www.raspberrypi.com/news/piserver/

Now to build piserver, for the hardware you plan to use as the server, so that you can PXE boot Pi 4B clients. The documentation in this next link is all current and worked for me, so please go to it. https://github.com/raspberrypi/piserver

If you build piserver for an Android TV Box repurposed with Armbian linux, you will need the additional dependency below, but not for Mint 20.2 XFCE linux 64 bit for i386 and amd64 motherboards, and nor for a Raspberry Pi used as the piserver (the current version is new enough, so you don’t have to build it from source).

sudo apt-get install dnsmasq

Noting the end of the building piserver README.md, the piserver needs a static address and its client firmware need to be able to request PXE boot files from that static address, so there needs to be a DHCP server running that has that information( and only one DHCP server to avoid conflicting and unpredictable results). In some installations, the server might have two network devices, one for the pi client subnet with a static address and a proxy server to resources on the internet though the other network interface. I am not ready to make a recommendation so will refer you to Jon Witts’ May 26,2021 blog at:

https://www.jonwitts.co.uk/archives1422#Set_a_Static_IP_Address

If you change the piserver IP address, you need to inform piserver of this change.

piserver --update-ip 

If you have other computers on your LAN, they are likely getting their IP addresses from the DHCP server in the router. If you configure your piserver with a static address, then it does not make a DHCP request for an IP address and the router does not learn its hostname and you will not be able to use that hostname to ssh into the piserver computer but will have to use its static address. A more elegant solution is to configure the router to “reserve” a fixed address for the MAC of the piserver computer. Then the piserver computer makes a DHCP request and is always returned the static address you reserved and the hostname is available on the LAN.

Select proxy in the piserver configuration. Then all DHCP requests are handled by the router and dnsmasq is only used to respond to a broadcast from the firmware of piserver clients for the address of the TFTP server to network boot.