This page describes the steps required to configure Ubuntu-based Linux jail or chroot - a complete Linux userspace environment running on top of Linuxulator.
- Run FreeBSD 14-CURRENT or 13.0-RELEASE on amd64, or 14-CURRENT on arm64
Have linux(4) compatibility enabled, as documented in the man page; this boils down to having linux_enable=YES in /etc/rc.conf. This is to load the neccessary kernel modules and set some sysctls.
Install sysutils/debootstrap; pkg install debootstrap. You need at least debootstrap-1.0.123_4.
Run debootstrap bionic /compat/ubuntu. This will install Ubuntu Bionic into /compat/ubuntu. While it is technically possible to install into /compat/linux instead, it's discouraged due to possible clash with CentOS-based ports and packages (linux_base-c7 et al). You might see some errors during configuration phase - they are generally harmless; as long as the log ends with "Base system installed successfully", everything is fine.
Set up mounts in /etc/fstab, as described in linux(4) man page. Remember to actually mount them (mount -al if you use the example below) afterwards. If you want to share home directory contents, and be able to run X11 apps, you will also need null mounts for /home and /tmp. For example:
# Device Mountpoint FStype Options Dump Pass# devfs /compat/ubuntu/dev devfs rw,late 0 0 tmpfs /compat/ubuntu/dev/shm tmpfs rw,late,size=1g,mode=1777 0 0 fdescfs /compat/ubuntu/dev/fd fdescfs rw,late,linrdlnk 0 0 linprocfs /compat/ubuntu/proc linprocfs rw,late 0 0 linsysfs /compat/ubuntu/sys linsysfs rw,late 0 0 /tmp /compat/ubuntu/tmp nullfs rw,late 0 0 /home /compat/ubuntu/home nullfs rw,late 0 0
That's it! You should now be able to run chroot /compat/ubuntu /bin/bash and use apt like you would on a typical Ubuntu instance. You will probably want to add users and groups with UIDs/GIDs matching the ones on the host system. While systemd doesn't work, the service command works as usual. Some things that would probably get set up by the installer require manual tweaking: if you get warnings about LC_ALL you'll want to install appropriate locales (apt search language-pack). There's a configuration problem with the rsyslog package; use apt remove rsyslog to make apt stop whining. To get your environment variables set up in the typical Ubuntu way you might want to start sshd(8) (service ssh start) and log in this way; you can add chroot /compat/ubuntu /usr/sbin/service ssh start to /etc/rc.local to make it run at boot. As with any other Ubuntu, you will probably want to add the package repositories missing from defaults; for amd64 (x86_64) version of Ubuntu make your /compat/ubuntu/etc/apt/sources.list look like this:
deb http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse deb http://security.ubuntu.com/ubuntu/ bionic-security universe multiverse restricted main deb http://archive.ubuntu.com/ubuntu bionic-backports universe multiverse restricted main deb http://archive.ubuntu.com/ubuntu bionic-updates universe multiverse restricted main
For arm64, it should look like this:
deb http://ports.ubuntu.com/ubuntu-ports bionic main universe restricted multiverse
Note that the instructions above apply to both jails and chroots - it makes no difference from Linuxulator point of view; the part that matters is changing the filesystem root directory, which is common to both. Also note that the instructions don't describe how to manage the jail; take a look at this article for instructions on how to manage your Ubuntu jail using iocage, or this one for Bastille.
You can find the list of tested apps at LinuxApps. Feel free to add new entries.