Diskless Debian GNU/kFreeBSD HOWTO

It was completely non-obvious; In some cases I had to figure it out by reading kFreeBSD source code; I write it down here so it’s not forgotten ;-)

This is a short guide on how to boot Debian GNU/kFreeBSD via network on a diskless machine, using GRUB as the bootloader.

  • Step 1: Configure your DHCP/TFTP environment to load GRUB from network. See the PXE GRUB documentation for details.
  • Step 2: Rebuild kfreebsd-8 package with BOOTP and BOOTP_NFSROOT options, as described in upstream handbook. They need to be added to the debian/arch/*/*.config file for your architecture. This kernel can still be used for normal, disk-based boot, but it will issue DHCP requests to attempt network boot every time you start it.
  • Step 3: Put your kFreeBSD in TFTP directory and configure GRUB to load it. This requires only one command in grub.cfg. My setup:

    set timeout=1
    set default=0

    menuentry “Debian GNU/kFreeBSD” {
    echo Loading kFreeBSD …
    kfreebsd /beastie/boot/kfreebsd-8.1-1-amd64.gz
    echo Booting …
    boot
    }

  • Step 4: Build a directory tree with your GNU/kFreeBSD userland, and export it via NFS. I copied it from an existing Debian GNU/kFreeBSD install, but I suppose debootstrap could do the job as well.
  • Step 5: kFreeBSD mounts root NFS in readonly mode initially, and Debian userland turns out to be very unhappy with that. If you want things to work you’ll need to either setup tmpfs in a few places (e.g. /tmp) or adjust fstab so that / is remounted as writable by the INIT scripts. Example fstab line:

    192.168.1.3:/srv/netboot/beastie / nfs rw 0 0

    This, however, will only work if mount_nfs(8) is in your system. And (well, too bad) it hasn’t been packaged yet. So you can copy it from a FreeBSD base tarball, along with its dependencies (/lib/libc.so.7, /libexec and /etc/netconfig).

  • Step 6: Finally the system boots, but you’ll soon notice that file locks don’t work. This breaks some daemons (rsyslog), dpkg, apt and possibly a lot other things. Actual (i.e. non-local) file locking on NFS requires a running lock daemon, both on client and on server. However, since FreeBSD lockd isn’t packaged either, and you probably don’t need global locks anyway, I suggest you disable it with “nolockd” mount option.
    The tricky part is that as explained in mount_nfs manpage, nolockd will only be honored when performing the initial mount, and it will be silently ignored if used while updating the mount options. So fstab is not an option.
    The only way I could find of telling the kernel to use arbitrary options when mounting / is by sending them via DHCP. Use the following options in your dhcpd.conf:

    option option-130 code 130 = text;
    option option-130 “nolockd”;

  • Et voilà. A Debian GNU/kFreeBSD system running completely in diskless mode. Enjoy!

    About these ads

    6 Responses to “Diskless Debian GNU/kFreeBSD HOWTO”

    1. Debian GNU/kFreeBSD FAQ « AJAXIAN.KR Says:

      […] Q26: 디스크없는( diskless) 시스템은 어떻게 설정하는가? A26: 네트워크부트 지원은 여전히 개발 진행중이다. 몇가지 트윅으로 설정가능하며 여기 HOWTO를 참조하라: http://robertmh.wordpress.com/2011/02/04/diskless-debian-gnukfreebsd-howto/ […]

    2. Links 7/2/2011: FOSDEM 2011 Closing, GNOME 3 Test Day | Techrights Says:

      […] Diskless Debian GNU/kFreeBSD HOWTO It was completely non-obvious; In some cases I had to figure it out by reading kFreeBSD source code; I write it down here so it’s not forgotten […]

    3. Diskless Debian GNU/kFreeBSD HOWTO | Debian-News.net - Your one stop for news about Debian Says:

      […] This is a short guide on how to boot Debian GNU/kFreeBSD via network on a diskless machine, using GRUB as the bootloader. More here […]

    4. Timo Lindfors Says:

      Thanks for also adding this to http://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ — I hope the URL to your blog post will be stable.

      • robertmh Says:

        I expect so. The content might get obsolete though.

        In any case, feel free to copy / modify as you see fit.

    5. Tweets that mention Diskless Debian GNU/kFreeBSD HOWTO « Robert Millan's blog -- Topsy.com Says:

      […] This post was mentioned on Twitter by Ovidiu Constantin, Planet Debian and Asociatia ProLinux, Devilicus. Devilicus said: Robert Millan: Diskless Debian GNU/kFreeBSD HOWTO: It was completely non-obvious; In some cases I… http://bit.ly/g9y4oT #debian #linux […]

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s


    Follow

    Get every new post delivered to your Inbox.

    %d bloggers like this: