[Bug 289414] [PkgBase] pkg upgrade without further arguments breaks the system on upgrades

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 09 Sep 2025 15:43:47 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289414

            Bug ID: 289414
           Summary: [PkgBase] pkg upgrade without further arguments breaks
                    the system on upgrades
           Product: Base System
           Version: 14.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: crest@rlwinm.de

I installed FreeBSD 14.3/amd64 on little Atom board with 4GB RAM and 32GB eMMC
flash and converted it to PkgBase before the release of any patches for FreeBSD
14.3. When I tried to upgrade the system using `pkg upgrade` it broke the
system in multiple ways.

As usual pkg uninstalled packages to install the new versions, but because the
packages from ports don't properly declare their dependencies on base packages
pkg did not (re)install the base system before installing other packages. With
most of the base system uninstalled the other packages didn't correctly install
because their hook scripts failed.

To make matters worse the otherwise nearly idle system ran out of memory (4GB
RAM + 2GB swap) during the installation of FreeBSD-src. At that point during
the upgrade neither libc nor the runtime loader had be installed leaving me
with only statically linked binaries to recover.

To repair the system I prepended /rescue to my $PATH and used pkg-static to
reinstall all base packages. Since not pkg-static was unable to infer the ABI
and OSVERSION used in the repository configurations I had to pass those
manually: `pkg-static -o ABI=FreeBSD:14:amd64 -o OSVERSION=1403000 install -r
FreeBSD-base -y -g '*'`

If anyone else runs into this on a different release the $OSVERSION of the
kernel can be extracted with `/rescue/sysctl kern.osreldate`.

I also lost the list of packages I previously installed, but that could be
reconstructed from /var/log/messages.

This is a massive footgun that will hit many users once package base becomes
the default way to update the base system. Also I have no idea why pkg upgrade
ran out of memory. It feels ridicous that 6GB of RAM aren't enough to update
the system without special workarounds.

-- 
You are receiving this mail because:
You are the assignee for the bug.