Why I Don't Run FreeBSD on My Laptop
Preface
You may or may not have noticed I've been writing more about ZFS on Linux lately. This might seem weird coming from a person who is admittedly a big proponent of BSD, primarily OpenBSD, and someone with a strong disdain for systemd and the entire reasoning behind that whole... thing.
First, some background. I started playing with FreeBSD back in the 3.2 days, I don't care to remember how long ago that was. I remember the install CD didn't include a DHCP client on it so I needed to get a lease using a Windows install, then turn it off, swap the hard disk, and manually set the ifconfig to get the FreeBSD install on the network long enough to download dhclient.
On rare occasions I still trawl web.archive.org looking for the long-lost CNet article from 20 or so years ago outlining five alternate operating systems: I vaguely remember them including QNX, the BeOS, Amiga, and FreeBSD. I forget the fifth. It might have been Linux. FreeBSD was described as "bulletproof", and that intrigued me. FreeBSD seemed very similar to Linux, with an older pedigree and a far stricter adherence to kernel-userland cooperation. I liked the idea of a central governing body. It gives you one place to point your finger when something goes sideways. I was sold.
UPDATE, 2018-02-17: I found it. Helpfully linked on this FreeBSD in the Press page, what I read was called "Bye-Bye, Windows", Christopher Lindquist (1999-05-24). The FreeBSD 3.2 page is archived and it is this citation of the phrase "bulletproof stability" that first intrigued me. For the curious, the alternative OSes are: Linux, OS/2 Warp v4 and v5, FreeBSD 3.2, the BeOS R4, and NewDeal Office v3. Yes. I'm serious. MacOS and Rhapsody get honorable mention.
Eventually I settled on OpenBSD for my network OS of choice and that looks to have been a decision I made around version 2.4 or so, long before PF or LibreSSL were devised. I ran -CURRENT for a while, I kept local mirrors of the i386 and amd64 install sets, I labored over mkisofs command line arguments back when the release ISO image was copyrighted, before Theo blessed the existence of official installXX.iso files.
When web series BSD Now asked for tutorials, I decided to finally sit down and learn a thing or two about DragonFly BSD's very own HAMMER file system and write up a crash course for it.
What I'm trying to say is that I've been a dyed-in-the-wool BSD fan for a while. I'm no dev and my proposed patches were laughably bad, so anymore I just keep quiet and let the BSDs do their thing. I don't hate the BSDs and this critique is not intended to offend, but it is nonetheless a criticism of the state of BSD's real-world usefulness.
Motivation
I recently had an experience with some very insidious malware that infected my network. It's called "Windows 10 Creators Update" and it took 25% of my machine pool offline when it forced a reboot and waited for a non-existent sitting-at-the-keyboard user to go through the "out-of-box experience" setup process again. Dozens of my machines stopped doing work because they were infected by a big screen that, instead of saying "your files have been encrypted", simply said "Welcome to Windows 10!" and had a "Next" button it wanted me to click.
So I've been looking for a reliable replacement OS for a while now. In 2015 I experimented with Antergos, an Arch Linux derivative, and it was nice, but it was prompting me to install updates twice a day. So I switched to Linux Mint and It Was Good. But Mint derives from Ubuntu, which derives from Debian, which adopted systemd, and that makes me sad.
There was a recent article by Peter N. M. Hansteen titled OpenBSD and the modern laptop that got me thinking about putting BSD on one of my laptops. I have a hard requirement for ZFS support... By Any Means Necessary. That summarily eliminates OpenBSD, because by its own admission OpenBSD sucks. Maybe FreeBSD? Maybe not.
The Failure of FreeBSD
When I first began testing non-Windows laptop setups, my first choice was the now-defunct PC-BSD. Unfortunately I cannot link to the bug since the project has ended, but there was an issue with the bsdinstall scripts that prevented easy dual-booting between multiple partitions. I tried to fix this myself, but I'm no dev and my patches were laughably bad. The PC-BSD experiment did not last long.
Eventually systemd started creeping into my laptop, so I renewed my interest in a BSD substitution. PC-BSD is now TrueOS and uses FreeBSD's -CURRENT branch as its starting point. I no longer require dual-booting on my laptop, so PC-BSD/TrueOS's dual booting problem shouldn't be a blocker anymore. So far, so good! It doesn't boot in a Hyper-V VM. The installer just hangs at a partially-drawn portion of the boot menu. So testing out a change in a VM before applying it to real-world hardware isn't possible for me. Turns out I also have a hard requirement that the OS must support cursory Hyper-V virtualization so I can potentially break something important in an expendable VM before I potentially break something important on my laptop. So TrueOS was out the window.
I finally looked at FreeBSD 11.0-RELEASE or, if you prefer, "TrueOS with the training wheels off". It runs under Hyper-V very well, and I've been using it both on local virtualized instances and in Azure since around 10.2 or so. It can run in the cloud, but it can't run on my ThinkPad.
What? Yeah. I use an old Lenovo ThinkPad for my testing, a T410 to be specific. This isn't some obscure workalike architecture that was only produced in Sweden for six months and was exclusively used by electrical engineering automation microcontrollers or something. It's just a goddamn ThinkPad. I put an SSD drive in it last year and it keeps chugging along like a trooper. Too bad the FreeBSD kernel hangs on startup.
It doesn't always hang. It's about 50/50 whether or not the installer ISO is going to get to the install wizard or hang during the dmesg part. I can sometimes get it to boot fully by toggling some boottime options, but I don't have a consistent workaround. Sounds like a hardware problem, right? Right. But Windows still works on this laptop like a champ. After getting the OS installed, I had hoped the startup problem was limited to the installer, but no, the finished client wouldn't boot after a restart, either. The first startup went fine, the second one hung.
That would end the dreams of a FreeBSD desktop experience for anyone. Anyone but me! I persisted. I fetched 11.1-RELEASE the day it came out hoping that maybe some minor kernel revision would spare me, but no, no luck there. 11.1 behaves just as 11.0 did.
Dejected, I began fussing with Linux again, and trying to choose a non-systemd Linux is an increasingly unpleasant experience. So I went back to FreeBSD and did some testing with 11.1-RELEASE on a Hyper-V VM. And a FreeBSD desktop experience there is still painful.
C. O. D. (Crash on Delivery)
FreeBSD has pretty good documentation. This is undisputed. So when I set up my FreeBSD test VM, I went to The FreeBSD Handbook and started reading. To be clear, I wanted a FreeBSD 11.x/amd64 machine running XFCE and a GUI login was an optional nice-to-have. So I ran pkg install xfce like the handbook says and then ran /usr/local/bin/startxfce4.
Turns out I hadn't installed the xorg package first. The XFCE package doesn't require it (Really? Really?). It doesn't get installed as a pre-req, so to be thorough I wiped everything, reinstalled, and did that first. Then I re-added xfce and tried again. And X11 started... kinda. And then it crashed.
So I read. I read tutorial after tutorial after tutorial. I even defected to MATE tutorials on old FreeBSD versions, such was my need for a FreeBSD desktop.
I'd reinstalled FreeBSD a half a dozen times up to this point, and I was getting very good at hard-resetting the VM, logging in, rolling back to an initial ZFS snapshot, and rebooting again to save a little bit of time. And I was determined.
There were some randomly-recommended manual tweaks of dubious value that forums and howtos mentioned, but I didn't really comprehend what those changes would do or if they would help. I was cautious but willing to experiment. This is why being able to screw around inside a VM is so important to me.
Eventually after a couple days of fussing with it, I found the correct commands to get a desktop environment started on a FreeBSD Hyper-V VM:
pkg install xorg pkg install xfce echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc # add hald_enable="YES" to /etc/rc.conf reboot startx
Now there is joy, right? No, no there is not. The mouse doesn't work. I Alt-keyed and arrow keyed around a little bit and still couldn't get to a quit or a shutdown button. Or start an xterm window so I could maybe type halt -p or something. I hard-reset the VM.
I added moused_enable="YES" to /etc/rc.conf and rebooted again to see if that would help. It did not. At that point I was tired and out of ideas and howtos. FreeBSD won't reliably boot on my ThinkPad and, even if it one day does, I can't get a FreeBSD desktop working in a VM because the VM ignores mouse input.
So I went back to fighting with Linux. I wrote an encrypted-root-ZFS-on-Devuan tutorial that I plan to post soon. Stay tuned.
1 comment:
I too had problems with getting the mouse to work with dragonfly or netbsd. On dragonfly I have dbus_enabled=YES and hald_enabled=YES. I think had to set something in X config as well. I think I found some thing useful in man psm and sysmouse
Post a Comment