FreeBSD 6.2 Notes

25 July 2007
Various gotchas I encountered in a recent (mid-2007) retry of FreeBSD 6.2. This is written from the perspective of having used Linux for 7 years, so its not for the faint hearted..

BSD Disklabels (partitions)

Linux started life on PCs so it uses the PC partitioning scheme natively. FreeBSD started life elsewhere so it has a differing partition scheme. As a result, FreeBSD uses its own partitioning scheme (BSD Disklabel) embedded within a PC-style partition. FreeBSD calls the containing PC partitions slices, and within each slice calls the subdivisions there the partitions. Conceptually it is a simpler version of the LVM system used in more recent Linux distributions, though I personally prefer not to use LVM in single-drive systems. See TLDP's Linux+FreeBSD Howto for more details.

Partition listing & mounting

I find it easiest to install /usr/ports/sysutils/linuxfdisk as I find Linux's fdisk gives nicer partition summaries than FreeBSD's. The mount/umount commands are much the same (at least for physical drives).

Getting the pound sterling symbol (£) to work

In /etc/rc.conf make sure you have one of the following:

keymap="uk.iso" keymap="uk.cp850"

I can't tell the difference between them. I use uk.iso, but try the other one of that fails. The next stage is to sort out the problem of pressing SHIFT-3 within bash either causing a beep, or displaying a hash (#) followed by a newline. This is a problem with the default locale (US-ASCII) not understanding UK currency. Firstly check that you have the right files installed:

$ locale -a | grep en_GB en_GB.ISO8859-1 en_GB.ISO8859-1 en_GB.US_ASCII en_GB.UTF-8

If you don't get the en_GB entries shown above, you'll need to do a bit of web-searching on getting them installed. I decided to use ISO8859-1 as it happened to be first on the list, and added it to my /etc/profile:

export LC_ALL=en_GB.ISO8859-1

For some reason (probably security) this does not get picked up when logging in as root, but for ordinary users it seems fine (putting it in ~root/.bashrc ought to solve it). For some reason if I'm logged in via the keyboard £ is displayed as ú, but via SSH and VNC it seems alright (not a big issue as most of my Unix systems are headless servers). I suspect this is a tty font problem, which may be solvable by messing with /etc/ttys..

Packages

..don't bother. Use ports instead (particularly for X11 programs, as the X11 stuff on the CD seems incredably brittle). Although a lot quicker to download/install (and there's the chance I did something wrong), I've found that packages usually screw up sooner or later.

Portupgrade

Use the one in /usr/ports/ports-mgmt rather than /usr/ports/sysutils - the sysutils one is outdated and for some reason has not been removed from the ports tree.

FreeBSD Update

At least in FreeBSD 6.2 this is part of the core distribution and is no longer a port. Thankfully. Having to rebuild the kernel and all core OS programs every time a small fix comes out is a bloody pain. Linux has its own set of problems, but its much better tolerance of pick-n-mixing components is something I've preferred.

Ports database screwed

See 20070102 entry in /usr/ports/UPGRADING. Basically:

rm /usr/ports/INDEX*.db portsdb -u

Disabling portaudit

Portaudit is wonderful. It flags up software you've got installed that has known vulnerabilities, and stops you ending up with a potentially insecure setup. However, it's not so wonderful when the known vulnerability happens to be a distant dependency that has gone unfixed for ages (I'm thinking of xpdf while installing Gnome). Get around this by adding DISABLE_VULNERABILITIES=true to the make command line:

make DISABLE_VULNERABILITIES=true build

Cleaning up ports

Building ports takes up a LOT of space (building Gnome and its dependencies chewed up something way north of 5GB). It is advisable to periodically (or after installing/upgrading a batch of stuff) clear out all the working (i.e. temporary) files under /usr/ports..

portsclean -C

If you're gonna be installing anything X11-related via ports, you may want you /usr partition to be somewhere north of 15GB (or be prepared for periodic CTRL-C'ing and running of the above command..).

X-Windows

Getting X-Windows up and running on FreeBSD is an all-round nightmare. It seems to be the one thing that breaks with incredible ease. I eventually got it working. All I'll say is. Annoyingly VNC depends on the (now abandoned) XFree86 code-base, so installing VNC involves downloading the XFree86 sources.

Linux style ls

One nice feature of Linux is that it is more tolerant in mixing up command-line parameters. Under Linux both of the following will show a detailed listing, whereas under FreeBSD the 2 one will complain about -l being a missing file.

ls -l ~ ls ~ -l

Thankfully, Linux's (well, GNU's actually) ls has been ported to FreeBSD..

cd /usr/ports/misc/gnuls/ make install

..then add to .bashrc:

alias ls=gnuls

Undefined pthread functions

I got this when trying to compile the Cherokee webserver:

./.libs/libcherokee-server.so: undefined reference to `pthread_create' ./.libs/libcherokee-server.so: undefined reference to `pthread_attr_init' ./.libs/libcherokee-server.so: undefined reference to `pthread_exit' ./.libs/libcherokee-server.so: undefined reference to `pthread_attr_setdetachstate' ./.libs/libcherokee-server.so: undefined reference to `pthread_join'

Not quite sure why this wasn't picked up by the configure script (i suspect the version in tried was a development snapshot). Seems to be a missing -lpthread parameter (if POSIX threads were missing outright, there ought to have been errors about missing header files), which thankfully can be put on the command-line (easier than Makefile hacking):

make LIBS=-lpthread