Skip to main content

Ubuntu bionic on FreeBSD with iocage managed jails

How I managed to run Ubuntu in a FreeBSD Jail managed with iocage.


Here's the host machine, running FreeBSD 12.2-RELEASE.

uname -srmi

FreeBSD 12.2-RELEASE-p1 amd64 GENERIC

Log into the Ubuntu Jail with iocage:

iocage console ubuntu

Last login: Tue Dec 15 22:22:16 UTC 2020 on pts/1
Welcome to Ubuntu 18.04 LTS (GNU/Linux 3.2.0 x86_64)

* Documentation:
* Management:
* Support:

Here's the Ubuntu Jail, running under FreeBSD's Linux compatibility layer:

uname -a

Linux ubuntu 3.2.0 FreeBSD 12.2-RELEASE-p1 GENERIC x86_64 x86_64 x86_64 GNU/Linux


  • FreeBSD 12.2 installed on a baremetal or a virtual machine.

  • iocage installed and configured.

Enable Linux Compatibility Layer

Set up /boot/loader.conf to load required kernel modules at boot:


Enable Linux in /etc/rc.conf using the handy utility sysrc and reboot.

sysrc linux_enable=YES

Create empty iocage jail

iocage create -e -n ubuntu exec_start="/bin/true" exec_stop="/bin/true" ip4_addr="em0|"
  • Disable startup scripts by setting /bin/true to exec_start and exec_stop.

  • Set IPv4 address on host's network interface or bridge, don't use VNET.

  • Replace em0 with your interface or bridge name.

Install and run debootstrap

pkg install -y debootstrap

debootstrap --arch=amd64 --no-check-gpg bionic /zroot/iocage/jails/ubuntu/root/

echo "APT::Cache-Start 251658240;" > /zroot/iocage/jails/ubuntu/root/etc/apt/apt.conf.d/00aptitude
  • Use the path to your ubuntu jail instead of /zroot/iocage/jails/ubuntu/root/

Set up filesystems for the jail

iocage fstab -e ubuntu
  • If you've not yet set up the $EDITOR environment variable, now's the time to export EDITOR=nvim, replace nvim with your preferred text editor.

devfs           /zroot/iocage/jails/ubuntu/root/dev      devfs           rw                      0       0
tmpfs           /zroot/iocage/jails/ubuntu/root/dev/shm  tmpfs           rw,size=1g,mode=1777    0       0
fdescfs         /zroot/iocage/jails/ubuntu/root/dev/fd   fdescfs         rw,linrdlnk             0       0
linprocfs       /zroot/iocage/jails/ubuntu/root/proc     linprocfs       rw                      0       0
linsysfs        /zroot/iocage/jails/ubuntu/root/sys      linsysfs        rw                      0       0
/tmp            /zroot/iocage/jails/ubuntu/root/tmp      nullfs          rw                      0       0
/home           /zroot/iocage/jails/ubuntu/root/home     nullfs          rw                      0       0


iocage start ubuntu

Once logged into the jail:

apt update
apt remove rsyslog

Tinker around, find out what works and read the references below for details.