FreeBSD 12.x with ZFS: Read-write access in single-user mode

James Deagle
3 min readMay 12, 2020

It has been about two years since I last locked myself out of my UNIX system, so I figured it was high time to amuse the masses with another round of slapstick.

Before I go any further, I should say that both of these screw-ups occurred in the course of either installing or optimizing CDE. If that isn’t a sign of devotion to an antiquated desktop environment, then what is? (Needless to say, I’m crazy about the girl.)

This time around, I had installed CDE on my FreeBSD 12.1 box, but do an error in the /etc/hosts file (a superfluous and inaccurate hostname line that should have been commented out), CDE’s graphical login program (dtlogin) would keep looping back to itself once the username and password were entered, rather than proceed to the desktop. Even selecting “command line login” from the options menu would produce the same result.

While I had no idea (yet) what was causing this error, I decided that my first task would be to get at the /etc/rc.login file to comment out the line that triggers dtlogin at boot (“/usr/local/dt/bin/dtlogin”), and then try to fix CDE once I had normal access to my system. (With there being a certain amount of important data that hadn’t yet been backed up, simply throwing in the towel and reinstalling the system from scratch was an absolute non-starter.)

The catch, however, was that it would mean booting the machine into single-user mode (to bypass /etc/rc.login), which by default mounts the root…