I’ve updated all my hosts to FreeBSD 14.1 – but not all the jails.
I’m going to do some of that today.
In this post:
- FreeBSD 14.0
- FreeBSD 14.1
- mkjail-0.0.4
What’s on r730-03 to update?
Full disclosure: mkjail was originally written by Mark Felder, and I joined him in maintaining it. I use it for:
- Creating jails
- Updating jails (patching, like freebsd-update fetch install)
- Upgrading jails (as in going from FreeBSD 14.0 to FreeBSD 14.1)
mkjail stows the version information in a ZFS attribute. Here is what I have on r730-03:
[14:45 r730-03 dvl ~] % zfs get -t filesystem -r mkjail:version data01/jails NAME PROPERTY VALUE SOURCE data01/jails mkjail:version 13.2-RELEASE-p2 local data01/jails/ansible mkjail:version 14.1-RELEASE-p1 local data01/jails/bacula-sd-01 mkjail:version 13.2-RELEASE-p2 local data01/jails/bacula-sd-04 mkjail:version 14.1-RELEASE-p1 local data01/jails/cliff1 mkjail:version 14.1-RELEASE-p1 local data01/jails/dbclone mkjail:version 14.1-RELEASE-p1 local data01/jails/dns2 mkjail:version 14.0-RELEASE-p6 local data01/jails/empty mkjail:version 14.0-RELEASE-p6 local data01/jails/fileserver mkjail:version 14.1-RELEASE-p1 local data01/jails/fruity-ext mkjail:version 14.0-RELEASE-p4 local data01/jails/fruity-int mkjail:version 14.0-RELEASE-p6 local data01/jails/graylog mkjail:version 14.0-RELEASE-p6 local data01/jails/mysql57 mkjail:version 13.2-RELEASE-p2 local data01/jails/mysql80 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg11 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg12 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg13 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg14 mkjail:version 13.2-RELEASE-p2 local data01/jails/tc mkjail:version 14.0-RELEASE-p4 local data01/jails/testing-bacula9 mkjail:version 14.0-RELEASE-p6 local data01/jails/timecapsule mkjail:version 14.0-RELEASE-p4 local data01/jails/tm mkjail:version 14.0-RELEASE-p6 local [14:46 r730-03 dvl ~] %
Some notes:
- The pg* and mysql* jails are inactive jails for Bacula regression testing. They will not be upgraded.
- I’m not sure why the attribute exists on data01/jails
- bacula-sd-01 is an inactive jail
What will be upgraded?
I will be upgrading only these jails:
[14:53 r730-03 dvl ~] % zfs get -t filesystem -r mkjail:version data01/jails | grep 14.0 data01/jails/dns2 mkjail:version 14.0-RELEASE-p6 local data01/jails/empty mkjail:version 14.0-RELEASE-p6 local data01/jails/fruity-ext mkjail:version 14.0-RELEASE-p4 local data01/jails/fruity-int mkjail:version 14.0-RELEASE-p6 local data01/jails/graylog mkjail:version 14.0-RELEASE-p6 local data01/jails/tc mkjail:version 14.0-RELEASE-p4 local data01/jails/testing-bacula9 mkjail:version 14.0-RELEASE-p6 local data01/jails/timecapsule mkjail:version 14.0-RELEASE-p4 local data01/jails/tm mkjail:version 14.0-RELEASE-p6 local
While mkjail has the -a option, I’ll be specifying the jails manually.
Hmm, which I write this, I see that I no longer need tc, testing-bacula9, or timecapsule. I’ll deal with decommissioning those later.
That takes me to this list:
[15:13 r730-03 dvl ~] % zfs get -t filesystem -r mkjail:version data01/jails | grep 14.0 | egrep -v 'tc|testing-bacula9|timecapsule' data01/jails/dns2 mkjail:version 14.0-RELEASE-p6 local data01/jails/empty mkjail:version 14.0-RELEASE-p6 local data01/jails/fruity-ext mkjail:version 14.0-RELEASE-p4 local data01/jails/fruity-int mkjail:version 14.0-RELEASE-p6 local data01/jails/graylog mkjail:version 14.0-RELEASE-p6 local data01/jails/tm mkjail:version 14.0-RELEASE-p6 local
This gives me the name of the jails:
[15:15 r730-03 dvl ~] % zfs get -t filesystem -r mkjail:version data01/jails | \ grep 14.0 | egrep -v 'tc|testing-bacula9|timecapsule' | cut -f 1 -w | cut -f 3 -d '/' dns2 empty fruity-ext fruity-int graylog tm
And this puts them all on one line:
[15:16 r730-03 dvl ~] % zfs get -t filesystem -r mkjail:version data01/jails | \ grep 14.0 | egrep -v 'tc|testing-bacula9|timecapsule' | cut -f 1 -w | cut -f 3 -d '/' | xargs dns2 empty fruity-ext fruity-int graylog tm
The script
Here is the script I just wrote:
[15:19 r730-03 dvl ~] % cat ~/bin/mkjail-some.sh #!/bin/sh jails="dns2 empty fruity-ext fruity-int graylog tm" for jail in $jails do echo sudo mkjail upgrade -v 14.1-RELEASE -j $jail done [15:19 r730-03 dvl ~] % sh ~/bin/mkjail-some.sh sudo mkjail upgrade -v 14.1-RELEASE -j dns2 sudo mkjail upgrade -v 14.1-RELEASE -j empty sudo mkjail upgrade -v 14.1-RELEASE -j fruity-ext sudo mkjail upgrade -v 14.1-RELEASE -j fruity-int sudo mkjail upgrade -v 14.1-RELEASE -j graylog sudo mkjail upgrade -v 14.1-RELEASE -j tm [15:19 r730-03 dvl ~] %
Next, I removed the echo and ran it again, in a tmux session, just in case I get disconnected.
Here is the start:
[15:20 r730-03 dvl ~] % ~/bin/mkjail-some.sh Upgrading dns2 jail from 14.0-RELEASE to 14.1-RELEASE... Resolving conflict in '/etc/mail/mailer.conf': Select: (p) postpone, (df) diff-full, (e) edit, (h) help for more options: e Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (h) help for more options: r Resolving conflict in '/etc/group': Select: (p) postpone, (df) diff-full, (e) edit, (h) help for more options: Invalid command. Select: (p) postpone, (df) diff-full, (e) edit, (h) help for more options: e Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (h) help for more options: r Resolving conflict in '/etc/newsyslog.conf': Select: (p) postpone, (df) diff-full, (e) edit, (h) help for more options: e Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (h) help for more options: r Resolving conflict in '/etc/master.passwd': Select: (p) postpone, (df) diff-full, (e) edit, (h) help for more options: e Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (h) help for more options: r
What you don’t see: the edits performed during the merging of the files. That’s a skill you can develop as you go. I’m sure it’s completely overwhelming at first. This reddit post might help.
An aside
I removed the attribute from the top level filesystem:
[17:36 r730-03 dvl ~] % sudo zfs inherit mkjail:version data01/jails [17:36 r730-03 dvl ~] % zfs get -t filesystem -r mkjail:version data01/jails NAME PROPERTY VALUE SOURCE data01/jails mkjail:version - - data01/jails/ansible mkjail:version 14.1-RELEASE-p1 local data01/jails/bacula-sd-01 mkjail:version 13.2-RELEASE-p2 local data01/jails/bacula-sd-04 mkjail:version 14.1-RELEASE-p1 local data01/jails/cliff1 mkjail:version 14.1-RELEASE-p1 local data01/jails/dbclone mkjail:version 14.1-RELEASE-p1 local data01/jails/dns2 mkjail:version 14.1-RELEASE-p1 local data01/jails/empty mkjail:version 14.1-RELEASE-p1 local data01/jails/fileserver mkjail:version 14.1-RELEASE-p1 local data01/jails/fruity-ext mkjail:version 14.0-RELEASE-p4 local data01/jails/fruity-int mkjail:version 14.1-RELEASE-p1 local data01/jails/graylog mkjail:version 14.1-RELEASE-p1 local data01/jails/mysql57 mkjail:version 13.2-RELEASE-p2 local data01/jails/mysql80 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg11 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg12 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg13 mkjail:version 13.2-RELEASE-p2 local data01/jails/pg14 mkjail:version 13.2-RELEASE-p2 local data01/jails/tc mkjail:version 14.0-RELEASE-p4 local data01/jails/testing-bacula9 mkjail:version 14.0-RELEASE-p6 local data01/jails/timecapsule mkjail:version 14.0-RELEASE-p4 local data01/jails/tm mkjail:version 14.1-RELEASE-p1 local
Done
As you can see, the upgrade is done.
On to the next server, r730-01.