Update
2024-06-27 – I’ve created an updated set of scripts that are compatible with Raspberry Pi OS 12 (aka Debian “Bookworm”) to support recent OS changes for network booting.
The Raspberry Pi Network Boot Guide and now the Raspberry Pi Network Boot Guide 2.0 remains our blog’s most popular articles. As of Spring 2024, I have updated my shell scripts to ease implementing network based-booting configuration, as well as automating K3s node prep, for Raspberry Pi users. I have setup a public GitLab project called rpi-prep to ease distribution and will be discussing how to make use of these scripts in this article.
Installation
The only current prerequisite to run these scripts is Fish Shell v3.0+; however, some scripts may automatically install additional dependencies.
While I recommend using Fish Shell over bash, zsh, and other shells as a default, I understand that this is a very personal preference for most folks. All of that said, you should only have to clone the git repository or manually download the individual scripts that you require and then make them executable with chmod +x
. Afterwards, simply execute the script in your favorite shell as long as Fish shell is installed locally.
Why Fish Shell?
Fish Shell, or Friendly Interactive Shell, is a great more modern shell that has gained a lot of support from members of the Linux/Unix community. I have been actively promoting its use at work and with other friends/colleagues because I’ve found it to be much easier to use, configure, and extend than bash, zsh, etc.
A shell is a program that helps you operate your computer by starting other programs. fish offers a command-line interface focused on usability and interactive use.
Unlike other shells, fish does not follow the POSIX standard, but still uses roughly the same model.
Some of the special features of fish are:
- Extensive UI: Syntax highlighting, Autosuggestions, tab completion and selection lists that can be navigated and filtered.
- No configuration needed: fish is designed to be ready to use immediately, without requiring extensive configuration.
- Easy scripting: New functions can be added on the fly. The syntax is easy to learn and use.
- Full fish-shell documentation
Can I have a bash version of these scripts?
I plan on releasing bash equivelants later this year, but haven’t gotten around to it yet.
Use Cases
Inside the scripts folder, this project contains the following Fish Shell scripts:
- prep-k3s-install.fish – Non-interactive script that modifies RPis to meet the current prerequisites in order to support K3s (https://k3s.io)
- prep-netboot-storage.fish – Interactive script to bootstrap an RPi SDCARD to Netboot via NFS/iSCSI.
The most complicated of these scripts is the prep-netboot-storage.fish script. It will install all prerequisite software required to automate the Final Steps section from both Raspberry Pi Network Boot Guides: configures open-iscsi, reports the iSCSI Initiator and RPi serial number for completing the NAS configuration, and then asks all the required inputs to configure the NFS and iSCSI target information.
This script, if used properly, will eliminate human error in modifying configuration files, synchronizing data, etc.
I’ve used this script repeatedly in my homelab with Raspberry Pi OS 64-bit edition without fail; however, I hope to keep improving the script with undo functionality, as well as better error handling.
Caveats
When visiting the GitLab project site, please note the following cavaets about the releases of the scripts:
- Release v1.1.x – Supports Raspberry Pi OS 12 “Bookworm” only
- Release v1.0.0 – Supports Raspberry Pi OS 11 “Bulleye” and earlier only
Make sure you download the proper release based on which version of Raspberry Pi OS you are using. Several scripts released with v1.0.0 were also deprecated with the release of v1.1.x versions. Please see the GitLab site for more details.
Conclusion
I hope to add additional scripts over time to rpi-prep , as my end-goal is to automate all of my most common administrative tasks in software moving forward, so that rebuilding the homelab is trivial and more consistent.
Discover more from Warmest Robot + Warmest Human
Subscribe to get the latest posts sent to your email.