The cause for this has something to do with the unmount process at shutdown. It seems that ext2 filesystems aren't properly unmounted. I popped some relevant criteria into Yahoo! search and sure enough there are people out there facing this issue.
There are various work arounds, mostly written for the posix shell. I have done one in bash (just because I was a linux user yesterday :)) This script is then referenced from /etc/rc.shutdown. This is how it looks:
#!/usr/local/bin/bash printf "nunmounting linux filsystemsn" for i in `mount | grep ext2 | cut -f1 -d' '` do umount -f $i done
So I implemented this and just tried running it from the shell. Sure enough the linux partitions were unmounted:
brezhnev# df Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad0s1a 2434920 81536 2158592 4% / devfs 1 1 0 100% /dev /dev/ad0s1e 33410636 42 30737744 0% /home /dev/ad0s1d 2417038 2036174 187502 92% /usr
However, when I rebooted the machine it still hung at the fsck_ext2fs stage. Crazy! My first instinct was to try fsck'ing manually to see if that runs okay:
brezhnev# /sbin/fsck_ext2fs /dev/ad3s1 /sbin/fsck_ext2fs: Command not found.
hmm - there's a clue. Lets try which, whereis and apropos:
brezhnev# which fsck_ext2fs fsck_ext2fs: Command not found. brezhnev# whereis fsck_ext2fs fsck_ext2fs: brezhnev# apropos fsck_ext2fs fsck_ext2fs: nothing appropriate
So it looks like I need to install something. We're getting warmer. Searching on http://www.freshports.org/ for e2fsprogs reveals the following:
e2fsprogs 1.38_2 / sysutils search for ports that depend on this port Utilities and library to manipulate ext2/ext3 filesystems Maintained by: email@example.com search for ports maintained by this maintainer CVSWeb : Sources : Main Web Site : PortsMon To install the port: cd /usr/ports/sysutils/e2fsprogs/ && make install clean To add the package: pkg_add -r e2fsprogs
So there it is with a simple one-liner for installing the port. This means that if the sources aren't there, they will be downloaded from a registered mirror and then the package will be compiled on the local system. This will provide a number of utilities for managing ext2 and ext3 filesystems.
Once the port was installed, I tried to run a fsck locally just to try the new package out:
brezhnev# /usr/local/sbin/fsck_ext2fs -y /dev/ad3s1 execve: No such file or directory
I don't know what's causing that so I'm going to try with the e2fsck utility instead. It looks like the file installed was: /usr/local/sbin/e2fsck. Let's try that out:
brezhnev# /usr/local/sbin/e2fsck -y /dev/ad3s1 e2fsck 1.38 (30-Jun-2005) /dev/ad3s1: clean, 10/7520256 files, 235992/15012892 blocks
Well that's good, but it's kinda odd, because when the system boots, it attempts to fsck with fsck_ext2fs from /sbin or /usr/sbin - Neither exists, which is the source of the problem. So all we need to do here is create a symbolic link from /usr/local/sbin/e2fsck to /sbin/fsck_ext2fs.
Once the symbolic link was in place, I rebooted.... but still the same problem occurred. I tried moving the link into /usr/sbin, rebooted again ... and again, the problem perisited. Every reboot just hangs because the system seems unable to find the right fsck utility for ext2fs:
fsck: exec fsck_ext2fs for /dev/ad1s1 in /sbin:/usr/sbin: No file or directory.
My last attempt at fixing this issue is to tell the system not to fsck at all. Alex Zbyslaw on the freeBSD mailing list suggests just disabling the pass by setting the 'pass' parameter to 0 for the linux filesystems listed in the fstab. I tried that and...
Bingo. The system booted straight through to a prompt, with all the disks mounted as required. I remain somewhat bemused and irritated that the problem wasn't actually solved, but at least a work around is in place for now.