pkg icon indicating copy to clipboard operation
pkg copied to clipboard

'pkg upgrade -n' crashes if one package is locked

Open rbgarga opened this issue 8 years ago • 8 comments

pfSense 2.3.1 uses 2016Q2 based package repository pfSense 2.3.2 uses 2016Q3 based package repository

During an upgrade from 2.3.1 to 2.3.2, what is done in 3 different stages that I'll describe later we got a pkg crash and ended up with system not being completely upgraded.

First stage consists in:

  • Upgrade pkg itself
  • Download all packages that are going to be upgraded (pkg upgrade -F)
  • unlock pfSense-kernel-pfSense package
  • Upgrade pfSense-rc and pfSense-kernel-pfSense packages
  • Add an annotation on pfSense-kernel-pfSense (next_stage = 2)
  • lock pfSense-kernel-pfSense
  • Reboot

Second stage:

  • Verify if pfSense-kernel-pfSense has next_stage annotation set to 2
  • Verify if there is anything to be upgraded using 'pkg upgrade -nq'

This is exactly where the error happens:

Assertion failed: (cun != NULL), function pkg_conflicts_check_chain_conflict, file pkg_jobs_conflicts.c, line 500.
Child process pid=57245 terminated abnormally: Abort trap
>>> Upgrading necessary packages...
Checking for upgrades (68 candidates): .......... done
Processing candidates (68 candidates): ......

pfSense-kernel-pfSense-2.3.2.a.20160717.2316 is locked and may not be modified
Processing candidates (68 candidates)...

pfSense-kernel-pfSense-2.3.2.a.20160717.2316 is locked and may not be modified
Processing candidates (68 candidates)....... done
Checking integrity...
pfSense-kernel-pfSense-2.3.2.a.20160717.2316 is locked and may not be modified
Assertion failed: (cun != NULL), function pkg_conflicts_check_chain_conflict, file pkg_jobs_conflicts.c, line 500.
Child process pid=58782 terminated abnormally: Abort trap

rbgarga avatar Jul 18 '16 16:07 rbgarga

I found, with debug 4, the following message:

DBG(4)[7449]> integrity: check path /usr/local/share/licenses/pfSense-kernel-debug-pfSense-2.3.2.a.20160717.2316/catalog.mk of package pfSense-kernel-debug-pfSense

That is from the moment problem happens. There is a package called pfSense-kernel-debug-pfSense, which contains debug symbols for pfSense-kernel-pfSense, and, depends of pfSense-kernel-pfSense being installed. The crash only occours when debug package is installed.

So the necessary items to reproduce it are:

  • Package A depends of package B
  • Both packages A and B are installed
  • Package B is locked
  • Package A has a new version

rbgarga avatar Jul 18 '16 18:07 rbgarga

Other way I could reproduce was when I tried to install pfSense-kernel-debug-pfSense and got:

[2.3.2-DEVELOPMENT][[email protected]]/root: pkg install pfSense-kernel-debug-pfSense-2.3.2.a.20160717.2316
Updating pfSense-core repository catalogue...
pfSense-core repository is up-to-date.
Updating pfSense repository catalogue...
pfSense repository is up-to-date.
All repositories are up-to-date.

pfSense-kernel-pfSense-2.3.2.a.20160717.2316 is locked and may not be modified
Checking integrity...
pfSense-kernel-pfSense-2.3.2.a.20160717.2316 is locked and may not be modified
Assertion failed: (cun != NULL), function pkg_conflicts_check_chain_conflict, file pkg_jobs_conflicts.c, line 500.
Child process pid=78415 terminated abnormally: Abort trap

rbgarga avatar Jul 18 '16 18:07 rbgarga

I found the root cause of this issue and it is an error here when we created pfSense-kernel-pfSense package that contain leftovers from pfSense-kernel-debug-pfSense (license files). Because of that this error happened. I'm leaving the issue opened here because I'm not sure pkg should crash in this case.

rbgarga avatar Jul 18 '16 19:07 rbgarga

Got the same error when running pkg install -y py27-MySQLdb56 with the following packages locked:

mysql56-client-5.6.33
mysql56-server-5.6.33

Output from pkg install -y py27-MySQLdb56

$ pkg install -y py27-MySQLdb56

Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.

mysql56-server-5.6.33 is locked and may not be modified

mysql56-client-5.6.33 is locked and may not be modified

mysql56-client-5.6.33 is locked and may not be modified

mysql56-client-5.6.33 is locked and may not be modified

mysql56-client-5.6.33 is locked and may not be modified

mysql56-client-5.6.33 is locked and may not be modified
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    py27-MySQLdb56: 1.2.5
    py27-setuptools27: 23.1.0
    python2: 2_3
    mariadb101-client: 10.1.17

Number of packages to be installed: 4

The process will require 39 MiB more space.
2 MiB to be downloaded.
Fetching py27-MySQLdb56-1.2.5.txz: 100%   85 KiB  86.5kB/s    00:01
Fetching py27-setuptools27-23.1.0.txz: 100%  305 KiB 311.9kB/s    00:01
Fetching python2-2_3.txz: 100%    1 KiB   1.1kB/s    00:01
Fetching mariadb101-client-10.1.17.txz: 100%    1 MiB   1.5MB/s    00:01
Checking integrity...
mysql56-client-5.6.33 is locked and may not be modified
Assertion failed: (cun != NULL), function pkg_conflicts_check_chain_conflict, file pkg_jobs_conflicts.c, line 500.
Child process pid=1211 terminated abnormally: Abort trap

Steps to reproduce:

$ pkg install -y mysql56-server mysql56-client
$ pkg lock -y mysql56-server
$ pkg lock -y mysql56-client
$ pkg install -y py27-MySQLdb56
  # ... boom!

(pkg version: 1.8.7)


I also got the same error when running pkg upgrade -y with the following packages locked:

mysql56-server-5.6.30
mysql56-client-5.6.30

Locking py27-MySQLdb56-1.2.5 solved the issue and I was able to run pkg upgrade -y without error. However, I was not able to reproduce this issue.

roback avatar Oct 13 '16 07:10 roback

I have the same error when installing new packages with nvidia-driver and redshift locked:

All repositories are up to date.

[30 instances of:]
nvidia-driver-367.44 is locked and may not be modified

redshift-1.7_1 is locked and may not be modified
Checking integrity...
nvidia-driver-367.44 is locked and may not be modified
Assertion failed: (cun != NULL), function pkg_conflicts_check_chain_conflict, file pkg_jobs_conflicts.c, line 481.
Child process pid=44870 terminated abnormally: Abort trap

trombonehero avatar Mar 07 '17 16:03 trombonehero

This also happens with local packages from file:

# ls glib-2.66.7,1.txz 
glib-2.66.7,1.txz
# pkg lock glib
glib-2.66.7,1: lock this package? [y/N]: y
Locking glib-2.66.7,1
# pkg install glib-2.66.7,1.txz
Updating local repository catalogue...
local repository is up to date.
All repositories are up to date.
Child process pid=13021 terminated abnormally: Segmentation fault
#

gahr avatar Feb 16 '21 09:02 gahr

pkg gets into an infinite recursion:

#0  pkg_jobs_universe_process_deps (universe=0x8016a9020, pkg=0x800faf200, flags=0) at pkg_jobs_universe.c:239
#1  0x00000000004c275a in pkg_jobs_universe_process_item (universe=0x8016a9020, pkg=0x800faf200, result=0x7fffffffdd50) at pkg_jobs_universe.c:615
#2  0x00000000004c3075 in pkg_jobs_universe_process_deps (universe=0x8016a9020, pkg=0x800fae400, flags=2) at pkg_jobs_universe.c:294
#3  0x00000000004c2787 in pkg_jobs_universe_process_item (universe=0x8016a9020, pkg=0x800fae400, result=0x7fffffffde60) at pkg_jobs_universe.c:619
#4  0x00000000004c3075 in pkg_jobs_universe_process_deps (universe=0x8016a9020, pkg=0x800fad600, flags=0) at pkg_jobs_universe.c:294
#5  0x00000000004c275a in pkg_jobs_universe_process_item (universe=0x8016a9020, pkg=0x800fad600, result=0x7fffffffdf70) at pkg_jobs_universe.c:615
#6  0x00000000004c3075 in pkg_jobs_universe_process_deps (universe=0x8016a9020, pkg=0x800facf00, flags=0) at pkg_jobs_universe.c:294
#7  0x00000000004c275a in pkg_jobs_universe_process_item (universe=0x8016a9020, pkg=0x800facf00, result=0x0) at pkg_jobs_universe.c:615
#8  0x00000000004c4171 in pkg_jobs_universe_process (universe=0x8016a9020, pkg=0x800facf00) at pkg_jobs_universe.c:649
#9  0x00000000004e3560 in jobs_solve_partial_upgrade (j=0x8016b1e80) at pkg_jobs.c:1652
#10 0x00000000004dd9d7 in jobs_solve_install_upgrade (j=0x8016b1e80) at pkg_jobs.c:1686
#11 0x00000000004dd30c in pkg_jobs_solve (j=0x8016b1e80) at pkg_jobs.c:1912
#12 0x00000000002b723d in exec_install (argc=1, argv=0x7fffffffeae8) at install.c:222
#13 0x00000000002b88fb in main (argc=2, argv=0x7fffffffeae0) at main.c:885

gahr avatar Feb 16 '21 10:02 gahr

Here's the debug output: https://people.freebsd.org/~gahr/pkg-issue-1454.txt

gahr avatar Feb 16 '21 10:02 gahr