Solved pkg segfaults when 'install'ing a local pkg file

nxjoseph@

Developer
IIRC i could do the same without issues before. It seems you must only use pkg add for .pkg files.

Code:
# pkg install moor-2.9.2.pkg
Updating Poudriere repository catalogue...
Poudriere repository is up to date.
All repositories are up to date.
Child process pid=21113 terminated abnormally: Segmentation fault

# dmesg
pid 21113 (pkg), jid 0, uid 0: exited on signal 11 (core dumped)

# du -shA pkg.core
 50M    pkg.core

# pkg add moor-2.9.2.pkg
Installing moor-2.9.2...
Extracting moor-2.9.2: 100%

# pkg info -x pkg
pkg-2.3.1_1
 
I'd install pkg 2.4.2_1 and try again; as a precaution you could first save your 2.3.1_1 from var/cache/pkg/ /var/cache/pkg/
For some reason portrevision 1 doesn't seem available on quarterly; seems not merged from the ports tree's main; see also PR 290600 - comment #4
 
as a precaution you could first save your 2.3.1_1 from var/cache/pkg/
I don't have that folder but only cups 🤔

Can't i just upgrade pkg to latest version without any backup? I have my own repo, using local ports.

Code:
# pkg repos
Poudriere: {
    url             : "file:///poudriere/data/packages/FreeBSD:14:amd64",
    enabled         : yes,
    priority        : 0
  }
 
Sorry I forgot the beginning "/"; that should have been /var/cache/pkg/
No worries, my brain just fixed that while reading.

Code:
# ls -lahi /var/cache/
total 19
   687 drwxr-xr-x   3 root wheel    3B Oct 30 17:42 .
   384 drwxr-xr-x  25 root wheel   25B Nov 28 01:30 ..
420855 drwxrwx---   3 root cups     3B Oct 30 14:10 cups
 
Oops, I already have the latest version of pkg port pkg file. It seems i had locked pkg itself before but don't remember why i did do it back in time. It didn't get upgraded along with other packages.

I unlocked pkg back, upgraded to latest, tried again and it worked like a charm. Thanks.
 
I unlocked pkg back,
I think it would be helpful to pkg users, for example when using pkg upgrade, that a message list is presented that contains packages that have a newer (remote) version but are not being considered because the installed package is locked. Possibly the list could be presented only by means of a specific command line option. Current behaviour makes it all to easy to just forget about locked packages.
 
You're right.

It got me thinking that why i dont have a pkg cache directory. Didnt check after the update, i went to bed.
 
Rich (BB code):
root@freebsd:/home/yusuf # pkg lock pkg
pkg-2.4.2_1: lock this package? [y/N]: y
Locking pkg-2.4.2_1
root@freebsd:/home/yusuf # exit
yusuf@freebsd:~ % pkg query '%n-%v %k' | awk '{print $1 " " $2}' | grep ".* 1"
pkg-2.4.2_1 1
yusuf@freebsd:~ %

# pkg unlock -y pkg
Unlocking pkg-2.4.2_1
root@freebsd:/home/yusuf # pkg query '%n-%v %k' | awk '{print $1 " " $2}' | grep ".* 1"
root@freebsd:/home/yusuf #

I think we can check if any installed package is locked or not, 0 means not locked, 1 means locked.

pkg-query(8)
Code:
%k  Returns 1 if the matched package is locked against modification or
         deletion, 0 otherwise
 
Yes that's true. Nevertheless, I think it can be helpful as a reminder, when using for example pkg-upgrade(8), to notify the user that there are locked packages not being considered in the upgrade process. That could be anything in the range from the list I mentioned, to a minimal one sentence notice (at the end?), something like:
Note: there are locked package. Locked packages will not be upgraded.

You can use just pkg-query(8) for checking: pkg query -e '%k=1' '%n %v'
 
You can use just pkg-query(8) for checking: pkg query -e '%k=1' '%n %v'
Dang, I forgot I am talking to pkg-query(8) god, sorry. 😅 Yes that's a better command. I didn't read the manpage much.

Nevertheless, I think it can be helpful as a reminder, when using for example pkg-upgrade(8), to notify the user that there are locked packages not being considered in the upgrade process. That could be anything in the range of the list I mentioned, to a minimal one sentence notice (at the end?), something like:
Yes, I totally agree something like that, a feature, would be indeed nice. No need to know these commands or do a research.
 
pkg lock -l should also give you a list of locked packages.
Code:
     -l, --show-locked
          Show a list of all locked packages.  This can be used without
          locking or unlocking any packages, in which case privileged access
          to the package database is not required.  Otherwise it will be
          displayed after any lock or unlock operations.
There's also pkg lock --has-locked-packages but that only responds with a 'true' (rc=0) or 'false' (rc=1), that's useful to use in a script.
 
backtrace from the corefile
Code:
Reading symbols from /usr/sbin/pkg...
(No debugging symbols found in /usr/sbin/pkg)
[New LWP 100901]
Core was generated by `pkg ins moor-2.9.2.pkg'.
Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0  0x0000000828f4ebeb in ?? ()
(gdb) bt
#0  0x0000000828f4ebeb in ?? ()
#1  0x00000000004f9095 in ?? ()
#2  0x0000000823c6603d in ?? ()
#3  0x6a09e667f2bdc948 in ?? ()
#4  0xbb67ae8584caa73b in ?? ()
#5  0x3c6ef372fe94f82b in ?? ()
#6  0xa54ff53a5f1d36f1 in ?? ()
#7  0x510e527fade682d1 in ?? ()
#8  0x9b05688c2b3e6c1f in ?? ()
#9  0x1f83d9abfb41bd6b in ?? ()
#10 0x5be0cd19137e2179 in ?? ()
#11 0x0000000000000000 in ?? ()

The output from gdb looks to me like an alien thing.
 
gdb thinks the dash is a file, so i installed the exact old version of pkg again, tried gdb again and it seems like output is the same.

Code:
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/pkg...
(No debugging symbols found in /usr/sbin/pkg)
[New LWP 100901]
Core was generated by `pkg ins moor-2.9.2.pkg'.
Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0  0x0000000828f4ebeb in ?? ()
(gdb) bt
#0  0x0000000828f4ebeb in ?? ()
#1  0x00000000004f9095 in ?? ()
#2  0x0000000823c6603d in ?? ()
#3  0x6a09e667f2bdc948 in ?? ()
#4  0xbb67ae8584caa73b in ?? ()
#5  0x3c6ef372fe94f82b in ?? ()
#6  0xa54ff53a5f1d36f1 in ?? ()
#7  0x510e527fade682d1 in ?? ()
#8  0x9b05688c2b3e6c1f in ?? ()
#9  0x1f83d9abfb41bd6b in ?? ()
#10 0x5be0cd19137e2179 in ?? ()
#11 0x0000000000000000 in ?? ()

For help, type "help".
Type "apropos word" to search for commands related to "word"...
-: No such file or directory.
[New LWP 100901]
Core was generated by `pkg ins moor-2.9.2.pkg'.
Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0  0x0000000828f4ebeb in ?? ()
(gdb) bt
#0  0x0000000828f4ebeb in ?? ()
#1  0x00000000004f9095 in ?? ()
#2  0x0000000823c6603d in ?? ()
#3  0x6a09e667f2bdc948 in ?? ()
#4  0xbb67ae8584caa73b in ?? ()
#5  0x3c6ef372fe94f82b in ?? ()
#6  0xa54ff53a5f1d36f1 in ?? ()
#7  0x510e527fade682d1 in ?? ()
#8  0x9b05688c2b3e6c1f in ?? ()
#9  0x1f83d9abfb41bd6b in ?? ()
#10 0x5be0cd19137e2179 in ?? ()
#11 0x0000000000000000 in ?? ()
 
Back
Top