Is it possible to build a chroot environment which is running FreeBSD inside of Linux, if so, how would I go about build a chroot environment from within Linux?

  • 1
    Please clarify what you mean by "FreeBSD chroot environment". Do you mean a chroot environment which is running FreeBSD, or an environment set up using some FreeBSD implementation of chroot on Linux? – Kusalananda Jan 29 '18 at 14:26
  • I would like to have a working or semi-working FreeBSD environment inside that chroot on Linux. – Walter Jan 29 '18 at 14:28
  • 1
    It seems you may want to run FreeBSD in a virtual machine. I doubt the base system of FreeBSD would compile cleanly on top of Linux... – Kusalananda Jan 29 '18 at 14:29
  • Compiling aside, isn't there something like a base jail or chroot image that I could download then extract like gentoo's stage3? Then, with that, couldn't I merely do the normal mounts and get it working? FreeBSD ships with binary packages, so I wouldn't need to worry about compiling unless I wanted to. Also, if I did want to compile, wouldn't I be doing that inside the chroot environment which has all of the necessary libraries at that point? – Walter Jan 29 '18 at 14:34
  • 3
    You would still be running a Linux kernel. Everything would need to be ported and recompiled to be working with Linux system calls instead of FreeBSD system calls. You want a virtual machine. – Kusalananda Jan 29 '18 at 14:37

FreeBSD and Linux are two different kernels (well, FreeBSD users will argue with me here, but the core of FreeBSD is a different kernel), so you can’t run one on top of the other without some sort of emulation or virtualisation layer.

The easiest way to run FreeBSD on a Linux-based system is to use a virtual machine such as QEMU.

If you’re really keen, you might be able to run a pure FreeBSD chroot on a distribution with a familiar set of tools, e.g. Debian GNU/kFreeBSD. You can apparently do the opposite, i.e. run a Debian GNU/kFreeBSD chroot on top of FreeBSD. In both cases you’re using the FreeBSD kernel, there’s no Linux kernel involved.

Not the answer you're looking for? Browse other questions tagged or ask your own question.