freebsd / pkg

Package management tool for FreeBSD. Help at #pkg on Libera Chat or pkg@FreeBSD.org
Other
753 stars 281 forks source link

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

Open rbgarga opened 8 years ago

rbgarga commented 8 years ago

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:

Second stage:

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 commented 8 years ago

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:

rbgarga commented 8 years ago

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

[2.3.2-DEVELOPMENT][root@pfgarga.home]/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 commented 8 years ago

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.

roback commented 8 years ago

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.

trombonehero commented 7 years ago

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
gahr commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

grahamperrin commented 4 weeks ago

Reproducible with pkg 1.21.3?

gahr commented 4 weeks ago

It fails in a different way with 1.21.3:

# ls glib-2.80.5,2.pkg 
glib-2.80.5,2.pkg
# pkg lock glib
glib-2.80.5,2: lock this package? [y/N]: y
Locking glib-2.80.5,2
# pkg install glib-2.80.5,2.pkg 
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating local repository catalogue...
local repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        glib-2.80.5,2 [unknown-repository]

Number of packages to be reinstalled: 1

Proceed with this action? [y/N]: y
pkg: archive_read_open_filename((null)): Failed to open '(null)'
grahamperrin commented 2 weeks ago

a different way

I don't see upgrade -n there …

gahr commented 2 weeks ago

Yeah, see https://github.com/freebsd/pkg/issues/1454#issuecomment-779698921

If you don't think it's related, I can open a different issue.