Using NetBSD 1.5 with Virtual PC 4
compiled by Paul Hoffman
Last updated April 26, 2001
This page describes how to use
NetBSD version 1.5 with
version 4 from Connectix.
NetBSD is a free, mature, and very stable Unix operating system that is
a widely-used alternative to Linux.
Virtual PC is a wonderful commercial Macintosh product that allows you
to run PC programs unchanged by emulating a full PC on your Mac.
Virtual PC comes with Linux support, but not NetBSD support. This
site fixes that. (If you are interested in other BSDs, there is
a different site that explains how to
install OpenBSD on
The information on this site assumes you already own Virtual PC version 4,
and have a copy of a NetBSD 1.5 CD-ROM. This site does not explain much
about how to run either product, only how to get them working together well.
This site also doesn't describe how to get earlier versions of either
product to work with each other. A different site
created by David Hornsby describes how to use NetBSD 1.3.2 with earlier
versions of Virtual PC.
Basically, NetBSD 1.5 out of the box works OK with Virtual PC 4.
However, there are a few major problems, such as the fact that the
Ethernet interface and the floppy drive doesn't work. Thanks to the
hard work of Peter
Seebach, you can fix this easily by copying a new kernel to your
system after installing NetBSD 1.5. Thank you, Peter! Also,
the folks at Connectix did a fair amount of work between version 3
and version 4 to make NetBSD work even though NetBSD is not officially
supported by them. Further help was provided by Peter A. Eisch, who
upgraded the XF86Config file to higher resolution.
Getting the Software
Virtual PC 4 can be bought at
any fine purveyor of Macintosh products
(my favorite continues to be
MacConnection); the current street price
is around $75 for the no-Microsoft-OS versions. Virtual PC version 4 seems to
run significantly faster than version 3, so users of earlier versions
of Virtual PC should probably upgrade. Virtual PC comes in many different
flavors (for Win98, for Windows 2000, for Linux, etc.), and all of them
work with NetBSD.
NetBSD is free. There are many ways to install NetBSD on a PC, the two
fastest and most reliable being:
- from a CD-ROM
- over an Ethernet-based network after booting from floppy
Unfortunately, the Ethernet drivers on the
installation floppies and CD-ROM for NetBSD 1.5 do not work with Virtual PC
version 4. Thus, the only reasonable way to install a working NetBSD 1.5
is to install from CD-ROM, and then copy a new, better kernel onto
your system. NetBSD 1.5 CD-ROMs can be bought many places; see
the NetBSD CD-ROM
list for information, or simply borrow a NetBSD 1.5 CD-ROM from a friend
(that's both legal and friendly!).
Steps for Installation
The following steps assume that you have already installed
Virtual PC 4 and understand how to run it (which is surprisingly
easy, given how well it works). If you are unfamiliar with NetBSD,
there is a ton of good information about it on the
NetBSD web site. If you
have never used a Unix system before, the steps below may be daunting
or impossible to follow.
Download the file VPC-NetBSD15.sit,
which is a Virtual PC disk image that contains a better NetBSD kernel
and other helpful files. The download is
about 1 megabyte, and it expands to about 2.5 megabytes.
Unstuff the file, and move the expanded file to the directory where
you usually store your Virtual PC drive images.
Start Virtual PC.
Give the Window->Virtual Disk Assistant command. That command
has a series of steps.
- You want to create a new drive.
- You want to create a hard drive image.
- Select a location and name for the image, probably where you
keep your other Virtual PC drives.
- Select Linux for the operating system (even though you aren't going to
- Select "Advanced Options", choose Fixed Space Drive Image, and
select a capacity. 1 gigabyte can work for a basic installation and
a reasonable amount of data, and 2 gigabytes is quite roomy even for
a full installation with X Windows. Don't bother to zero the drive; it just
wastes time. Note that you don't have to create a fixed space drive
image; others have used a variable-size image with no problems. Making it
a fixed-size image seems prudent because Connectix is much more focused
on making the varible-sized images work with Windows-based operating
Create a new virtual PC. This also leads to a series of steps:
- Name this virtual PC.
- Choose "guide me".
- Give NetBSD as much memory as you feel comfortable with. 64 megabytes
is probably plenty.
- You want to select a current drive for the boot system.
- Specify the drive you just created in the previous step.
- You want to add a secondary drive.
- Specify the drive that you downloaded from this site in the
- NetBSD 1.5 has not been tested with the modem in Virtual PC,
so you probably want to not select it.
- You probably don't want to try to sync your Palm with NetBSD.
- Select "Done".
Insert your NetBSD 1.5 CD-ROM in your CD-ROM drive and make sure
you can see it on your Mac desktop.
In Virtual PC, select your new virtual PC and start it up.
Because the hard drive image doesn't have an operating system on it,
Virtual PC should attempt to boot off the CD-ROM. If it does not,
be sure that Virtual PC thinks that there is a CD-ROM in the drive.
The NetBSD 1.5 CD-ROM boots into NetBSD. Lots of messages about hardware
(or, in the case of Virtual PC, pseudo-hardware!) zoom by.
After a few fits and stops,
the NetBSD installer starts, and you see:
* NetBSD-1.5 Install System *
* a: Install NetBSD to hard disk *
* b: Upgrade NetBSD on a hard disk *
* c: Re-install sets or install additional sets *
* d: Reboot the computer *
* e: Utility menu *
* x: Exit Install System *
In the installer, you can use the arrow keys on the keyboard or
You are asked if you want to continue; you do.
You see something like:
I have found the following disks: wd0 wd1
On which disk do you want to install NetBSD? [wd0]:
wd0: no disk label
You might not see the "wd0: no disk label" notice; that's OK. If the first
line does not list both wd0 (the new drive you created) and wd1 (the
small drive you downloaded), stop immediately. Otherwise, enter "wd0"
and press Return.
You are shown some unintelligible numbers that describe your hard
drive. Select "a: This is the correct geometry".
You can share NetBSD with another OS on the drive image, but do so
at your own risk. Instead, choose "b: Use the entire disk".
You are asked:
Your disk currently has a non-NetBSD partition. Do you really want to
overwrite that partition with NetBSD?
Answer yes, you really want to do that.
Here you get to make a decision about how must space you want to fill
on your hard drive with NetBSD. Plain NetBSD takes up about 350
megabytes; NetBSD with some X stuff (although not including popular X
desktops such as KDE and GNOME) takes up about 450 megabytes. Virtual PC 4
runs X Windows fairly well (see below), and if you think you might want
to install X in the future and have enough room, go ahead and install
You are presented with a partition table that will make almost no sense
unless you have set up a Unix system before. The installer program usually
makes very good guesses, so simply choose "b: Partitions are ok ".
You can pick a name for your disk, but the name is inconsequential; feel
free to use the default of "mydisk".
You are warned that continuing will wipe out the contents of your
hard drive; yes, you want to continue.
You see a screen that has something like the following at the top:
Command: /sbin/newfs /dev/rwd0e
/dev/rwd0e: 3362688 sectors in 3336 cylinders of 16 tracks, 63 sectors
1641.9MB in 209 cyl groups (16 c/g, 7.88MB/g, 1984 i/g)
super-block backups (for fsck -b #) at:
Lots of numbers get displayed, Depending on the size of your drive and the
speed of your system, this may take a while.
When the disk preparation is done, the installer says
"The next step is to fetch and unpack the distribution filesets. Press
return to proceed.". Press Return, of course.
You can choose a full or custom installation.
If you choose "custom", you'll get to pick with sets of binaries
to install. However, unless you are really tight on space, simply choose
the full installation. The NetBSD folks don't install much fluff
in the basic installation.
There is no need to watch all the names during installation; they go by
very fast anyways.
You will be installing from CD-ROM.
The default choices for CD-ROM installation are:
device: cd0 directory: /i386/binary/sets
You can continue with these settings.
Your CD-ROM and hard drive will access a lot as all of the files for
the installation are loaded on your hard drive. Across the top of your
screen, you will see:
Command: pax -zrpe -f /mnt2//i386/binary/sets/base.tgz
(with different names for the last bit of the second line). Feel free
to walk away for a bit.
The installer tells you that it was successful; press Return.
The installer makes device files, which takes a while. When it is
done, press Return.
Pick your time zone. Note that NetBSD assumes that the system clock
(that is, the Mac's clock) is set for GMT, which it is not. You can
deal with this either by chooing GMT from the time zone list (which
means that programs that look at the time zone will think you are
in the GMT time zone) or you can set the correct time zone and
then keep adjusting the NetBSD clock. Neither is a good option, but
you have to pick one. Press x then Return after you have chosen your
You want to pick a root password now.
You should now be back at the original installation menu. You don't
want to reboot your computer quite yet; first, want to remove the
CD-ROM. In Virtual PC, choose the Control->Eject CD command, and take the
CD from the drive. Now you can select "d: Reboot your computer".
The rebooting process looks like the initial booting process,
except that much of the text is in green. When the computer is booted,
NetBSD/i386 (Amnesiac) (ttyE0)
Enter "root" (without the quotes, of course). When prompted, enter the
You now have a C-shell prompt. Enter the command "mount /dev/wd1e /mnt"
to mount the small drive image you downloaded.
You can verify the contents of the drive with "ls -l /mnt". You will see
that there are three files:
-rw-r--r-- 1 root wheel 5138 Jan 23 10:03 XF86Config
-rw-r--r-- 1 root wheel 4591 Jan 6 12:45 low-res.XF86Config
-rwxr-xr-x 1 root wheel 2329634 Jan 6 10:21 netbsd
-rw-r--r-- 1 root wheel 42616 Jan 6 10:22 vpc-patch-03
Make a backup copy of your current kernel with the command
"cp /netbsd /netbsd.original"
Copy the new kernel to your main system with "cp /mnt/netbsd /netbsd".
If you're planning on using X Windows, give the command "cp /mnt/XF86Config
/etc" to copy the X configuration file to your main drive.
If you think you might want to rebuild the kernel yourself at some point
in the future, give the "cp /mnt/vpc-patch-03 ." command to copy the
patch file to your home directory.
Reboot with the "reboot" command. This will start with the new
By default, Virtual PC assumes that you
have a DHCP server to give you an IP address. However, some folks want
or need to have a fixed IP address.
Using DHCP addresses
To get NetBSD to get an address from your local DHCP server, edit
the /etc/rc.conf file. Add the line
to the end of that file, then reboot.
Using a fixed IP address
To get NetBSD to use an assigned address (which must be different than
the IP address used by your Mac!), you have to tell NetBSD the address
and the interface to use. The patched kernel uses the tlp0 driver for
the Ethernet. In the /etc/rc.conf file, add the following lines:
Create the file /etc/ifconfig.tlp0 that has one line:
inet 188.8.131.52 netmask 255.255.255.0
where "184.108.40.206" is your IP address. Create the file /etc/mygate
that has a single line that contains the IP address of your Internet
gateway. Create the file /etc/myname that has the host name of this
machine in it. Reboot, and you should be on the net.
Virtual PC emulates an S3 screen driver. To run X Windows,
copy the XF86Config file from the drive image you downloaded into
/etc. If you run startx now, you will get a tiny screen with really,
really big pixels. Instead,
install the XF86Setup package and run that setup program.
There, you can specify the screen driver (S3) and the resolution you
desire. Virtual PC works just fine in 1024x768 full-screen mode on a
(If you are not familiar with the NetBSD package system, you should
the pkgsrc manual for more information.)
resolutions over 1024x768 are
currently not working correctly due to a quirk of the clock chip emulation;
they work in Windows, but you have to use the BIOS to change modes, and XF86
just tries to make the chip do the work directly. There is no problem
using 1024x768 with 256 colors, but it does not work with more
colors than that.
Also note that the XF86Config file is specifically designed for 1024x768
adapters. If you have an 800x600 adapter (such as for the iBook),
you need to modify the XF86Config file.
Near the bottom of the file, there is a section that has a bunch of
Edit them to say "800x600" instead.
Patching the Kernel
If you don't already know how to build a kernel, you probably don't want
to spend your time on something that is more arcane than
rebuilding a car's engine. If you already know how to patch a
kernel, patching the NetBSD kernel is easy, and you want to apply the
patches for Virtual PC before you create a new kernel.
To get the kernel source tree, mount the CD-ROM on /mnt
mount -t cd9660 /dev/cd0a /mnt").
Unpack the kernel source with
cd /; tar -xzf /mnt/source/sets/syssrc.tgz";
this will take quite some time.
When the source is unpacked, you can apply the patch you copied into your home
directory above with
cd /usr/src/sys; patch <~/vpc-patch-03".
This patches a wide variety of files and creates a VPC configuration.
The following steps are all you need to build a new kernel.
- (muck with the VPC configuration if you dare)
cp /netbsd /netbsd.works.ok
cp netbsd /
Known Problems Remaining
The following is a list of the problems that are know to exist
with the setup described above.
If you encounter other problems, or want to help solve the ones above,
please contact Paul Hoffman.
- The countdown timer at the beginning of the boot process races to
zero seconds instantly. This makes it almost impossible to interrupt the boot
process and boot from an alternate kernel.
It is, in fact, possible to interrupt the boot process: you just
have to be tapping the space bar. You can generally do it within two or three
- Mounting a floppy in Virtual PC and then reading from it in
NetBSD cause a raft of error messages to appear on the NetBSD
console. These messages appear harmless, however, and it appears
that the floppy is read correctly.