% Notes on FreeBSD 2.2.8/9 in QEMU

For reasons I don't actually understand, I found myself trying to
install FreeBSD 2.2.9 in a VM yesterday.  What follows are my notes on
the proces.

My installation attempts used the CD image for installation, which
worked normally with QEMU's `-cdrom` argument.

It appears that the installer crashes during file extraction with a
page fault if the drive sizes are too large.  A size of 1 GB failed.
A size of 800 MB worked, whether in raw or qcow2 format.  To be able
to install everything from the CD without worrying about space, I used
two 800 MB drive images, with the `-hda` and `-hdb` options, and used
the second drive, after auto-partitioning the first, to hold
partitions for `/usr/ports`{.file} and `/usr/local`{.file}.  This
allowed the installation to proceed successfully.

2.2.8 installs, despite the old forum post suggesting that it would
not.  It does have similar page fault, but in my case, had it after
everything had been installed and extracted, thus only losing the
final configuration steps that could be run later.

# Network Configuration

The device that appears to work is `ne2k_isa`.  `ne2k_pci` does not
appear to be supported.  Note that QEMU's default iobase and interrupt
(0x300, 9) is different from FreeBSD's default (0x280, 10).

In QEMU, with "user" networking, the following values are used:

- `10.0.2.15`: guest
- `10.0.2.2`: gateway and host
- `10.0.2.3`: DNS

Once set up, the network works correctly, though during transfers
there are occasionally errors (that don't affect the transferred data,
at least for TCP).

# X Configuration

XFree86 graphical configurators failed for me, regardless of QEMU
graphics driver.  I wasn't successful with reasonable configuration
using the default QEMU graphics driver: this appeared to result in
support for only unusably low resolutions.  The Cirrus driver worked,
selecting any Cirrus 54xx option in the text configurator with some
caveats:

- `Option "nobitblt"` was necessary for text to work reasonably.

- `Option "swcursor"` was necessary for the cursor to be visible
 (though the invisible cursor in the alternative situation still
 worked, if one could guess where it was.)

- `VideoRAM` as a custom value helped higher resolutions: I used 8192.

- 8 bits per pixel, the default, resulted in a dark green hue to
 everything.  Using `-bpp 24`{.sh} as an argument to the X server
 fixed this, eg, `startx -- -bpp 24`{.sh}.

- I don't remember how to select a specific mode, and so I deleted all
 but a reasonable (`1280x1024`) mode in XF86Config.

# Ports and packages

Packages for 2.2.8 are still available:

<ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-2.2.8-release/>

These are easily installed and work.

Ports work in 2.2.8, though all files need to be found and downloaded
separately.  I'm not sure where an easily-usable copy of the files (to
go into `distfiles`) exists, unfortunately.

Ports do not work by default on 2.2.9. `/usr/ports`{.file}, as
installed by the CD, does not contain the subdirectory `Mk`{.file}.
All port Makefiles rely on included files from `/usr/share/mk`{.file},
which in turn rely on files in `/usr/ports/Mk`{.file}.  I am not sure
where to find a suitable copy of these files.  Using files from the
current, or anywhere near recent, ports collection would presumably
fail.  Looking into this further, it appears that there was a change
in 1999 from having full makefiles supporting ports in the bin part of
the base installation to having skeletons there[^1], and the base
system.  The inclusion of these more modern skeletons in 2.2.9 appears
to be the problem.  On a 2.2.9 installation, installing `bin` from the
2.2.8 CD fixed the problem, but caused the next boot to fail.

[^1]: In git as [`500ada61bf4c0a89b61d5f49b36742ac296aa7df`](https://github.com/freebsd/freebsd-src/commit/500ada61bf4c0a89b61d5f49b36742ac296aa7df#diff-1b15551c03b0839d920bf5ed574504041b6a9bef99fb49451c5893edc0243132).

# Miscellaneous Caveats

- `ftp` and `wget` use active mode by default, while almost everything
 wants passive mode now.

- Emacs 20 does not have `normal-erase-is-backspace-mode`.  Another
 method for [handling
 backspace](https://www.emacswiki.org/emacs/BackspaceKey) must be
 used, though Delete does work as backspace.  Meta does not work by
 default, but ESC works.