kaashif's blog

Programming, software freedom and Unix


NetBSD “Review”

Earlier today, I was discussing operating systems and came onto the subject of ease of installation. Which OS had the easiest installer? The obvious answers would tend towards OSs with GUI installers, but is that really easy? Sure, it could be familiar, but there’s a lot more you have to do with GUI installers compared to, say, OpenBSD’s

installer, where you can just mash enter (other than typing the root password) and get a usable system. But then, my attention was drawn to the text-based faux-GUI installers of FreeBSD and NetBSD. Were they any good? I had no idea.

Essentially, what started out as idle thinking over whether NetBSD was any good (I already tried out FreeBSD and indeed used it a lot for servers a while back) turned into this “review” of NetBSD. I’m careful with that word, because that implies my opinion is to be trusted when in fact, I don’t know all that much about OS design.

The machine

I’ll be installing NetBSD on (not a ThinkPad this time) an old Dell Studio 15 laptop with a Core 2 Duo, ATI Radeon graphics and a reasonably OK 1200x800 screen. OK, that’s not great, but I’ve used a lot worse - this is at the higher end.

Getting installation media

This bit was pretty easy. I just searched “NetBSD”, clicked on the first link that mentioned mirrors, found one close to me, and downloaded an ISO, which I burnt to a disk. Just for reference, the location of the ISO I downloaded was ftp://ftp2.fr.netbsd.org/pub/NetBSD/NetBSD-6.1.5/amd64/installation/boot.iso, which is a link to the amd64 image from a French mirror.

While some people might think burning to a disk is anachronistic, I like having a little memento of my first NetBSD installation. Maybe I’ll even buy a set of NetBSD CDs if I end up using NetBSD enough.

Installing

Booting from the CD went fine. There were no surprises when it came to picking a language, keyboard layout and choosing what sort of installation (installation without X, full install etc). I did run into a bit of a problem when it came to partitioning the disk, though.

The installer prompts you whether you want to use the whole disk (yes), whether you want to overwrite the partitions that already exist (yes) and whether you want to look at the finished partition table (yes).

It was all well and good up to this point, where I saw that NTFS and ext2 partitions were still present on my disk, and that the NetBSD part of my disk had not used the whole disk: only 300GB out of the 500GB. There wasn’t any obvious “delete partition” button, so I changed the type of the partition to “unused”, which seemed to delete the partitions. The NetBSD part was still a bit undersized, but it really didn’t matter: I was “warned” that I needed at least a few GB of space to install NetBSD at the start.

I suppose I could live with a bit of unused space - I probably wouldn’t use it anyway.

Getting the sets

For the uninitiated, installation sets are the actual stuff that is extracted and installed onto the hard disk: the stuff on the CD is just the installer, a way of getting the network set up to download the sets and install them.

There was a bit of a problem, however: iwn wifi adapters don’t tend to work out of the box with completely free OSs.

Surprisingly, when I selected DHCP to automagically set up my network, something seemed to be happening: I got an IP from somewhere, a gateway, a default DNS server… this must have been from someone’s passwordless network down the road. I tried to change the settings to those of my network, but I couldn’t find where to enter the SSID or WPA key. I could have looked harder, but I had a Ethernet cable so I just used that.

My troubles didn’t end there, however. The installer pinged the router to make sure it was working. It was. Reassured, I tried to install the sets from FTP using the ftp2.fr.netbsd.org mirror. After a few minutes of waiting on “Connecting to ftp2.fr.netbsd.org”, it told me it couldn’t connect. Maybe they suddenly went down? It’s possible. Next, I tried ftp.netbsd.org, the master site. There’s no way that could be down, but I was told that I couldn’t connect.

The router was fine, the firewall was fine, but no internet on my NetBSD installer, despite it working on my laptop an inch away. Since I could still ping things on the LAN from the installer, I assumed it was some network config mistake and that I’d better just download the sets to my HTTP server and point the installer there, inside the LAN.

That seemed to work fine and I was able to get to the “Congratulations … you have installed NetBSD … reboot”. So I did.

The first boot

While rebooting, I decided to read the massive warnings that appeared, warning me to change some rc.conf variables or not be able to boot to multiuser. Sure enough, I rebooted and it wouldn’t go into multi-user. My bad, I suppose. I remounted the root read-write and edited rc.conf, changing “rc_configured=NO” to “YES”. Why that is needed is beyond me, it seems to serve no purpose. Maybe it does, but that shouldn’t be my problem.

Now I had to add a user (why wasn’t this done already, by the installer?) and configure sudo access. Wait, no, sudo isn’t installed! So Lua is in the kernel, but sudo isn’t in base. Great priorities. Maybe there’s an actual reason for this, but again, I don’t really care.

After doing all of that, I do end up with a mildly usable system with vi, su, csh… Who am I kidding, an OS isn’t even almost usable unless you can get onto the internet, so let’s do that next.

Networking

OpenBSD uses /etc/hostname.if files to manage configs for each interface. Debian uses /etc/networking/interfaces. Everyone seems to use something different, and I was right to suspect NetBSD was not unique in its uniqueness. This was something that couldn’t be fumbled through by trial and error, I had to look it up on the internet, using the (actually quite good) NetBSD guide http://www.netbsd.org/docs/guide/en/chap-net-practice.html .

So it turns out they use /etc/ifconfig.xxx files, which is actually a whole lot more sensible than what OpenBSD calls them. The configuration syntax is 99% the same as what OpenBSD uses, so I can’t fault it there. This is, of course, because it’s essentially a script that runs ifconfig for each line.

After consulting this page and finding out that NetBSD uses wpa_supplicant, I worked out how to set it up from the examples and now I could start the network!

# /etc/rc.d/network restart
Stopping network.
...
add net default: gateway 192.168.0.1: Network is unreachable

Uh… I suppose I have to add an /etc/ifconfig.iwn0 that reads “up”, just to make sure the OS knows I want iwn0 up. No that still doesn’t work. Maybe if I reboot, it’ll “just work”.

The second boot

After the second boot, everything works as I’d expect. Now networking works, I have a user (kaashif, obviously). All I need to do is to get package management working and I’ll be able to get everything exactly the same as I have it on my current box. After consulting the FTP mirror to find the right package path (/pub/pkgsrc/something/version/ or something similar), I looked here only to discover that it works almost the same as it does on OpenBSD, the environment variable even has the same name: PKG_PATH. So I set that and…

# pkg_add sudo

Wow, everything seems to work! Let’s try X:

$ startx

That works and starts up twm. From here on out, everything would be that same as on any Unix-like OS.

Conclusions

Quite a bit more hassle than OpenBSD, I think, although it could just be that I’m more used to OpenBSD. There is no doubt, however, that OpenBSD’s installer lets you get a system up and running faster. That’s not too useful in and of itself, since I don’t know how good NetBSD as a day-to-day OS and I don’t plan to use it.

I like OpenBSD’s WPA implementation more, there are fewer programs to worry about and fewer knobs to fiddle with in rc.conf (none, actually). Also, I prefer OpenSMTPD to Postfix. And a recent version of pf to whatever NetBSD comes with now (the configs are ever-so-slightly different).

These are all tiny complaints, though. With more usage, I’m sure I’d come to see that NetBSD is at least usable.