In 11.1 if you run: freebsd-update install and have no updates available you get a return text of: No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first. and a return code of: echo $? 1 In 11.2 this returns the same text, but the return code is now: echo $? 0 This breaks many scripts and jail managers because during an upgrade they loop to see how many times freebsd-update install needs to run (some times multiple). This will affect most jail users.
As an example, here is iocell's upgrade code: https://github.com/bartekrutkowski/iocell/blob/master/lib/ioc-upgrade Line 323 while [ $? -eq 0 ] ; do chroot ${_mountpoint}/root \ env UNAME_r="${_oldrelease}" env PAGER="/bin/cat" \ freebsd-update -r ${_release} install done
This als breaks ezjail, being the recommended jail manager according the FreeBSD handbook. After successful update, ezjail-admin get stuck in an endless loop: src component not installed, skipped No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first. src component not installed, skipped No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first. src component not installed, skipped No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first. I don't see a workaround but patching freebsd-update, which isn't really reasonable. Please, change the return code to anything else but zero!
@topical as for ezjail the loop is: while [ $? -eq 0 ]; do env UNAME_r="${ezjail_osversion_source}" PAGER=/bin/cat freebsd-update -b ${DESTDIR} -r ${ezjail_osversion_target} install done which (I assume) means, that ezjail-admin stucks in loop AFTER `freebsd-update install` run at least once. Check basejail version -- in my case it's updated.
@ilyushkeane as written, the jail is indeed updated, but ezjail is stuck in an endless loop. This is why we need a proper exit code of freebsd-update.
Looks like the behaviour changed in r324441.
I upgraded my systems to FreeBSD 12.0 and ezjail still gets stuck in an endless loop unless I apply the patch. Could someone please apply it?
Created attachment 201320 [details] fix ezjail getting stuck in endless loop during update
This is a PITA when you have to upgrade multiple jails hosts, I had to apply the patch in order to continue with our upgrades. This should be prioritized as it's affecting multiple users.
A commit references this bug: Author: gahr Date: Tue Mar 12 08:31:44 UTC 2019 New revision: 345055 URL: https://svnweb.freebsd.org/changeset/base/345055 Log: freebsd-update: restore old exit code when no updates are available locally This unbreaks ezjail and iocell, which get into an endless loop trying to figure out how many times "freebsd-update install" needs to be called. PR: 229346 Submitted by: Mike Cole <mcole36@gmail.com> Approved by: bapt MFC after: 1 week Changes: head/usr.sbin/freebsd-update/freebsd-update.sh
A commit references this bug: Author: gahr Date: Wed Mar 20 10:09:38 UTC 2019 New revision: 345320 URL: https://svnweb.freebsd.org/changeset/base/345320 Log: MFC r34505: freebsd-update: restore old exit code when no updates are available locally This unbreaks ezjail and iocell, which get into an endless loop trying to figure out how many times "freebsd-update install" needs to be called. PR: 229346 Submitted by: Mike Cole <mcole36 at gmail.com> Approved by: bapt Changes: _U stable/12/ stable/12/usr.sbin/freebsd-update/freebsd-update.sh
A commit references this bug: Author: gahr Date: Wed Mar 20 10:20:48 UTC 2019 New revision: 345322 URL: https://svnweb.freebsd.org/changeset/base/345322 Log: MFC r34505: freebsd-update: restore old exit code when no updates are available locally This unbreaks ezjail and iocell, which get into an endless loop trying to figure out how many times "freebsd-update install" needs to be called. PR: 229346 Submitted by: Mike Cole <mcole36 at gmail.com> Approved by: bapt Changes: _U stable/11/ stable/11/usr.sbin/freebsd-update/freebsd-update.sh
A commit references this bug: Author: grembo Date: Tue Sep 24 20:49:33 UTC 2019 New revision: 352662 URL: https://svnweb.freebsd.org/changeset/base/352662 Log: freebsd-update: Add `updatesready' and `showconfig' commands `freebsd-update updatesready' can be used to check if there are any pending fetched updates that can be installed. `freebsd-update showconfig' writes freebsd-update's configuration to stdout. This also changes the exit code of `freebsd-update install' to 2 in case there are no updates pending to be installed and there wasn't a fetch phase in the same invocation. This allows scripts to tell apart these error conditions without breaking existing jail managers. See freebsd-update(8) for details. PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), sectam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Changes: head/usr.sbin/freebsd-update/freebsd-update.8 head/usr.sbin/freebsd-update/freebsd-update.sh
A commit references this bug: Author: grembo Date: Thu Sep 26 16:33:21 UTC 2019 New revision: 352758 URL: https://svnweb.freebsd.org/changeset/base/352758 Log: MFC r352513, r352514, r352662: As suggested by koobs, MFC recent freebsd-update changes to have a consistent user experience on all supported versions. r352513: freebsd-update.8: appease igor igor follows American style guides in the belief that abbreviations i.e. and e.g. are always followed by a comma. Make that change now so that future updates to freebsd-update.8 do not complain about this. r352514: freebsd-update: make usage output consistent Drop trailing . which appeared only on description of IDS. r352662: freebsd-update: Add `updatesready' and `showconfig' commands `freebsd-update updatesready' can be used to check if there are any pending fetched updates that can be installed. `freebsd-update showconfig' writes freebsd-update's configuration to stdout. This also changes the exit code of `freebsd-update install' to 2 in case there are no updates pending to be installed and there wasn't a fetch phase in the same invocation. This allows scripts to tell apart these error conditions without breaking existing jail managers. PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Changes: stable/11/usr.sbin/freebsd-update/freebsd-update.8 stable/11/usr.sbin/freebsd-update/freebsd-update.sh
A commit references this bug: Author: grembo Date: Thu Sep 26 16:34:44 UTC 2019 New revision: 352759 URL: https://svnweb.freebsd.org/changeset/base/352759 Log: MFC r352513, r352514, r352662: As suggested by koobs, MFC recent freebsd-update changes to have a consistent user experience on all supported versions. r352513: freebsd-update.8: appease igor igor follows American style guides in the belief that abbreviations i.e. and e.g. are always followed by a comma. Make that change now so that future updates to freebsd-update.8 do not complain about this. r352514: freebsd-update: make usage output consistent Drop trailing . which appeared only on description of IDS. r352662: freebsd-update: Add `updatesready' and `showconfig' commands `freebsd-update updatesready' can be used to check if there are any pending fetched updates that can be installed. `freebsd-update showconfig' writes freebsd-update's configuration to stdout. This also changes the exit code of `freebsd-update install' to 2 in case there are no updates pending to be installed and there wasn't a fetch phase in the same invocation. This allows scripts to tell apart these error conditions without breaking existing jail managers. PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Changes: stable/12/usr.sbin/freebsd-update/freebsd-update.8 stable/12/usr.sbin/freebsd-update/freebsd-update.sh
A commit references this bug: Author: grembo Date: Thu Sep 26 20:56:08 UTC 2019 New revision: 352774 URL: https://svnweb.freebsd.org/changeset/base/352774 Log: MF stable/12 r352759,r352771 Approved by: re (gjb) r352759: freebsd-update.8: Style fixes, document new features. freebsd-update: Make usage output consistent. freebsd-update: Add `updatesready' and `showconfig' commands freebsd-update: Change exit code of `freebsd-update install' to 2 in case there are no pending updates and there wasn't a fetch phase in the same invocation. r352771: Add mergeinfo missing in r352759 PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Changes: _U releng/12.1/ releng/12.1/usr.sbin/freebsd-update/freebsd-update.8 releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh