Jail maintenance

From wikinotes

Updating Jail Packages

# Updating Packages
# If all you're looking to do is to maintain your packages,
# you can update all of your jails from your root system

pkg -j wikinotes upgrade

for jid in `jls | awk '{print $1}'`; do yes | sudo pkg -j $jid upgrade; done

Updating Jails

See also Freebsd release management

Patch Updates

freebsd-update -b /usr/local/jails/myjail/filesystem fetch
freebsd-update -b /usr/local/jails/myjail/filesystem install

Minor/Major Updates

NOTE:

See jail-update executable, less typing.

first update the host

freebsd-update upgrade \
  --currently-running 12.0-RELEASE \
  -r 13.0-RELEASE

# 1st run
freebsd-update install
sudo reboot

# 2nd run
freebsd-update install
sudo pkg upgrade

next determine the jail's version

# NOTE:
#   cat /etc/os-release   # innacurate if freebsd-upgrade used
#   uname -a              # innacurate, jails use host kernel
freebsd-version  # prints version (confirmed works for jail)

next update each jail

freebsd-update \
  -b /usr/local/jails/${JAIL}/filesystem \
  --currently-running 12.0-RELEASE \
  -r 12.1-RELEASE \
  upgrade

freebsd-update \
  -b /usr/local/jails/${JAIL}/filesystem install

service jail restart ${JAIL}

freebsd-update \
  -b /usr/local/jails/${JAIL} \
  install

pkg -j ${JAIl} upgrade