I have a confession to make: I haven't used FreeBSD as a desktop OS for years. The reason is twofold:
- Since 2005, my work has required me to run Linux (Debian and Ubuntu at Linpro, RedHat at the University of Oslo) and, briefly, Windows at Kongsberg Maritime. I eventually stopped using stationary computers, resorting instead to a (company-provided) laptop running either Ubuntu, or Windows with Ubuntu in VirtualBox.
- More importantly, around the time I started at Linpro, it became increasingly difficult to maintain a FreeBSD desktop. The modularization of X.org and the increasing complexity of desktop environments mean that the number of packages required for a complete desktop system has grown from a bit over 100 to well over 600 (in addition to the kernel and base operating system, which is monolithic in FreeBSD). The FreeBSD ports system does not scale well, and the lack of a proper binary update procedure makes it almost impossible to keep that many packages up-to-date.
This is about to change. Thanks to what may very well be the most important innovations in recent FreeBSD history, I am now once again running a FreeBSD desktop.
I am referring, of course, to PKGNG and its companion, PoudriÃ¨re.
(Actually, I've been running PC-BSD for a while, but I'm not a big fan of PBIs, and they don't really address the updating problem. This is about building a FreeBSD desktop from scratch, and keeping it up-to-date.)
Here is the procedure I followed:
I created a new VirtualBox VM with a 128 GB disk—this may not seem like much, but most of my storage requirements are met by the host system, which has two 2 TB disks, and an older file server with over 2 TB of storage, including ~40 GB of source code.
Instead of the default NAT configuration, I set up a bridged network interface with promiscuous mode enabled; I run my own DNS and DHCP servers (on a soekris, of course), so within my home network, the VM has its own fixed IP address and DNS name.
I then installed FreeBSD 9.0-RELEASE amd64 from the disc1 ISO. I did not select any packages, nor did I install the ports tree. However, as soon as the system booted, I downloaded and extracted an up-to-date ports tree using portsnap and built pkg and poudriere.
I had initially planned to rely entirely on the pkgbeta repository, but there are two problems with this: firstly, all the packages there are built with the default options, which in many cases make no sense at all; and secondly and most importantly, it did not at that time have a full set of Gnome 2 packages.
I therefore set up my own PoudriÃ¨re. I ran a first build with only ports-mgmt/pkg and ports-mgmt/poudriere, then updgraded those two packages and started over with a slightly larger set of packages, including mail/postfix, security/sudo, shells/zsh and other essentials which don't take long to build. Finally, I added emulators/virtualbox-ose-additions, x11/xorg, x11/gnome2, and a number of desktop applications (e.g. Emacs) and development tools (e.g. Subversion) which I use. Then it was just a matter of
% sudo pkg install x11/xorg x11/gnome2 editors/emacs
Whenever I need an additional package, I add it to the package list and re-run PoudriÃ¨re. I don't really need to do that—I could just as easily build it straight from the ports tree—but it ensures that I get a “clean” package that I can safely use on another VM or machine, should I ever need to, and that it is rebuilt when updated, along with all the other packages I use:
% sudo poudriere ports -u
% sudo poudriere bulk -f ~/poudriere-packages -j 83amd64 -k
I had some minor configuration trouble. First, X.org's autoconfiguration feature still doesn't work very well, at least in VirtualBox, so I used the xorg.conf from a previous post, with only minor modifications:
Identifier "Generic Keyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Identifier "VBox Mouse"
Identifier "VBox Video"
Identifier "VBox Monitor"
Identifier "Default Screen"
Device "VBox Video"
Monitor "VBox Monitor"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "VBox Mouse"
With the VirtualBox guest additions installed and this xorg.conf in place, everything works beautifully—mouse integration, clipboard integration and dynamic desktop resizing.
The second issue I had was with GDM's greeter, which did not display my user in the user list and would not let me type in my user name. The first part is understandable, as it only displays users who have logged in at least once already. The second is more surprising, but I did not have the energy to try to figure out why. Instead, I worked around it by disabling the user list:
% sudo -u gdm gconftool-2 --type bool \
--set /apps/gdm/simple-greeter/disable_user_list true
Shared folders are still not implemented for FreeBSD guests, but I rarely need to transfer files between the host and the guest; when I do, I use FileZilla to SFTP them over, and there is always SMB for more complex use.
If I were running on real hardware or a weaker host (this is a four-core i7 with 16 GB RAM), I might use a subset of PC-BSD's tricked-out sysctl.conf, but I don't need audio and I haven't experienced any interactivity issues yet.
That's it—try it yourself, and share your experience below!