Differences between revisions 178 and 180 (spanning 2 versions)
Revision 178 as of 2011-07-27 15:08:11
Size: 22202
Editor: ?RobertMillan
Comment: 9-CURRENT patch
Revision 180 as of 2011-08-03 13:21:35
Size: 22338
Editor: ?RobertMillan
Comment:
Deletions are marked like this. Additions are marked like this.
Line 37: Line 37:
There are also [[http://lindi.iki.fi/lindi/kfreebsd/install-screenshots/|some installation screenshots]].
Line 62: Line 64:
Otherwise you need to rebuild your kernel with a small patch or otherwise some multithread programs (e.g. aptitude) won't work. Here's a version for [[http://anonscm.debian.org/viewvc/glibc-bsd/trunk/kfreebsd-8/debian/patches/007_clone_signals.diff?view=co|8-STABLE]] and one for [[http://anonscm.debian.org/viewvc/glibc-bsd/trunk/kfreebsd-9/debian/patches/007_clone_signals.diff?view=co|9-CURRENT]]. If you can't meet these requirements you need to rebuild your kernel with a small patch or otherwise some multithread programs (e.g. aptitude) won't work. Here's a version for [[http://anonscm.debian.org/viewvc/glibc-bsd/trunk/kfreebsd-8/debian/patches/007_clone_signals.diff?view=co|8-STABLE]] and one for [[http://anonscm.debian.org/viewvc/glibc-bsd/trunk/kfreebsd-9/debian/patches/007_clone_signals.diff?view=co|9-CURRENT]].

Translation(s): русский - Polski

Contents

  1. Basic questions
    1. Q. What does the 'k' in "kFreeBSD" stand for?
    2. Q. What is the point of Debian GNU/kFreeBSD?
    3. Q. What version of kFreeBSD is supported?
    4. Q. Which Debian releases are available?
    5. Q. Which mirrors offer Debian GNU/kFreeBSD?
    6. Q. Are there instructions for downloading and installing kfreebsd, that don't require previous knowledge of Debian?
    7. Q. Is there any documentation available?
    8. Q. Who are the main contributors?
    9. Q. What hardware does this support?
    10. Q. Does Debian plan to drop support for the Linux kernel and replace it with a FreeBSD kernel?
  2. Technical questions
    1. Q. Can I run Debian GNU/kFreeBSD in a chroot under FreeBSD?
    2. Q. Can I share a swap partition between GNU/Linux and GNU/kFreeBSD?
    3. Q. Can I share partitions between GNU/Linux and GNU/kFreeBSD?
    4. Q. What's the status of amd64 support?
    5. Q. Is there any way to upgrade to Debian-*bsd an existing, running FreeBSD installation (whether it makes sense or not)
    6. Q. Can *.deb packages co-exist with classical BSD ports?
    7. Q. Are the *.deb packages for *bsd handled the same old way they did on Linux, or do they simply use the /usr/local filesystem?
    8. Q. What about some specs I once read about leaving the use of /usr/local to the system administrator? (Maybe these are concerning only to Linux...)
    9. Q. Are there any plans to support alternate CPU instruction sets, e.g. ARM, PPC or Sparc64?
    10. Q. What about all those packages which use ALSA?
    11. Q. Does dpkg's license affect packages build with it, e.g. the kFreeBSD kernels?
    12. Q: Which syscall kernel interface is used by binaries compiled for Debian GNU/kFreeBSD?
    13. Q: Is it possible to run FreeBSD binaries under Debian GNU/kFreeBSD kernel?
    14. Q: Is it possible to run Linux binaries under Debian GNU/kFreeBSD kernel?
    15. Q: How do I setup a firewall with Debian GNU/kFreeBSD?
    16. Q. Can I run Java programs?
    17. Q: How do I setup a diskless system?
    18. Q: How do I mount root filesystem by UUID?
    19. Q. How does kfreebsd's config differ from upstream and why?
  3. Using Debian GNU/kFreeBSD
    1. Q. Where can I download kFreeBSD?
    2. Q. How do I configure/enable sound?
    3. Q. Wireless?
    4. Q. How can I burn CD-ROMs?
    5. Q. How do I trace system calls?
    6. Q. How do I run native FreeBSD under a chroot under Debian GNU/kFreeBSD?
    7. Q. How do I run native FreeBSD userland tools easily?
    8. Q. How do I debug the kernel?
    9. Q. Is there something like LXR for browsing the freebsd codebase?
    10. Q. What freebsd userland tools are still missing?
    11. Q. How do I configure keyboard layout on the console?
    12. Q. How do I scroll up on the console?
    13. Q. How do I configure grub to pass a parameter to the kernel?
    14. Q. I specified wrong root device in fstab, how do I remount it in single user mode?
    15. Q. How do I use serial console?
    16. Q. I just installed Debian GNU/kFreeBSD. Is there anything I can do to help making it more popular?
    17. Q. Is there ZFS support?
    18. Q. Can I use ZFS as root file system?
    19. Q. How can I build a package in a chroot?
    20. Q. How do I use pf (Packet Filter)?
    21. Q. Can I run this as a Xen DomU?
    22. Q. How do I boot Debian GNU/kFreeBSD into single user mode?
    23. Q. What is this idle process and why is it using all available CPU time?
  4. Development questions
    1. Q. Where can I check buildd logs for a particular package on kfreebsd-*?
    2. Q. I'm a Debian maintainer. Is there any machine running GNU/kFreeBSD I can have access to?
    3. Q. Do I have the option of which libc to use?
    4. Q. Why was the choice made to use glibc?
  5. Unanswered questions
    1. Q. Is anyone running this in production?
    2. Q. How stable is kFreeBSD?
    3. Q. What license is kFreeBSD released under?
    4. Q. Are there any benchmarks available?
    5. Q. Are there any repositories for the non-free stuff that was taken out?
    6. Q. How do you support GPL-licensed file systems?
    7. Q. Are the kernel patches needed to make Debian GNU/kFreeBSD work given back to FreeBSD?

Basic questions

Q. What does the 'k' in "kFreeBSD" stand for?

A. It's an abbreviation. It stands for "kernel of". Hence "kFreeBSD" means "kernel of FreeBSD", and "GNU/kFreeBSD" means "GNU with kernel of FreeBSD".

Q. What is the point of Debian GNU/kFreeBSD?

A. This answer has its own wiki page, see Debian GNU/kFreeBSD why.

Q. What version of kFreeBSD is supported?

A. The squeeze release is based on the 8.1 kernel, see for details. If you are interested, you can take a look at the patches Debian applied to the kernel.

Q. Which Debian releases are available?

A. Debian GNU/kFreeBSD is available in the official Debian squeeze release. For details see the main wiki page.

Q. Which mirrors offer Debian GNU/kFreeBSD?

A. See official mirror list.

Q. Are there instructions for downloading and installing kfreebsd, that don't require previous knowledge of Debian?

A. Yes, see the installation manuals for kfreebsd-i386 and kfreebsd-amd64. Note that installing from USB drive is not supported in Squeeze. If you can't install from network and you don't have a CD-ROM drive you can run the installer under QEMU and then copy the resulting image to a USB stick:

wget ftp://ftp.debian.org/debian/dists/squeeze/main/installer-kfreebsd-amd64/20110106+squeeze1/images/netboot/mini.iso
dd if=/dev/zero of=root.img bs=1M count=0 seek=4k
qemu-system-x86_64 -hda root.img -cdrom mini.iso
sudo dd if=root.img of=/dev/disk-id/NAME_OF_DEVICE

If you just want to play with kfreebsd quickly you can just fetch a QEMU image from http://people.debian.org/~aurel32/qemu/kfreebsd-amd64/

There are also some installation screenshots.

Q. Is there any documentation available?

A. Apart from the regular Debian documentation, there is this wiki page, and that's about it. You are welcome to contribute to the main wiki page of course. If you are interested in kernel features specifically then FreeBSD handbook might give you hints even thought it is targeted to users of FreeBSD userland.

Q. Who are the main contributors?

A. Contributors would be mostly: Aurélien Jarno, Petr Salinger, Luca Falavigna, Robert Millan, Cyril Brulebois.

Q. What hardware does this support?

A. see the install instructions and the upstream documentation.

Q. Does Debian plan to drop support for the Linux kernel and replace it with a FreeBSD kernel?

A. No. Both kernels will co-exist in Debian.

Technical questions

Q. Can I run Debian GNU/kFreeBSD in a chroot under FreeBSD?

A. Yes, you will need:

  • FreeBSD kernel from latest (as of 2011-07-19) 8-STABLE or 9-CURRENT.
  • libc0.1 2.13-11 or later (only available in sid as of 2011-07-26).

If you can't meet these requirements you need to rebuild your kernel with a small patch or otherwise some multithread programs (e.g. aptitude) won't work. Here's a version for 8-STABLE and one for 9-CURRENT.

Once you have a patched kernel, you can follow this tutorial on how to build a Debian GNU/kFreeBSD chroot using debootstrap.

Q. Can I share a swap partition between GNU/Linux and GNU/kFreeBSD?

A. Yes, but it's not recommended. See http://www.tldp.org/HOWTO/Linux+FreeBSD-3.html for details on how to proceed. Also note that Linux tends to save suspend-to-disk data to the swap partition, which makes sharing swap less attractive.

Q. Can I share partitions between GNU/Linux and GNU/kFreeBSD?

A. Yes, recommended options are ext2fs and zfs.

  • For ext2fs, when creating the filesystem, pass "-O none" to mke2fs for best results.
  • For zfs, create the filesystem from GNU/kFreeBSD, then use zfs-fuse on GNU/Linux. Filesystems created by zfs-fuse might be too new for ZFS v14 in kFreeBSD to access.

A few other file systems may be used to transfer data, but only in one direction:

  • For ufs (either 1 or 2), it's only supported readonly by Linux. Write support is highly experimental and is likely to cause panics.
  • For ext3fs, kFreeBSD can only access it in readonly mode.
  • For reiserfs, readonly support has been added to kfreebsd 6.x (see 335019).

  • For xfs, readonly support has been added to kfreebsd 7.x (see 335020 for details). Write support is also planned.

  • For btrfs, readonly support can be archieved by using the grub-mount utility (note that this requires FUSE support, which can be enabled with fuse4bsd).

Q. What's the status of amd64 support?

A. It is in roughly same state as the i386 one.

Q. Is there any way to upgrade to Debian-*bsd an existing, running FreeBSD installation (whether it makes sense or not)

A. I am unsure about this. You can prepare a filesystem on a different partition/slice and use chroot to install the basic files. Look inside the latest ISO, there is base/base.tgz inside install.iso. Unpack it into the created chroot. But at least multi-threaded programs will not work under pristine FreeBSD kernel.

Q. Can *.deb packages co-exist with classical BSD ports?

A. It is not good idea. Please use a chroot for things like this.

Q. Are the *.deb packages for *bsd handled the same old way they did on Linux, or do they simply use the /usr/local filesystem?

A. In the same way as on any other Debian system -- the usual prefix is /usr.

Q. What about some specs I once read about leaving the use of /usr/local to the system administrator? (Maybe these are concerning only to Linux...)

A. There are (almost) no files from any *.deb in /usr/local/. It is really left for local system administrator.

Q. Are there any plans to support alternate CPU instruction sets, e.g. ARM, PPC or Sparc64?

A. There are plans for a MIPS port, see Debian_GNU/kFreeBSD_MIPS

Q. What about all those packages which use ALSA?

Short A. No ALSA.

Long A. We have salsa which emulates some basic alsa features, which is sufficient for some packages, but far not for all of them.

Q. Does dpkg's license affect packages build with it, e.g. the kFreeBSD kernels?

A. No.

Q: Which syscall kernel interface is used by binaries compiled for Debian GNU/kFreeBSD?

A: The native FreeBSD one.

Q: Is it possible to run FreeBSD binaries under Debian GNU/kFreeBSD kernel?

A: Yes, please just use the full chroot with FreeBSD libraries.

Q: Is it possible to run Linux binaries under Debian GNU/kFreeBSD kernel?

A: Only as long as standard FreeBSD Linux Compatibility Layer is sufficient. Some symlinks might be missing. The basic linux-i386 chroot of etch and lenny under kfreebsd-amd64 and kfreebsd-i386 works. The FreeBSD Linux Compatibility Layer claims it supports up to 2.6.16 syscalls. Please note that squeeze supports only 2.6.18 and above Linux kernels.

A start to dig deeper and test the limits (like #571523) is:

debootstrap --foreign --arch=i386 etch ./linux-chroot http://ftp.de.debian.org/debian

Q: How do I setup a firewall with Debian GNU/kFreeBSD?

A: You can use PF, the OpenBSD Packet Filter, which has been ported to the kernel of FreeBSD, and is available as part of the Debian GNU/kFreeBSD distribution.

A complete guide on PF is available at http://www.openbsd.org/faq/pf/index.html

Q. Can I run Java programs?

A. Not very well yet. gij works but its Swing support has not received attention lately. openjdk-6-jre is not available for kfreebsd-* but since it has been ported to FreeBSD all hope is not lost.

Q: How do I setup a diskless system?

A: Support for network boot is still work in progress. It's possible to set it up with some tweaking, see this HOWTO: http://robertmh.wordpress.com/2011/02/04/diskless-debian-gnukfreebsd-howto/

Q: How do I mount root filesystem by UUID?

A. The following applies only to UFS2. Use e.g.

# grub-probe -t fs_uuid --device /dev/ad0s1
4cc08aab6455cf88

to figure out the UUID of your current root filesystem and then use it in fstab as follows:

/dev/ufsid/4cc08aab6455cf88      /               ufs     rw              0       1

Note that your /boot/grub/device.map might still refer to the disk by its real name as there is no way to refer to the whole disk by UUID. However, this does not seem to be a problem. In fact, it seems that everything works if you create an empty device.map. By applying

--- /etc/grub.d/10_kfreebsd.orig        2011-02-09 22:52:50.000000000 +0200
+++ /etc/grub.d/10_kfreebsd     2011-02-09 22:44:09.000000000 +0200
@@ -136,6 +136,7 @@
 
   case ${GRUB_FS} in
     zfs)               kfreebsd_device=$(grub-probe -t fs_label --device ${GRUB_DEVICE})$(grub-mkrelpath / | sed -e "s,/*@$,,") ;;
+    ufs2)              kfreebsd_device=/dev/ufsid/$(grub-probe -t fs_uuid --device ${GRUB_DEVICE}) ;;
     *)                 kfreebsd_device=${GRUB_DEVICE} ;;
   esac

grub.cfg will pass root=/dev/ufsid/XXX parameter to kernel. This has possibly been fixed in upstream bzr revision 2827.

Q. How does kfreebsd's config differ from upstream and why?

A. You can take a look at the changes made to sys/amd64/conf/GENERIC.

Using Debian GNU/kFreeBSD

Q. Where can I download kFreeBSD?

A. See the main wiki page.

Q. How do I configure/enable sound?

A. You have to load the proper kernel sound driver(s) using the kldload command. This works for me (SiS AC'97 sound controller):

kldload snd_csa
kldload snd_driver

An utility to load appropiate driver(s) automatically is being worked on, see: http://lists.debian.org/debian-bsd/2011/02/msg00073.html

Q. Wireless?

A. A debian specific bug makes wireless unusable. You can workaround this by using native freebsd userland tools from a chroot to setup wlan.

Q. How can I burn CD-ROMs?

A. Nothing special here, just use wodim:

apt-get install wodim
wodim foo.iso

Q. How do I trace system calls?

A. You can use ktrace/kdump. Here's a cheatsheet, read man pages for details:

gnu/linux

gnu/kfreebsd

start: strace -o mytrace -s4096 -f -p PID
stop: ctrl-c
view: less mytrace

start: ktrace -f mytrace -d -p PID
stop: ktrace -c -p PID
view: kdump -f mytrace -m 4096

Q. How do I run native FreeBSD under a chroot under Debian GNU/kFreeBSD?

A. First extract the binaries from the FreeBSD ISO image:

wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.1/FreeBSD-8.1-RELEASE-i386-disc1.iso

mdconfig -a -t vnode -f FreeBSD-8.1-RELEASE-i386-disc1.iso  -u 0
mount -t cd9660 -o ro /dev/md0 /mnt
mkdir /srv/freebsd-8.1
cat /mnt/8.1-RELEASE/base/base.??|tar vzxf - -C /srv/freebsd-8.1
cat /mnt/8.1-RELEASE/manpages/manpages.??|tar vzxf - -C /srv/freebsd-8.1
umount /mnt
mdconfig -d -u 0

Then mount devfs under the chroot with e.g.

mount -t devfs devfs /srv/freebsd-8.1/dev

Note: bind-mounting (-t nullfs) /dev won't work here.

Note2: You probably want to add /srv/freebsd-8.1/dev to /etc/fstab so that it's mounted on every boot.

Q. How do I run native FreeBSD userland tools easily?

First setup a FreeBSD chroot (see Q&A above), then create a new file named /usr/local/bin/freebsd with the contents

exec chroot /srv/freebsd-8.1 "$@"

and make it executable. You can now run freebsd useland tools easily by prefixing the commands with freebsd:

# uname
GNU/kFreeBSD
# freebsd uname
FreeBSD

Q. How do I debug the kernel?

A. Recompile the kernel with debugging symbols and support for built-in debugger:

# Make sure you have at least 4 gigabytes of disk space.
apt-get source kfreebsd-8
cd kfreebsd-8-8.1
export QUILT_PATCHES=debian/patches
quilt push -a
quilt new debugger.diff
quilt add sys/i386/conf/GENERIC
editor sys/i386/conf/GENERIC
# Add the following options:
# makeoptions DEBUG="-g"
# options DDB
# options KDB
dch -i
# Add a new changelog entry.
# You probably want to use something like "+debugger" in the version number and
# UNRELEASED in place of "unstable".
quilt refresh
debuild
sudo debi
sudo reboot

Here's an example debugging story:

"ifconfig wlan0 create wlandev ath0" fails with "ifconfig: SIOCIFCREATE2: Bad address". By reading the source code I guess that this might be caused by copyin() failing in wlan_clone_create() function. I hit ctrl-alt-esc to enter the debugger prompt and add a breakpoint to that function:

KDB: enter: manual escape to debugger
[thread pid 12 tid 100013 ]
Stopped at kdb_enter+0x3d: movl $0,kdb_why
db> break wlan_clone_create
db> c

and then proceed with the failing command using

root@debian:~# ifconfig wlan0 create wlandev ath0
[thread pid 1309 tid 100088 ]
Breakpoint at  wlan_clone_create:  pushl %ebp
db>

Using the command "x/x $ebp,10" you can inspect the stack which contains arguments that were passed to the wlan_clone_create function. On kfreebsd-i386 the following should be true:

address

contents

$ebp + 4

return address (usually the caller unless a tail call optimization is done)

$ebp + 8

the first argument

$ebp+12

the second argument

$ebp+16

the third argument

...

...

Beware that the debugger silently converts between decimal and hexadecimal: 1+4*4 == 11 but 1+(4*4) == 17!

If the in-kernel debugger is too primitive for your taste you can also use gdb. The easiest solution is to run the system under qemu started with the "-s" option and the to connect to it using gdb:

gdb flavor-8.1-1-686/sys/i386/compile/DEBCUSTOM/kernel.debug
target remote localhost:1234

Q. Is there something like LXR for browsing the freebsd codebase?

A. Yes, see http://fxr.watson.org for kernel stuff and cvsweb for userland.

Q. What freebsd userland tools are still missing?

A. As of 2011 I can't find at least the following binaries:

glabel(8)

dumpon(8)

geli(8)

mount_nfs(8)

Q. How do I configure keyboard layout on the console?

A. Run "dpkg-reconfigure kbdcontrol".

Q. How do I scroll up on the console?

A. Hit scroll lock. Then use page up, page down and arrow keys to scroll.

Q. How do I configure grub to pass a parameter to the kernel?

A. In squeeze you need to open /etc/grub.d/10_kfreebsd and add your options after the line that reads

kfreebsd                ${rel_dirname}/${basename}

This should be easier in the future.

Q. I specified wrong root device in fstab, how do I remount it in single user mode?

A. You can enter single user mode by adding -s option to kernel in grub to the end of the kfreebsd command. You can then mount the root file system read-write with

mount -u -o ro /dev/ad0s1 /
mount -u -o rw /dev/ad0s1 /

and fix your /etc/fstab. (Two mount commands are needed due to a bug).

Q. How do I use serial console?

A. Add the -h option to kernel in grub to the end of the kfreebsd command. At least in Squeeze, you probably also want to edit /etc/inittab and /etc/securetty to update the serial device name to cuau0.

Q. I just installed Debian GNU/kFreeBSD. Is there anything I can do to help making it more popular?

A. Yes! You can install/enable popularity-contest (see http://popcon.debian.org/) to increase our user count. Also you can register yourself as Debian GNU/kFreeBSD user in http://buildd.net/cgi/archvote.phtml. You might also want to tell us how did you hear about Debian GNU/kFreeBSD in this poll. And of course, you can tell all your friends about it. =)

Finally, you can install the "bsdstats" script to record your Debian GNU/kFreeBSD installation at bsdstats.org (Debian GNU/kFreeBSD not listed as possible BSD OS). You need to install the following packages for the script to work:

apt-get install netcat mksh sharutils openssl bind9-host

Then, you can simply run the script manually via "mksh bsdstats", and/or via a cron-job (weekly, for example).

Q. Is there ZFS support?

A: Yes! You have to install the zfsutils package.

apt-get install zfsutils

Q. Can I use ZFS as root file system?

A. Yes, with some caveats:

You may not use multi-device arrays nor gzip compression in this case (default compression is fine). You may want to read about the latest developments in GRUB which will make this possible: http://lists.debian.org/debian-bsd/2011/02/msg00125.html.

If you're not repartitioning this disk from scratch, it's likely that GRUB install will fail later on (see #614768.

Q. How can I build a package in a chroot?

A. For now, sbuild isn't working properly since schroot seems to be using some Linuxisms. It is possible to set up pbuilder in the meanwhile, using the patch and the configuration mentioned in #560332. Andi noted some limitations in #542837, it would be nice to investigate.

Q. How do I use pf (Packet Filter)?

A. (Warning: this answer is a stub only, please double-check and expand as needed.) It seems one has to load the pf module, and then enable pf. Something like that should do:

sudo kldload pf
sudo pfctl -e

Q. Can I run this as a Xen DomU?

A: Seems someone has gotten it to boot: http://article.gmane.org/gmane.linux.debian.ports.bsd/4238, http://smp.if.uj.edu.pl/~baryluk/kfreebsd-xen/. The support in FreeBSD kernel have been significantly improved in 8.2 release, the xen flavour is available in unstable (currently as kfreebsd-image-8.2-1-xen).

Q. How do I boot Debian GNU/kFreeBSD into single user mode?

A. In GRUB, edit the entry's line starting with "kfreebsd" and add a " -s" (blank dash "s") at the end. Then boot.

Q. What is this idle process and why is it using all available CPU time?

A. It is a kernel thread that executes architecture specific instructions to save energy when there is nothing else to execute. If you are curious, see "man runqueue" or take a look at the source code.

Development questions

Q. Where can I check buildd logs for a particular package on kfreebsd-*?

A. At the usual place for almost all build logs: https://buildd.debian.org/status/

Q. I'm a Debian maintainer. Is there any machine running GNU/kFreeBSD I can have access to?

A. Yes, see http://io.debian.net/ and http://asdfasdf.debian.net/. All DDs automatically have an account.

Q. Do I have the option of which libc to use?

A. No.

Q. Why was the choice made to use glibc?

A. Because otherwise far more packages would need patches to build on Debian GNU/kFreeBSD. All packages in Debian GNU/Linux are known to work fine with (e)glibc. So most of the work is in only one package, the libc. The no more active Debian GNU/NetBSD port tried to use the BSD libc, but not using the glibc was probably one of the reasons why it stalled.

Unanswered questions

Q. Is anyone running this in production?

Q. How stable is kFreeBSD?

Q. What license is kFreeBSD released under?

Q. Are there any benchmarks available?

Q. Are there any repositories for the non-free stuff that was taken out?

Q. How do you support GPL-licensed file systems?

Q. Are the kernel patches needed to make Debian GNU/kFreeBSD work given back to FreeBSD?

A. Yes, you can see the patches http://svn.debian.org/wsvn/glibc-bsd/trunk/kfreebsd-8/debian/patches/ but not all are accepted by upstream. Q2: Why? A2: Some of the patches see the "Status:" lines in the patches themselves.


CategoryPermalink