Created attachment 268437 [details] Screenshot: VirtualBox, taking a snapshot. pkg is not installed. The third run of 'freebsd-update install' is endless. Script started on Sun Mar 1 01:15:20 2026 root@bug293502:~ # uptime 1:15AM up 42 secs, 1 user, load averages: 0.24, 0.06, 0.02 root@bug293502:~ # echo $SHELL /bin/csh root@bug293502:~ # freebsd-version -kru ; uname -a 14.4-RC1 14.4-RC1 13.5-RELEASE-p10 FreeBSD bug293502 14.4-RC1 FreeBSD 14.4-RC1 releng/14.4-n273674-041aa28386d3 GENERIC amd64 root@bug293502:~ # freebsd-update install src component not installed, skipped Creating snapshot of existing boot environment... done. Installing updates... Completing this upgrade requires removing old shared object files. Please rebuild all installed 3rd party software (e.g., programs installed from the ports tree) and then run 'freebsd-update [options] install' again to finish installing updates. root@bug293502:~ # pkg leaf The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: n root@bug293502:~ # freebsd-update install load: 0.14 cmd: pkg 44102 [ttyin] 469.14r 0.00u 0.00s 0% 8212k load: 0.05 cmd: pkg 44102 [ttyin] 618.15r 0.00u 0.00s 0% 8212k load: 0.10 cmd: pkg 44102 [ttyin] 1832.80r 0.00u 0.00s 0% 8212k load: 0.31 cmd: pkg 44102 [ttyin] 2151.43r 0.00u 0.00s 0% 8212k ^C root@bug293502:~ # exit exit Script done on Sun Mar 1 01:58:26 2026
Created attachment 268440 [details] Screenshot: an apparently endless run of freebsd-update fetch I restored the VirtualBox snapshot (named 'pkg is not installed. The third run of 'freebsd-update install' is endless.'). I cancelled the install command, waited for the time to correct itself, then ran the fetch command for more seventy minutes. More specifically: date ; uptime ; /usr/bin/time -h freebsd-update fetch In response: nothing.
Created attachment 268441 [details] top at ttyv2, whilst still awaiting a response to the fetch command at ttyv1
Created attachment 268444 [details] Screenshot: in a different virtual machine, another apparently endless run of freebsd-update fetch Reproducible in a different virtual machine. For this test, I used Virtual Machine Manager and QEMU. In this case, I ignored the hint for a third run of the install command. Instead: date ; freebsd-update fetch I took this screenshot after waiting for five minutes. Ten minutes later: still nothing.
Re: comment 3 After a few hours: - I cancelled the fetch command - I attempted the install command. Re: <https://github.com/freebsd/freebsd-src/blob/6da9d465c54bf2e3496e83db025c5d22f3b3cc17/usr.sbin/freebsd-update/freebsd-update.sh#L33> and <https://github.com/freebsd/freebsd-src/blob/6da9d465c54bf2e3496e83db025c5d22f3b3cc17/usr.sbin/freebsd-update/freebsd-update.sh#L339-L344> I experimented with: --debug the VERBOSELEVEL environment variable. Nothing gained, unfortunately. In the absence of logging (bug 256143), I'm experimenting without truly understanding the code. "load …" lines in previous comments, and below, are from SIGINFO (Control-T). ---- Script started on Sun Mar 1 04:45:49 2026 root@bug293516:~ # echo $SHELL /bin/csh root@bug293516:~ # uptime 4:45AM up 1 min, 1 user, load averages: 0.22, 0.07, 0.02 root@bug293516:~ # bectl list -c creation BE Active Mountpoint Space Created default NR / 2.75G 2026-03-01 04:06 13.5-RELEASE_2026-03-01_041835 - - 246M 2026-03-01 04:18 13.5-RELEASE-p10_2026-03-01_044342 - - 1.88M 2026-03-01 04:43 root@bug293516:~ # freebsd-version -kru 14.4-RC1 14.4-RC1 13.5-RELEASE-p10 root@bug293516:~ # pkg leaf The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: n root@bug293516:~ # freebsd-update install src component not installed, skipped Creating snapshot of existing boot environment... done. Installing updates... Completing this upgrade requires removing old shared object files. Please rebuild all installed 3rd party software (e.g., programs installed from the ports tree) and then run 'freebsd-update [options] install' again to finish installing updates. root@bug293516:~ # date ; freebsd-update fetch Sun Mar 1 05:04:10 GMT 2026 load: 0.19 cmd: pkg 44149 [ttyin] 13993.27r 0.00u 0.00s 0% 8204k ^^C^C root@bug293516:~ # date Sun Mar 1 08:57:36 GMT 2026 root@bug293516:~ # freebsd-update --debug install load: 0.08 cmd: pkg 44890 [ttyin] 102.80r 0.00u 0.00s 0% 8228k ^C root@bug293516:~ # setenv VERBOSELEVEL debug root@bug293516:~ # date Sun Mar 1 09:00:56 GMT 2026 root@bug293516:~ # root@bug293516:~ # freebsd-update install load: 0.16 cmd: pkg 45139 [ttyin] 151.24r 0.00u 0.00s 0% 8228k ^C root@bug293516:~ # date Sun Mar 1 09:03:53 GMT 2026 root@bug293516:~ # exit exit Script done on Sun Mar 1 09:04:03 2026
Created attachment 268447 [details] typescript Re: comment 4 A workaround, condensed: 1. pkgbasify 2. pkg-unregister(8) Afterwards: root@bug293516:~ # freebsd-update fetch src component not installed, skipped You have a partially completed upgrade pending Run 'freebsd-update [options] install' first. Run 'freebsd-update [options] fetch -F' to proceed anyway. root@bug293516:~ # freebsd-update install src component not installed, skipped Creating snapshot of existing boot environment... done. Installing updates... done. root@bug293516:~ # ---- The tail of the attached typescript file: 34 9:30 fetch -o pkgbasify.lua https://tinyurl.com/pkgbasify-foundation 35 9:30 chmod +x ./pkgbasify.lua 36 9:30 ./pkgbasify.lua 37 9:36 ee .cshrc 38 9:37 pkg unregister FreeBSD-\* 39 9:38 uname 40 9:38 date 41 9:38 freebsd-update fetch 42 9:40 pkg which /usr/bin/uname 43 9:40 pkg leaf 44 9:41 pkg unregister -f FreeBSD-clibs FreeBSD-runtime 45 9:41 freebsd-update fetch 46 9:42 freebsd-update install 47 9:42 date 48 9:42 freebsd-version -kru 49 9:42 history root@bug293516:~ # exit exit
Also bugged, if I'm not mistaken, upgrades from: - EoL 14.2-RELEASE-p7 - 14.3-RELEASE-p9 I'll attach a screenshot of freebsd-update fetch running endlessly, with nothing printed to the screen, following a second and final run of freebsd-update install with no hint to perform a third run.
Created attachment 268461 [details] freebsd-update fetch after upgrading 14.3-RELEASE-p9 userland Re: comment 6, here's the screenshot.
Created attachment 268548 [details] typescript Re: comment 5 A more focused workaround: 1. add the FreeBSD-utilities package, which includes /usr/sbin/freebsd-update 2. unregister the package.
Maybe the bug bites only when pkg is not bootstrapped. Script started on Sun Mar 1 19:17:35 2026 root@bug293516-virtualbox:~ # echo $SHELL /bin/tcsh root@bug293516-virtualbox:~ # freebsd-version -kru ; uname -mvKU 14.4-RC1 14.4-RC1 14.4-RC1 FreeBSD 14.4-RC1 releng/14.4-n273674-041aa28386d3 GENERIC amd64 1404000 1404000 root@bug293516-virtualbox:~ # /usr/bin/time -h freebsd-update fetch load: 0.21 cmd: pkg 1864 [ttyin] 32.41r 0.00u 0.00s 0% 6288k 32.60s real 0.00s user 0.00s sys ^Ctime: command terminated abnormally 34.74s real 0.07s user 0.15s sys root@bug293516-virtualbox:~ # pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/base_4, please wait... pkg: Attempted to fetch pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/base_4/Latest/pkg.pkg pkg: Attempted to fetch pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/base_4/Latest/pkg.txz pkg: Error: Not Found A pre-built version of pkg could not be found for your system. Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-2.5.1... Extracting pkg-2.5.1: 0% … Extracting pkg-2.5.1: 100% pkg: not enough arguments Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>] For more information on available commands and options see 'pkg help'. root@bug293516-virtualbox:~ # freebsd-update fetch src component not installed, skipped Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching metadata signature for 14.4-RC1 from update1.freebsd.org... done. Fetching metadata index... done. Fetching 2 metadata patches.. done. Applying metadata patches... done. Fetching 1 metadata files... done. Inspecting system... done. Preparing to download files... done. No updates needed to update system to 14.4-RC1-p0. WARNING: FreeBSD 14.4-RC1 is approaching its End-of-Life date. It is strongly recommended that you upgrade to a newer release within the next 3 weeks. root@bug293516-virtualbox:~ # exit exit Script done on Sun Mar 1 19:19:23 2026
Created attachment 268565 [details] Screenshot: ARM64, freebsd-update fetch before and after bootstrapping pkg Re: comment 9 > Maybe the bug bites only when pkg is not bootstrapped. The bootstrap workaround is also effective on ARM64. freebsd-update fetch: * did work without pkg(8) in 14.3-RELEASE-p9 * did not work without pkg(8) in 14.4-RC1.
Reproducible with FreeBSD-14.4-RELEASE-amd64-disc1.iso No response to: freebsd-update showconfig
Is this only on pkgbase systems?
Re: comment 12 Probably the opposite. As far as I can tell: pkgbase systems are never bugged, because pkg(8) is bootstrapped. ---- Comment 11 may be the best indicator, I was probably too terse. More explicit steps to reproduce, with the fetch command: 1. install, and have an Internet connection 2. make final changes when exiting FreeBSD Installer 3. freebsd-update fetch Alternatively: 1. install 2. restart the OS ("Reboot") after exiting FreeBSD Installer 3. login as root 4. have an Internet connection 5. freebsd-update fetch Either way, nothing happens. With the showconfig command, which shows nothing, an Internet connection is not required :-)
You might very quickly reproduce the issue on a 14.4-RELEASE system that is _not_ bugged: pkg delete -fqy pkg && freebsd-update showconfig Key Control-C, or Control-T, when boredom or curiosity begins …
Ok, there's something weird going on here, because EC2 instances freebsd-update just find when they boot: freebsd-update 1197 - - src component not installed, skipped freebsd-update 1197 - - Looking up aws.update.FreeBSD.org mirrors... 1 mirrors found. freebsd-update 1197 - - Fetching public key from dualstack.aws.update.freebsd.org... done. freebsd-update 1197 - - Fetching metadata signature for 14.4-RELEASE from dualstack.aws.update.freebsd.org... done. freebsd-update 1197 - - Fetching metadata index... done. freebsd-update 1197 - - Fetching 1 metadata files... done. freebsd-update 1197 - - Inspecting system... done. freebsd-update 1197 - - Preparing to download files... done. freebsd-update 1197 - - freebsd-update 1197 - - No updates needed to update system to 14.4-RELEASE-p0.
> EC2 instances Is pkg bootstrapped on those instances?
Oh, actually yes, kind of. It isn't, but it gets installed before freebsd-update runs.
I think this is a bug in freebsd-update *and* another bug in the /usr/sbin/pkg(7) command. When 'freebsd-update' is hanging, it's running 'pkg -r / -N', which has prompted for user input but the prompt has been sent to /dev/null. If you press enter, freebsd-update will continue with the requested operation. I haven't tested the bug on FreeBSD-15.x, but I don't see a fix in Git, so it might occur there also. The freebsd-update bug is that it's passing '-r ${BASEDIR}' to pkg, but this is wrong in a number of ways: * pkg(7) doesn't have an -r flag to the left of the command. There's some discussion of this flag in the commit [1], the review D47341, and review D51770, but no one noticed that -r isn't a replacement for -c (the -c option doesn't exist in 14.4's /usr/sbin/pkg either). * some invocations of pkg(7) take an -r flag to the right of the command, but (a) the -r flag takes a reponame, not a base path, and does something totally different; and (b) the "-N" pseudo-command doesn't take a -r flag anyway. Presumably freebsd-update needs to implement its -b/-j functionality directly using some combination of $LOCALBASE/chroot(8)/jexec(8) in check_pkgbase(). (pkg(7) uses getlocalbase(3) so it'll respond to setting $LOCALBASE.) Alternately, since the only thing that "pkg -N" does is check whether localbase/sbin/pkg is there, I'm not sure that freebsd-update needs to invoke pkg(7) at all... it could just stat the file. You can see the pkg misbehavior(?) by running pkg directly: $ pkg -N pkg: pkg is not installed $ pkg -r / -N The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: I say "(?)" because the pkg(7) manpage doesn't say you can mix -N with any other options, but in my opinion pkg should fail if given a nonsensical set of options, rather than doing something unexpected. The underlying cause here is that the call to getopts_long() on line 1113 [2] stops when it sees the arg of the '-r' flag, so it never sees the -N flag. [1] https://cgit.freebsd.org/src/commit/usr.sbin/freebsd-update/freebsd-update.sh?h=stable/14&id=c9467d0b562c03a10ae358922eec6427bf250d03 [2] https://cgit.freebsd.org/src/tree/usr.sbin/pkg/pkg.c?h=releng/14.4&id=c9467d0b562c03a10ae358922eec6427bf250d03#n1113
Thank you, and I can't tell you how many times I keyed Control-T during the numerous tests, but not once did it occur to me that Return or Enter might work. LOL.