One of the strengths of the Linux ecosystem is freedom of choice. The Debian distribution has given its users one more freedom: to choose between the Linux and FreeBSD kernels under the hood, with the same Debian GNU user space applications whichever is chosen. The idea goes back ten years, but it is finally coming to fruition now that two new architectures, kfreebsd-i386 and kfreebsd-amd64, have been added to the unstable and experimental archives of Debian.
The project was first announced in the Debian Weekly News for February 22nd, 1999:
Someone proposed a Debian distribution based on FreeBSD. There was considerable debate on this topic. Most of the favorable opinions expressed were based on the argument that there should be a Debian distribution for as many open source UNIX variants as possible. This was countered with the argument that this would drastically increase the workload of the package maintainers.
Shortly thereafter a plain FreeBSD port of Debian was started, with a FreeBSD kernel and FreeBSD libc under a GNU user space. To not diverge too much from the GNU/Linux architecture, the developers of the project used GNU utilities, but they quickly found out that a lot of packages needed patches because the FreeBSD libc did not provide the same extensions as GNU libc.
So after a while came the idea to port GNU libc to the FreeBSD kernel. This was done mostly by Bruno Haible in 2002, which is when the project took the shape (and name) it has now. Port maintainer Aurélien Jarno looks back at this time:
At this moment, Robert Millan suggested to add a 'k' in front of FreeBSD to form GNU/kFreeBSD meaning "kernel of". It is a way to show that except a few low level userland utilities, we are using only the kernel and not the C library of FreeBSD. In the same way a GNU/Opensolaris port is in development (Nexenta
), and a GNU/kOpenSolaris
port has been started recently now that GNU libc has been partly ported to the OpenSolaris kernel, solving licensing issues.
Switching to the GNU libc port has brought better compatibility with the Debian packages and, once that happened, a lot of packages were able to be built without any changes. The project got the name Debian GNU/kFreeBSD. To summarize, Debian GNU/kFreeBSD is a port that consists of a GNU user space using the GNU C library and Debian package management and system tools on top of FreeBSD's kernel. The latest Debian GNU/kFreeBSD is based on the upstream FreeBSD 7.1 kernel with a few patches.
GNU and BSD: a strange marriage
But why have the developers made such a strange chimera, a combination of a BSD kernel and a GNU user space? Is this a "because we can" project? Obviously, the developers have heard this question countless times, and the wiki lists some valid reasons why a user could prefer Debian GNU/kFreeBSD to FreeBSD or Debian GNU/Linux.
The "why" question breaks down into two questions. First, why would a
user prefer Debian GNU/kFreeBSD to Debian GNU/Linux? First, the FreeBSD
kernel has some nice and useful features, like the OpenBSD "pf" packet filter and "jails",
a system-level virtualization feature. The developers also list cleaner
kernel interfaces than Linux as an advantage, pointing to a single
/dev implementation via devfs, as well as using OSS as the default
sound system as examples.
Drivers can be another advantage. For example, the FreeBSD kernel has
support for Windows NDIS drivers in the mainline kernel, whereas the NDISwrapper project
will not likely make it into the mainline Linux kernel. The developers add:
"The FreeBSD kernel might support some hardware which Linux does not
support and/or the FreeBSD kernel support might be better (fewer
bugs)." But, of course, this is a double-edged sword: Linux supports
a lot of devices for which FreeBSD has no drivers yet.
Another interesting issue lies on the filesystem front: the Debian GNU/kFreeBSD developers say that due to licensing and patent issues, Sun's filesystem ZFS is unlikely to appear in the Linux kernel. However, now that Oracle is buying Sun, chances have improved that ZFS will get GPL-licensed. But whatever will happen, ZFS is also being ported to FreeBSD, so Debian GNU/kFreeBSD users will definitely see support for this interesting filesystem in the future.
Some of the reasons the developers give are less convincing. For example, they say: "kFreeBSD offers an alternative in case Linux is branded illegal by the SCO case or other threats. In legal terms, Linux sources are like a minefield. kFreeBSD is much less vulnerable to such attacks because of its less bazaar-like development model." Your author thinks this is very unlikely to happen.
The second part of the "why" question is: why would a user prefer Debian
GNU/kFreeBSD to FreeBSD? This really comes down to preferences. Maybe the
user likes the Debian package system more than FreeBSD ports, or prefers
the GNU user space to the BSD world. The GNU versions of many commands are
known to have more features. And at the non-technical level: Debian
GNU/kFreeBSD follows the Debian Free
Software Guidelines, whereas FreeBSD uses some non-free, binary-only
drivers such as the ath driver for Atheros wireless chipsets. But all of
this will most likely not convince BSD users to switch.
Working with Debian GNU/kFreeBSD
This all sounds interesting, but does it work in practice? The base system is fully functional and users can install Debian GNU/kFreeBSD by using the install notes. An ISO file for an install CD is available. Currently this is a version from January 2009, but users can add a Lenny-based snapshot to /etc/apt/sources.list.
The current installation CD is based on a hacked FreeBSD sysinstall,
so at this moment, the installation
is not straightforward for users without any FreeBSD experience. Moreover,
this only works more or less correctly for standard installations. This is
a temporary solution until the debian-installer is fully
ported to Debian GNU/kFreeBSD. Luca Favatella, a computer engineering
student at the University of Catania in Italy, will implement this as part
Summer of Code 2009. As part of his proposal, which has been accepted
at GSOC, he will not only port debian-installer to GNU/kFreeBSD, but he
will also make debian-installer less
dependent on Linux: at this moment it uses many Linux-specific
constructs (e.g. udev) or assumes Linux structures (e.g. setting up
partitions with LVM).
Most of the core packages in Debian unstable are ported to Debian
GNU/kFreeBSD. Looking at all of the architecture-independent source
packages, the developers have currently ported over 80% of the 7800 source
packages. Of course not all of them have been tested. There is still a
large amount of packages that need fixing. The developers have a list of
practices and problems found when porting to GNU/kFreeBSD. According to
Jarno, a lot of porting is rather simple (but boring). For example, support
for detecting GNU/kFreeBSD was added more than six years ago to autotools,
but a lot of software is still using an older version. He adds: "Also
a lot of software is using #ifdef __linux__ to detect if they are using a
GNU libc. This is clearly wrong, and this is also one of the more
repetitive changes to make."
Several high-profile packages aren't ported yet. For example, OpenOffice.org is missing. But Jarno sees no fundamental problems for this port to happen: "There is no reason it would not work, but it is a huge task given the size of Openoffice.org sources. All the build dependencies are available, so it's mainly about tweaking the hundreds of autodetection scripts that do not know about GNU/kFreeBSD."
Wireless networking works in Debian GNU/kFreeBSD, but there are no tools to scan for networks yet. The problem is that NetworkManager is really tightly coupled to HAL, which was not available on FreeBSD. Jarno explains: "Though it has been originally designed for being portable across operating systems, a lot of kernel-specific code had to be written." However, now that HAL has been ported to FreeBSD, it should not be a big deal to get NetworkManager working. As upstream FreeBSD is doing the porting work (as a Google Summer of Code project), Debian GNU/kFreeBSD will surely get NetworkManager support in the near future.
There is a core of about 5 to 8 developers working on the Debian GNU/kFreeBSD port, but as with any open source project a lot of other people are also helping to a smaller extent. That includes package maintainers who want their package to work on the system. The project provides Debian Developer accessible machines running GNU/kFreeBSD for this purpose. Jarno estimates that about 50 people are using Debian GNU/kFreeBSD almost daily, and that a lot of people are following the development more or less closely: "We hope to see this number increasing now that it is being integrated as an official Debian architecture."
With Debian GNU/kFreeBSD, the Debian project has taken one more step towards its vision as a universal operating system. It's unique to have a platform supporting two different kernels, while the user space remains largely unchanged. Of course there's also Debian GNU/Hurd, but this still has not been officially released, and the Hurd kernel itself is still relatively immature. Debian GNU/NetBSD is still in an early stage of development. The ultimate aim is Debian GNU/Any, where the user space is abstracted completely from the running kernel with glibc. When this is possible, Debian binaries would be binary compatible with any kernel supported on Debian GNU/Any through the glibc abstraction. This total decoupling of user space and kernel will give users even more choice.
to post comments)