Install NetBSD on a Vintage ComputerFollow article
Put that cherished computer to good use, while getting hands-on with an O/S that can trace its history back over more than 40 years and remains actively developed today.
NetBSD is one of the three main descendants of the Berkeley Software Distribution (BSD), an operating system based on the original Unix O/S which was famously developed at Bell Labs. While the other two descendants, FreeBSD and OpenBSD, focus on server applications and security, NetBSD instead focuses on code clarity, careful design, and portability across many architectures. The latter giving way to the project motto, “Of course it runs NetBSD”.
In fact, as of 2019, NetBSD supported no less than 59 hardware platforms across 16 different instruction sets. These ranging from physically enormous classic VAX computers to now-retro PDAs, along with a great deal of other hardware, both esoteric and more common.
It should be noted that NetBSD is also well supported on modern commodity hardware and many users run it on their main computers. Thanks to its “pkgsrc” package management system, you can also enjoy much of the very same software that you might use on Linux too, such as desktop applications like Firefox and LibreOffice, plus server software like Nginx, along with no shortage of programming languages and runtimes, such as Python and Node.js.
To find out if your hardware is supported, check the ports page. Each port will have a set of release information, such as installation notes. For example, here are those for installing NetBSD on a PowerPC Mac. Each port will also have a mailing list which you can subscribe to in order to follow development, along with posting questions when the need arises. Of course, you should only really post questions when you’ve exhausted other avenues, such as the provided documentation and after checking the mailing lists archives to see if the question was previously answered.
If you don’t have some exciting vintage hardware or a spare PC, fear not, as you can install NetBSD on a Raspberry Pi — else even just inside a virtual machine, should you wish.
While a common menu-based program, “sysinst”, is typically used for driving the installation, the actual mechanism for loading the O/S may vary. In this example we’ll be installing onto a Cobalt Qube, an early personal micro-server. Since this has neither a CDROM drive nor USB interface, it must be booted over the network from a laptop running a special restore system.
A Thinkpad x60s — itself now becoming something of a classic computer — was used to run the restore system. It wasn’t necessary to actually install anything onto it’s HDD and instead a bootable USB stick was created, using an image downloaded from the NetBSD website. In the same directory there is also an ISO file, which can alternatively be used to burn a bootable CD.
For complete instructions, see the NetBSD/cobalt Restore CD HOWTO. Here you can also find details of the restorecd script which is actually used to build the USB and ISO images. This can be run on non-NetBSD systems and just requires a few modifications for the system it is run on. However, at the time of writing it looks as though there are some known issues with this and so for now at least, it’s best to just download a ready made image.
The restore system should be connected to the Qube via an Ethernet cable. The HOWTO suggests using a crossover cable, but this should only be necessary if the restore system computer is really quite old, since Ethernet ports have generally supported Auto MDI-X (crossover) for some time.
It may not be strictly necessary, but it’s also very useful to have a terminal emulator connected to the serial port on the Qube, which will require a null modem (crossover) cable, since both the Qube and laptop/PC will be data terminal devices (DTE). The port should be configured for 115200 baud.
Booted restore system.
Once the restore system has fully booted it will finish with a login prompt. At this point we can power up the Qube and to boot from the network, we hold down the left and right arrow keys while powering on. Once we see “Net Booting” on the LCD display we can then release the arrow keys.
At this point if we have a serial connection we will see console output as it boots over the network. Above we can see in the line starting “Boot” a default of “nfs:netbsd”. Once the bootloader has been loaded there is a short period of time where we can enter an alternate string here. If we wanted to run the normal sysinst instealler, we would enter “netbsd.sysinst” and return.
Above we can see the sysinst menu-driven installer, which gives us a lot of control over installation options and allows us to run tools to partition the disk and format partitions etc. However, it’s much easier to go with the default installer for this platform, which uses the Qube’s LCD instead.
So assuming we went with the default boot option, after a short while we would see “restorecd ready” on the LCD panel and the IP address that the Qube leased via the restore system DHCP server. At this point we can use the Select button to enter the menu system and commence restore.
Following which the HDD will be formatted and the various NetBSD system sets will be copied across from the restore system and extracted. Upon completion, the Qube will be rebooted.
Note that this is a pretty atypical NetBSD installation process and most use sysinst, since they don’t have an LCD panel and buttons. However, the menu system is very intuitive and the process is guided. Manual steps should only need to be taken if there is some sort of issue or you have special requirements, such as multi-booting.
Fragment from /etc/defaults/rc.conf.
As the HOWTO notes, the freshly installed system will be in a highly insecure state and details of the next steps can be found in the afterboot man page. Such as setting a root password and adding the first non-root user.
Those unfamiliar with BSD ways will probably be wondering how you carry out basic system configuration. Much of this is done via the /etc/rc.conf file, which is where you can set a hostname and configure which services you’d like to start, amongst other things. Assuming you don’t enable DHCP, you would then configure network interfaces via either rc.conf or a file, /etc/ifconfig.nnX, where nnX is the name of the interface. In the case of the Cobalt Qube, the Primary network interface is tlp0 and the Secondary Ethernet port is tlp1.
With initial configuration out of the way, we now have a basic NetBSD system and, rather pleasingly, this takes up a mere 592M of disk space. Which is quite refreshing when you consider that most Linux systems, even with a minimal installation, will require many times this amount of disk space (of course, embedded tools such as Yocto/Poky and Buildroot can be used to create minimal Linux systems which are much more compact).
The system comes with a C compiler and make installed and at this point we could start to compile programs. However, it probably wouldn’t take long before we needed to first install some dependencies and we could quickly end up building their dependencies, and so on...
The NetBSD Packages Collection, a.k.a. pkgsrc, is described as “a framework for building third-party software on NetBSD and other UNIX-like systems”. It is supported not just on NetBSD, but Solaris and Linux also, along with FreeBSD, OpenBSD and numerous proprietary UNIXes. This makes the job of installing software and managing dependencies much easier.
Comprehensive details are provided in the pkgsrc guide, including how to stay up-to-date and how to create packages. Note that we can install binary packages or build from source. Although at the time of writing, it appears as though binary packages for Cobalt were last built for NetBSD 8.0.
So to start with, we need to set up pkgsrc and we decided to go with the stable branch. We can get the archive initially via FTP or CVS, and then the preferred way to update this is using CVS. Once the download completed the archive was extracted as per the documentation. There is also a command that we can run to download the latest list of software vulnerabilities.
Once everything is set up we can then cd into /usr/pkgsrc/category/packagename and run commands to build and install software. This will install not only the specific software that we are interested in, but its dependencies also. In addition to which there are commands that we can use to compare the installed software versions with the latest versions available, and to then update the installed software to the latest versions.
We’ve barely scratched the surface of NetBSD and there’s a great deal more that could be written about its fascinating history, along with neat features such as multi-architecture support, and why its design means that it enjoys a loyal user base and a committed development community.
It’s really great that NetBSD can be used to bring vintage computer hardware to life and, not only that, but via a modern O/S that can run familiar software (CPU and RAM permitting!)