Upgrade packages in chroot

I'm trying to upgrade 11.3 to 12.1 using boot environments.
I created a new BE, mounted it as /upgrade121, and successfully upgraded the system in the new BE.
Now I'm trying to upgrade packages.
I could bootstrap pkg using
Code:
% chroot /upgrade121 pkg bootstrap -f
Then I could update the packages using
Code:
% chroot /upgrade121 /usr/sbin/pkg update -q
But when I try to upgrade all packages I got the error:
Code:
% chroot /upgrade121 /usr/sbin/pkg upgrade -fy
...
Checking integrity...Assertion failed: (strcmp(uid, p->uid) != 0), function pkg_conflicts_check_local_path, file pkg_jobs_conflicts.c, line 386.
Child process pid=79248 terminated abnormally: Abort trap
How can I finish the upgrade?
 
I'm trying to upgrade 11.3 to 12.1 using boot environments.
I created a new BE, mounted it as /upgrade121, and successfully upgraded the system in the new BE.
Now I'm trying to upgrade packages.
I could bootstrap pkg using
Code:
% chroot /upgrade121 pkg bootstrap -f
Then I could update the packages using
Code:
% chroot /upgrade121 /usr/sbin/pkg update -q
But when I try to upgrade all packages I got the error:
Code:
% chroot /upgrade121 /usr/sbin/pkg upgrade -fy
...
Checking integrity...Assertion failed: (strcmp(uid, p->uid) != 0), function pkg_conflicts_check_local_path, file pkg_jobs_conflicts.c, line 386.
Child process pid=79248 terminated abnormally: Abort trap
How can I finish the upgrade?
I don't understand what you are doing. If you already use BE, why don't just activate the new BE and reboot into it? If something goes wrong, you could choose to boot to the previous BE at boot. The FreeBSD boot loader supports it. Why have to go through all of this troubles?
 
pkg(8) supports -c <chroot path> command-line option; try with pkg -c /upgrade121 update and/or pkg -c /upgrade121 upgrade -fy.
Thanks for this advise. I tried this option before (some months ago), it did not work correctly for major upgrade. Maybe it works better now, I cannot test anymore - after some digging I could finish my upgrade removing 'f' option from the command. It seems that this problem is not related to chroot, but to the fact that I have some packages with modified files (for example, I replaced some binaries by my own versions), so they don't pass integrity checks. I don't understand the reason of blocking upgrade in this case when 'f' option is specified. There is a bug open about it https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223751
 
[...] It seems that this problem is not related to chroot, but to the fact that I have some packages with modified files (for example, I replaced some binaries by my own versions), so they don't pass integrity checks.
If you want to change port knobs or run patched ports, it is better not to use packages, but install from ports (via ports-mgmt/poudriere or ports-mgmt/synth). 1st patch the port's source, then build & install the package you built yourself. Then the package manager does not get confused by your changes.
 
From the man page of pkg(8):
pkg check -r or pkg check --recompute recalculates and sets the checksums
of installed packages. This command should only be used when the
administrator has made modifications that invalidate a package checksum.
Spontaneous checksum problems can indicate data or security problems.
 
… new BE, mounted … and successfully upgraded the system in the new BE.

At that point, you might have found (in the mounted environment) a mismatch between the installed kernel and the running kernel.

freebsd-version -kru

freebsd-version(1)

Now I'm trying to upgrade packages. …

I can't comment on what you found in August 2020 but for future reference, I guess that it's appropriate to specify an ABI.

Ignoring (for a moment) the PkgBase context, see for example <https://lists.freebsd.org/pipermail/freebsd-current/2018-November/072000.html>.

Also, food for thought:

env IGNORE_OSVERSION=yes pkg bootstrap -f

… activate the new BE and reboot into it …

True, however it'll be nice when things can become more streamlined (without the need for multiple reboots) …

 
Back
Top