Updating FreeBSD 4.11 (1/4) – Blast from the past

Ah, weekend. And it’s a nice day, too: The sun shines on the snowy landscape! A perfect day to go out with the children – or to embark on a vastly different kind of adventure… Yes, you read that title right. This is not about four FreeBSD 11 machines. It’s about one FreeBSD 4.11 machine in 2017!

Legacy systems in general

Why even bother with FreeBSD 4.11 today? Well, most people would probably respect historical interest and in fact I was keen on tinkering with a legendary old 4.x release and see if you can have some fun with it (spoiler: Oh yes, you can!). But this would be a task for times when I have absolutely nothing else to do. So it’s fairly obvious that there’s another reason.

“Old habits die hard” they say and there’s definitely truth to it. Another truth, however, is that in the IT world things often don’t go away easily. There’s still a considerable number of machines out there that run DOS. In production. Doing important stuff. Sometimes just because it works sufficiently well. But often they have special tasks that for some reason or another cannot be migrated as nobody has any idea clue how you’d do this.

You want examples? Sure. The first example is “Game of Thrones” author George R.R. Martin writing his books using WordStar 4.0 on a DOS machine. A lot of companies use DOS, too, but you usually don’t hear about that. And less than a month ago a new version of FreeDOS (v. 1.2) was released.

Or do you remember the French airport that was having trouble due to using Windows 3.11? That was in 2015 and they announced that they were planning to migrate their system officially by 2017 (but expectedly by 2019 or even 2021)!

FreeBSD 4.11

One such case of a formerly very popular operating system that just won’t go away is FreeBSD 4.11. From the version number alone you can see that this is a very special one: Usually FreeBSD has three to four point releases in a release’s life cycle. FreeBSD 4 obviously was different. The main reason for that was that version 5 kind of was to FreeBSD what version 4 was for MS-DOS: Innovative in its day but disappointing especially in terms of stability (and performance) among other things.

I have to take up the cudgels for FreeBSD 5, though. It blazed a trail for important technology that we rely on today like the GEOM framework, porting the system to amd64, and so on. Implementing things like that meant digging deep into the system and doing pretty invasive changes. It totally paid off in the long run but back in the day people tended to avoid the early 5.x releases or the whole release cycle altogether.

There are many reasons why some companies still have FreeBSD 4.11 running: Critical systems that cannot be migrated, installed programs to which the source code was lost, etc. Things like that. Most of these systems are probably used internally only but I’m pretty sure that there’s also quite some 4.11 machines still serving data on the net…

Now what others do (and what their reasons for it might be) are not my primary concern – I can’t do anything about it anyway. However the company that I work for has its share of legacy systems, too. Especially younger admins hate them. Actually they are impressively stable and rarely if ever have problems. In fact they keep running, silently doing their job. But now and then you have to do some changes to them and that’s where the trouble starts: They simply cannot be compared to the modern-day Linux systems that we’re used to administer daily!

Preparations

I kept wondering if that situation could be improved. It wouldn’t be worth the effort to do this during work time but I was curious enough about the legendary 4.11 release to give it a try. There’d surely be enough to learn. And should I succeed in bringing a test system into a more modern state there would also be a benefit for us at work.

We still have all those old CDs at work but I made my decision impulsively on Saturday. Fortunately ISOs of the old Walnut Creek CD-ROMs are available for free download. Thanks, Archive.org! I burned it to a CD and was able to boot from it.

I actually installed the OS on real hardware. First on an old HP compaq nx9010 laptop that I got for free a while ago. Things worked pretty well, but since what I’m trying to do is almost all about compiling software, the compilation times proved to be a bit long. Therefore I decided to redo the previous steps on faster hardware – and since amd64 PCs are capable of running i386 programs, all was well. I just had to disable AHCI in the BIOS since FreeBSD 4.11 doesn’t know what to do with that.

The actual installation was interesting enough (for people like me who enjoy history) and therefore I decided to redo it again in VirtualBox to take screenshots and describe the installation process for the remainder of this post.

Installation

Quite some time has passed since FreeBSD 4.11 was released in 2005. More than a decade is a lot in a man’s life but it’s a hell of a lot when it comes to software and operating system development! I had never before installed any version of FreeBSD older than 7.4 and even thinking about the differences between 7.x and 11, many things changed. But what would 4.11 look like? Would I be able to install it without difficulties (I tried a very old version of OpenBSD once and quickly gave up because I didn’t really like the idea of manual partitioning of the drives…)?

FreeBSD 4.11’s Kernel Configuration Menu

I was surprised to run into something that I had never seen even before the installer started! There’s this Kernel Configuration Menu where you can choose to either boot the standard kernel or to customize it. Of course I was curious and so I decided to take a look at it.

FreeBSD 4.11 kernel drivers selection

This brings up a friendly little tool that allows for easy navigation through the driver tree. The screen is basically split into two parts: Active drivers and inactive drivers. Each one consists of several categories which are collapsed and can be expanded for a list of drivers.

Browsing FreeBSD 4.11’s additional network drivers

The standard kernel worked on both of my machines and so I didn’t play around with this after exploring it briefly. When the kernel had booted, I found myself in the good old Sysinstall utility. Yes, it’s pretty ugly and it looks a bit complicated – which is due to the fact that despite it’s name it does a lot more than just handle the installation. Yet in fact it’s really easy to navigate through.

I like the Express option that lets you perform an installation as quickly as possible by asking you only the absolute minimum of necessary questions. This goes as far as not asking for a root password and leaving it blank on your first login! Fair enough, it’s easy to set one yourself. Current versions of FreeBSD do not have this option. That may be due to the fact that it’s not terribly helpful for setting up a serious system. And the use case that I have for it here is definitely more of an exception!

FreeBSD 4.11’s Sysinstall: Main Menu

The first thing that’s essential is of course disk partitioning. If you don’t require any special setup, you can simply use the whole disk. I was glad to see that this can be done by simply pressing “A”!

Installing FreeBSD 4.11: Disk partitioning

Just like today FreeBSD 4.11 allows you to choose if you want to install a boot manager, just write the boot loader or don’t do anything. The first option can be used for dual-boot systems where you want to load either FreeBSD or another OS. The last option won’t work by itself; if you choose that, you need to work with an external boot manager that supports FreeBSD. In my case just installing the standard loader makes most sense.

Installing FreeBSD 4.11: Choosing boot options

Then there’s creating the disklabels. This is another thing where I’m happy to find an auto defaults option (simply pressing “A” again) because I just wanted a quick test system anyways and didn’t want to think too much about the disklabel layout!

Installing FreeBSD 4.11: Editing disk labels

Finally we have to select what to install. To make things easy, sysinstall offers several distribution sets to choose from. Minimal is all that I need for my experiments, but back in the day a lot of the other options were definitely quite handy. Two things stand out: You can choose to install FreeBSD + X11 for example. Current versions of FreeBSD don’t let you do that. You’ll always get a console only system and have to install X11 yourself (which IMO is something that leaves the barrier unnecessarily high for new users who don’t know FreeBSD nor its packaging system, yet!).

Sysinstall also allows for custom distribution selection. This gives you access menu that allows for really fine-grained choices. Again, FreeBSD’s installer cannot do that today. While it’s probably nice to have that option, it’s not a must-have. People who have use cases for that will probably know what they do and install FreeBSD manually, anyway. Still I like having it in the installer!

Installing FreeBSD 4.11: Choosing distribution sets

The only thing left is selecting what medium to install from – the CD in my case. Formatting a large drive takes quite a moment because we’re talking UFS1 here! Don’t start looking for a way to use UFS2, it’s not available in FreeBSD 4. The actual “minimal” installation is quite quick and just a moment later I can reboot and the system comes up just like you’d expect it to. Now that was the easy part of my adventure. Next stop: Brushing the dust away and updating that beast(ie)!

Advertisements

Installing FreeBSD – a tutorial from the Linux user’s perspective

This article deals with installing FreeBSD. It’s meant for the first time FreeBSD user who has a bit of Linux background.

The installation process is actually quite simple and straight-forward. I’ll guide you through in some
detail, anyways, because I think that there are a few things that are good to know even if they are not strictly necessary.

On a side note: My blog turned three a few days ago. I decided not to write a birthday post this year. Let’s just get on with some real content!

Preparations

The easiest way to try out a new operating system these days is to run it in a virtual machine. I’m using VirtualBox to create the screenshots and you are invited to create one, too, and follow along. Just reading the post is also fine, though. And of course nobody will stop you if you decide to dedicate a real machine to this project because you have some spare hardware around.

If you opted for VirtualBox, you just need to create a new VM first. Select FreeBSD as the OS and give it a bit more RAM and far more disk space (since we’re actually going to put our new system to some use) than VirtualBox suggests. Other than that, you’re set up. You should not need to make any other changes (though you can of course adjust things if you feel like it).

Now download an ISO image if the installer CD from here.

We’ll be using FreeBSD 10.1-RELEASE. Pick the right one for your CPU architecture – if you’ve got a PC then i386 means “32-bit” and amd64 means “64-bit”. It doesn’t matter if you’ve got an Intel or an AMD. Make sure you choose an installer image and not a virtual machine image since we want to install FreeBSD after all!

The smallest image is fine; that’s FreeBSD-10.1-RELEASE-amd64-bootonly.iso for a 64-bit system (or the .xz one which you need to decompress after the download). If you were going to install FreeBSD on several machines or on one that is not connected to the net, it would make sense to choose a bigger one which actually includes the OS you want to install. But for our purpose the bootonly (which will download the OS files) suffices.

Got everything? Excellent. Start up your VM and put the installer image into the virtual drive. Then you’re set to go.

Installing FreeBSD: Keyboard and file sets

You should be greeted by the bootloader. Either wait ten seconds or just press the Enter key (we don’t want to set any special options at this early stage).

The FreeBSD bootloader screen

Now the kernel will probe your hardware and the system will come up. Once everything is done, the installer will be started automatically. It’s not the most beautiful installation program ever, but it does the job. And it actually makes the installation really easy. Until FreeBSD 8 there was the old installer, BTW. It was more powerful but the installation was also more complex (and it was even more ugly! ;)).

Meet the FreeBSD installer!

After choosing “install” you can select a keymap or go with the default one (US). It’s all up to you here.

Keymap selection in the installer

Then we have to give the virtual computer a name. I decided to call the machine beastie which is the name of FreeBSD’s mascot (the little red daemon with the fork).

Setting the hostname of the machine

Next select which optional sets to install. You won’t need doc. This may have been very useful in the past but today you’ll probably want to simply browse the documentation online instead of locally, anyways. If you really want it, it won’t hurt you, though, but you could just as well save yourself (and the FreeBSD project) some bandwidth.

Games is not what you probably think, BTW. It’s pretty obvious that this won’t install DooM or Quake or the like. But it’s not even something like Solitaire or Freecell that comes with Windows. It’s in fact just a bunch of command-line based games, the most popular being “fortune” mentioned by the installer. It is a “fortune cookie simulator”. Most people probably won’t call any of the programs from this set an actual game. They are more or less just little fun or joke programs. Actually they have a long tradition with Unix and they are very small, too. For that reason they are included in a FreeBSD install by default. You may deselect this set if you really want but they definitely won’t hurt you, either.

Choosing the sets to install

The lib32 set contains the 32-bit libraries which are needed if you want to run 32-bit executables on a 64-bit FreeBSD system. There are actually more cases where you need them than you might think. So if you aren’t really, really short on disk space or know exactly that you won’t ever need them (hint: When you are just starting with FreeBSD, you don’t) just leave this one checked.

For our tutorial please make sure you uncheck the ports and src sets which contain the ports tree and the system source code respectively. We will need both later – but we’ll fetch the current version of both them using different a different means!

Installing FreeBSD: Network

Now you need to configure your network so that the sets can be downloaded. This is a pretty straight-forward thing to do: Select your NIC (chances are you only have one, anyways), select IPv4 and choose DHCP if you wish to automatically receive an IP address (otherwise configure the NIC manually). You probably don’t need IPv6 so skip that unless you’re really actually using it in your LAN. If you selected DHCP, FreeBSD should have received the address of at least one DNS server as well. If it didn’t, make sure to provide one. Otherwise name resolution won’t work and the installer cannot download the file sets.

Selecting the mirror

The next step is to select a mirror server from which to download. It obviously makes sense to choose one that is located in a place near to you as it is more likely to provide a good connection for you.

Installing FreeBSD: Disk layout

All that’s left is setting up the hard disk(s). The basic choice you have to make is which file system you want to use. FreeBSD basically supports two native file systems: The traditional UFS (“Unix File System” aka. FFS or “Fast File System”) and the next-gen filesystem ZFS. The later is a sophisticated FS with a lot of interesting features. For quite some people, fact that ZFS is considered stable on FreeBSD is a killer feature of this operating system and even the main reason why they choose this OS.

ZFS is however well beyond the scope of this post. A dozen of posts like this could be written on that topic (probably not by me, though, since my ZFS knowledge is rather basic, at least at the time being).

So we’ll opt for UFS now. Partitioning a FreeBSD system is a little bit more complex than partitioning Linux. Fortunately there’s the Auto (UFS) option in the installer. We select that and want to use the entire disk.

Disk partitioning

Today there are two partitioning schemes in use on the PC. FreeBSD defaults to the newer one, GPT. You could also use the older MBR instead if you have any reason to do so. And in fact you could even go without any of them! But that’s going deeper than we need right now.

The installer suggests a default partitioning: A boot partition, one for the root file system and one more for the swap space. Depending on what you want to do with your FreeBSD machine, this is most likely not what you want. But for our test system it’s fair enough.

The default partitioning layout

After hitting “Finish” and “Commit” the changes are written to disk and the actual installation begins.

Excursion: Partitions and *BSD

Partitions are a topic which can be highly confusing for the beginner (at least it has been for me before I did some research in this area). The problem here is that in the FreeBSD world a partition is something different what you might think. And to make matters worse, the terminology differs even between the BSD distributions!

Most Linux distros use the old MBR (“Master Boot Record”) partitioning aka “DOS partitioning”. Same thing if you come from a Windows background. You know the score: Up to four primary partitions and extended partitions if you need more than that. Chances are that your Linux distribution uses three primary partitions: One for /boot, one for SWAP and one for /. If they are on the first hard drive (sda) of your pc then they will be called /dev/sda1, /dev/sda2 and /dev/sda3.

These partitions are known as disk slices in the FreeBSD terminology. So it’s just a different name for the same thing, right? That cannot be so bad! Wrong. The MBR partitions are the same thing as the slices, yes. But the fun starts when you learn that the BSD systems use a mechanism called BSD disklabels. These divide the MBR partitions further and if you think in the DOS terminology of partitions, disklabels actually allow for what might be called sub-partitions as that is what they are. Unfortunately these are just called partitions in the FreeBSD context!

So remember this: In FreeBSD a “partition” is what you may think of as a sub-partition and a “disk slice” is what you commonly know as a partition. How come that we have all this confusion? Who’s guilty of causing it? Well, things are not so easy here…

Unix began its life not on the PC but on bigger research computers which did not support partitions at all. So the Unix people came up with disklabels to partition disks into up to 8 partitions. Since that is what they are, it was an obvious choice to call them partitions. Quite some time later the PC platform supported MBR partitions which were also called thus. The real trouble started however when Unix was ported to the PC: Now there were two different things with the same name! For compatibility’s sake, FreeBSD embeds its partitions (sub-partitions, remember) into what they call disk slices (MBR partitions) to be able to distinguish between the two.

As a consequence, FreeBSD needs only one disk slice (MBR partition) because it can create partitions (sub-partitions) on it, e.g. for SWAP.

If you are using the MBR scheme, it leads to a naming like e.g. /dev/da0s1b. This means the first SCSI disk, slice 1 (primary MBR partition 1), partition 2. /dev/ada1s5f means the second SATA disk, slice 5 (extended MBR partition 1), partition 6.

FreeBSD can also do without slices. This is called “dangerously dedicated” mode. The name sounds quite worrying but in fact the only “danger” is that it is highly unlikely non-BSD systems will be able to read any data from it (since they don’t know about disklabels). If you ever come across something like /dev/da1d, you know that it’s the 4th partition (sub-partition) on the “dangerously dedicated” (MBR partition-less) disk da1. If you just have *BSD on your drive, you can use this mode and there’s no “danger” for your data.

Fortunately things became easier with the introduction of GPT (“GUID Partition Table”), a newer partitioning scheme that supports more than the 4 primary partitions of MBR. And since more than enough partitions can be created this way, FreeBSD does not use disklabels to subpartition them further. The good thing is that many other operating systems know GPT partitions, too. The bad thing is that we have another kind of partition that’s just called… Partition.

Newer FreeBSD installations default to GPT partitioning. If you look for your drives then, you’ll probably find them as something like /dev/ada0p1 which means the first GPT partition on the first disk.

If you have to use the older MBR partitioning for some reason, there are a few things you should know about disklabels. Disklabel a is meant to hold the root filesystem (/), b is for SWAP. C is completely special; you cannot use it as a normal partition. It’s always there and covers the whole disk. This is used by some tools to access the disk in raw mode, neglecting any partitions or whatever. Historically d stood for the whole disk and c for the complete slice – but that time has passed.

That’s a lot of information, I know. But you’ll get the hang of it if you want to. It’s not that difficult once you got rid of the confusion.

Installing FreeBSD: Putting the system on the disk

Now lean back for a while; the installer will fetch the distribution packages from the net first.

Fetching the distribution packages

As said before, this step is skipped if you use a bigger image. In that case you’ll also configure the network settings later in the installation process.

Installing FreeBSD: Final steps

When all distribution packages are downloaded and extracted, you are prompted for a password for the root user.

Setting a password for the root user

Then you have to tell FreeBSD about your time settings. If it is the only OS on your machine or it shares it with other Unix-like systems like Linux, go for UTC. If you also have Windows on the same computer, however, be sure to select No here. Windows and UTC is a mess.

Choosing the time setting

In the next screen you can choose which daemons should be started during the system boot process. Unselect dumpdev, it’s of no use to us (if you were able to read crash dumps and debug the applications with this info, you wouldn’t really read this post now, would you?). Keep sshd selected if you want it.

Selecting the daemons for autostart

Choose not to add any users right now. We’ll be doing this later and learn a bit about user management on FreeBSD! Next hit “Exit”, tell the installer that you don’t want to make any final changes.

Exit the installer

Choose to reboot. And that’s it.

Reboot to finish the installation

If you remove the installer image, your machine should boot into your new FreeBSD system. Welcome on board, new BSD user!

What’s next?

The next blog post will deal with some of the very basics of a fresh FreeBSD system.