Differences between revisions 112 and 113
Revision 112 as of 2010-10-27 08:03:30
Size: 13084
Editor: TimoLindfors
Comment: elaborate a bit on kernel debugging possibilities
Revision 113 as of 2010-10-28 18:47:45
Size: 13437
Editor: TimoLindfors
Comment: add more notes on building kernel with debugging symbols, still incomplete
Deletions are marked like this. Additions are marked like this.
Line 173: Line 173:
TODO: what exactly is needed? At least

makeoptions DEBUG="-g"
options DDB
options KDB
TODO: The following information is still unverified:

# 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 new changelog entry
quilt refresh
debuild

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?
  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 to trace kernel function calls?
    7. Q. How do I scroll up on the console?
    8. Q. I specified wrong root device in fstab, how do I remount it in single user mode?
    9. Q. I just installed Debian GNU/kFreeBSD. Is there anything I can do to help making it more popular?
    10. Q. Is there ZFS support?
    11. Q. How can I build a package in a chroot?
    12. Q. How do I use pf (Packet Filter)?
    13. Q. Can I run this as a Xen DomU?
    14. Q. How do I boot Debian GNU/kFreeBSD into single user mode?
  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 latest GNU/kFreeBSD install CD is based on the 8.1 kernel, see for details. The 7.3 kernel is also available. If you are interested, you can take a look at the patches Debian applies to the kernel.

Q. Which Debian releases are available?

A. Debian GNU/kFreeBSD is available in the official Debian archive as unstable and testing, i.e. the sources.list entries are identical to any other machine running Sid or Squeeze. Daily snapshots of D-I images are available at http://d-i.debian.org/daily-images/.

There are still also lenny-based snapshots of the GNU/kFreeBSD archive. Just use the install CD from Jan 2009 and put the following lines into your /etc/apt/sources.list

deb http://ftp.debian-ports.org/debian-snapshot/lenny unstable main
deb http://ftp.debian-ports.org/debian-snapshot/lenny unreleased main

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, the installation notes and the debian-install manual are pretty generic.

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 http://www.freebsd.org/doc/handbook/ FreeBSD handbook might give you hints even thought it is targeted to users of FreeBSD userland.

Q. Who are the main contributors?

A. I think contributors would be mostly Aurélien Jarno (.fr), Petr Salinger (.cz), Luca Falavigna (.it?), Robert Millan (.es)

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, but it won't work perfectly unless you apply some kernel patches. You can get them from the Debian kfreebsd-8 source package, but it is up to you to find out and decide which ones you need. We recommend to use a Debian kernel for running Debian GNU/kFreeBSD userland. In case something fails, you're on your own.

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, but you must use ext2fs. When creating the filesystem, pass "-O none" to mke2fs for best results. As for other file systems:

  • 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.

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 at http://glibc-bsd.alioth.debian.org/install-cd/, 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. Not yet.

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

Using Debian GNU/kFreeBSD

Q. Where can I download kFreeBSD?

A. debian-installer images: http://d-i.debian.org/daily-images/kfreebsd-amd64/ and http://d-i.debian.org/daily-images/kfreebsd-i386/

Previous versions were on: http://glibc-bsd.alioth.debian.org/install-cd/

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

Q. Wireless?

A. Yes, but we don't have the tools to scan for networks yet. If you know the ssid beforehand, the following stanza in /etc/network/interfaces should work:

auto ${if}
iface ${if} inet dhcp
     pre-up ifconfig ${if} ssid ${my_ssid}

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 to trace kernel function calls?

A. Not sure. Dtrace might work but "kldload dtraceall" needs "kldload profile" which needs "kldload cyclic" which kills USB at least on acer aspire one laptop.

You can also use the kernel debugger. First compile the kernel with debugging support. In 2010 under qemu-system-i386 building kfreebsd-8 8.1-5 took less than a day and used 2 gigabytes of disk space.

TODO: The following information is still unverified:

# 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 new changelog entry quilt refresh debuild

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. 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. TODO: How to actually mount the root filesystem read-write? Simple "mount -o remount,rw /" tries to access the wrong device, "mount -o renount,rw /dev/ad0s1 /" does not complain but root stays read-only

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. 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

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.

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, but not all are accepted. Q2: Why?


CategoryPermalink