Published on (
 See this if you're having trouble printing code examples

Big Scary Daemons

NetBSD for the FreeBSD User: Customizations


In a previous article, I installed NetBSD on a rather decrepit Alpha Multia. I finished in single-user mode, at the familiar "enter path for shell, or RETURN for /bin/sh:" message.

Typing exit generated a warning about rc.conf not being configured. I tried vi /etc/rc.conf, and got a warning that my terminal can't support vi. I was installing over a serial console from a FreeBSD system, so I typed in:

TERM=cons25; export TERM

and vi fired right up.

The rc.conf file has a two-column format; the first column enables a service, and the second gives any flags to that service. Unlike FreeBSD, rc.conf variables don't appear in quotes. The first setting I changed was rc_conf_configured=YES. NetBSD forces the administrator to configure the system before it finishes booting. This certainly makes sure that an unconfigured machine doesn't go up on the Net.

I picked an IP address off my LAN, set the default gateway, and ran through the rest of my BSD install routine (disable portmapper, set up ntp, gut inetd.conf, and generally put things in what I consider proper shape). A few minutes later I typed exit, and my Multia booted into multi-user mode.

One of the best tools for learning a new Unix breed is locate, if you're lucky enough to have it. The locate database wasn't set up yet, of course, but man locate led me to /usr/libexec/locate.updatedb. I let the hard drive churn for a few minutes and had a working locate database. (If you're not familiar with locate, try it.)

Like FreeBSD, NetBSD's base install is rather spartan. To work on this system for any length of time, I needed to customize it further. The first place to start is added software.

In NetBSD, a "port" is a hardware platform, and a NetBSD "package" is the same as a FreeBSD "port." Similarly, a NetBSD "binary package" is the same as a FreeBSD "package." Everything's available, just under a different name.

I'm perfectly happy with binary packages, especially on a 166-MHz Multia. I was quite surprised, though, to find that has no precompiled Alpha packages for NetBSD 1.4.2. I e-mailed the netbsd-help list asking about that. Only a couple hours later I received a nice message back from a developer. It seems that NetBSD doesn't have a bulk package machine for the Alpha architecture, but they expect to have one in time for NetBSD 1.5. Modern Alpha owners have more computer power than they could ever hope to use, so this isn't that big a deal. So, it was time to roll my own.

The NetBSD "package tree" is stored on the ftp server as pkgsrc.tar.gz. I snagged a copy and unpacked it under /usr. It blew up into a very familiar-looking directory tree, with different software set up in different categories.

Eventually, a couple thousand package extractions later, I could make myself comfortable.

alpha: {108} cd /usr/pkgsrc/shell/tcsh
alpha: {109} make all install clean
"../../mk/", line 78: Could not find
Fatal errors encountered -- cannot continue
alpha: {110}

To my surprise, a locate gave me nothing, even after refreshing the locate database. I could be assured that wasn't on my system.

For my first real NetBSD problem, I applied the same tools that I use for FreeBSD. NetBSD has an extensive mailing list archive. A search for "Could not find" gives me an answer: "double-check that you have the comp.tgz set." I downloaded comp.tgz from the ftp site, copied it to /, and unpacked.

Once again, I tried to install tcsh. This time, a make all install clean zipped right through. I added a user account with a decent shell, logged out, logged back in, and entered the command su -m.

Other packages are installed in the same way, and they handle dependencies perfectly. Emacs installs gmake, just as I expected from FreeBSD.

Anyone who can administer a FreeBSD box should have no trouble with NetBSD packaging system. It's the same solid BSD core, with the added bonus of being cross-platform. It's a different project, with different goals, but if you need BSD on your palmtop or on that old PDP, NetBSD is your friend.

Now, if you'll excuse me, I have an SGI IRIS whose hard drive needs formatting.

Michael W. Lucas

Read more Big Scary Daemons columns.

Discuss this article in the Operating Systems Forum.

Return to the BSD DevCenter.


Copyright © 2009 O'Reilly Media, Inc.