Install FreeBSD Jails

#Follow the instructions in freeBSD Docs

1. Issue: unable to start jail

# service jail restart -vvvv testjail
Stopping jails:.
Starting jails: cannot start jail  "-vvvv": 
testjail: run command: /sbin/ifconfig dwc0 inet 192.168.1.235 netmask 255.255.255.255 alias
testjail: run command: /sbin/mount -t nullfs -o ro /usr/local/jails/templates/14.2-RELEASE-base /usr/local/jails/testjail-nullfs-base/
mount_nullfs: /usr/local/jails/testjail-nullfs-base: Resource deadlock avoided
jail: testjail: /sbin/mount -t nullfs -o ro /usr/local/jails/templates/14.2-RELEASE-base /usr/local/jails/testjail-nullfs-base/: failed
testjail: run command: /sbin/ifconfig dwc0 inet 192.168.1.235 netmask 255.255.255.255 -alias
 cannot start jail  "testjail": 
mount_nullfs: /usr/local/jails/testjail-nullfs-base: Resource deadlock avoided
jail: testjail: /sbin/mount -t nullfs -o ro /usr/local/jails/templates/14.2-RELEASE-base /usr/local/jails/testjail-nullfs-base/: failed

FIX:

umount -f /usr/local/jails/testjail-nullfs-base
service jail start testjail

2. Issue: pkg command not working

# pkg search mg
pkg: An error occurred while fetching package: No error
pkg: An error occurred while fetching package: No error
pkg: An error occurred while fetching package: No error
pkg: An error occurred while fetching package: No error
pkg: An error occurred while fetching package: No error
pkg: An error occurred while fetching package: No error

FIX: working on it