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 13-CURRENT or 12.2-RELEASE on amd64.
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_1.
Run debootstrap --no-check-gpg 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.
Create a new file, /compat/ubuntu/etc/apt/apt.conf.d/00aptitude, containing a single line: APT::Cache-Start 251658240;.
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.
You can find the list of tested apps at LinuxApps. Feel free to add new entries.