see https://forums.freebsd.org/threads/pkg-version-v-segfaults-wrong-option.64768/ # pkg upgrade -v 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. vulnxml file up-to-date Child process pid=53420 terminated abnormally: Segmentation fault "-v" is a non-existing option. But it should not segfault.
What version of pkg? I am not able to reproduce it after trying 5 times.. Though what I see is strange too.
pkg -v 1.10.5 It happens not every times, but most tries. I tried it on 10.4, the user in the forum on 11.1. pkg upgrade -v Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. vulnxml file up-to-date Checking for upgrades (508 candidates): 30%Child process pid=87231 terminated abnormally: Segmentation fault When fault, on the "same place": 30%
Original forum user here, for me this is 100% reproducible (tried at least 20 times), pkg version is 1.10.5, FreeBSD is 11.1, pkg (and other packages) were build with poudriere on a different machine (also 11.1). So to investigate further I installed the pkg package on the build machine, (same package and /usr/local/sbin/pkg as on production machine) but could not reproduce it at all (tried 10 times). FWIW the build box runs on VirtualBox, the prod on Xen.
Could one of you run it under ktrace to see what it might be doing that is failing?
Created attachment 190861 [details] ktrace.txt
Created attachment 190862 [details] ktrace pkg upgrade -v; dump > kdump > ktrace.txt
Similar error in pkg-provides: pkg provides firefox ... .. "expected normal output" .... ... Child process pid=20622 terminated abnormally: Segmentation fault segfaults at exit.
Maybe, caused by the sysctl(mibs,.....) command used in both sources?
I have no clue about what can cause this issue but maybe you can comment the plugins options in /usr/local/etc/pkg.conf comment the following line : PLUGINS [ provides ] Now you can perform a pkg plugins and see if provides still available and try again the commands who segfault. Maybe the problem is in my side :/
No. I think (but I am not sure) both is the same error.
Created attachment 190868 [details] ktrace-provides.txt
@w.schwarzenfeld You should use the -i flag for ktrace if you want to have the child process errors
O..o it seems I have a corrupted local.sqlite database... peter@ would you also look with ktrace -i? If you have the same problem, it is no bug.
Strange: restored database pkg update -v works now without problems. pkg provides segfaults still.
@w.schwarzenfeld: I'm really interested by : The output of `pkg plugins` and a `ktrace -i pkg provides firefox` Cheers
Reassign to pkg provides author.
Rodrigo, sorry for the noise: It is also my database (something there is weird). If peter confirm similar we can close here.
Created attachment 190887 [details] last 100 lines of ktrace -i pkg upgrade -v looked at the ktrace -i pkg upgrade -v, but can not see any errors regarding the sqlite dbs. Both (FreeBSD and local repos) are loaded multiple times during the run. PID 42347 is the process that receives a SIGSEGV, relevant? lines: 42347 pkg RET pread 4096/0x1000 42347 pkg CALL fcntl(0x9,F_SETLK,0x7fffffffd0e0) 42347 pkg RET fcntl 0 42347 pkg CALL fcntl(0x8,F_SETLK,0x7fffffffd1a0) 42347 pkg RET fcntl 0 42347 pkg CALL fcntl(0x9,F_SETLK,0x7fffffffd1a8) 42347 pkg RET fcntl 0 42347 pkg CALL fcntl(0x9,F_SETLK,0x7fffffffd1a8) 42347 pkg RET fcntl 0 42347 pkg CALL fcntl(0x9,F_SETLK,0x7fffffffd1a8) 42347 pkg RET fcntl 0 42347 pkg CALL fstatat(0x4,0x80325c473,0x7fffffffd170,0) 42347 pkg NAMI "repo-local.sqlite-journal" 42347 pkg RET fstatat -1 errno 2 No such file or directory 42347 pkg CALL fstat(0x9,0x7fffffffd168) 42347 pkg STRU struct stat {dev=88, ino=66657, mode=0100644, nlink=1, uid=0, gid=0, rdev=142048, atime=1519290643.805810000, mtime=1519125470, ctime=1519128151.489226000, birthtime=1519125470, size=409600, blksiz e=32768, blocks=896, flags=0x0 } 42347 pkg RET fstat 0 42347 pkg CALL pread(0x9,0x7fffffffd220,0x10,0x18) 42347 pkg GIO fd 9 read 16 bytes 0x0000 0000 001b 0000 0064 0000 002d 0000 0001 |.......d...-....| 42347 pkg RET pread 16/0x10 42347 pkg CALL fstat(0x9,0x7fffffffd168) 42347 pkg STRU struct stat {dev=88, ino=66657, mode=0100644, nlink=1, uid=0, gid=0, rdev=142048, atime=1519290643.805824000, mtime=1519125470, ctime=1519128151.489226000, birthtime=1519125470, size=409600, blksiz e=32768, blocks=896, flags=0x0 } 42347 pkg RET fstat 0 42347 pkg CALL fstatat(0x4,0x80325c499,0x7fffffffd170,0) 42347 pkg NAMI "repo-local.sqlite-wal" 42347 pkg RET fstatat -1 errno 2 No such file or directory 42347 pkg CALL fstat(0x9,0x7fffffffd168) 42347 pkg STRU struct stat {dev=88, ino=66657, mode=0100644, nlink=1, uid=0, gid=0, rdev=142048, atime=1519290643.805824000, mtime=1519125470, ctime=1519128151.489226000, birthtime=1519125470, size=409600, blksiz e=32768, blocks=896, flags=0x0 } 42347 pkg RET fstat 0 42347 pkg PSIG SIGSEGV SIG_DFL code=SEGV_MAPERR 42347 pkg NAMI "pkg.core" 42346 pkg RET wait4 42347/0xa56b I can provide the full output ktrace.out (1.4MB) if necessary.
same here, here is a debug trace: (gdb) where #0 0x000000080085236b in pkg_jobs_process_remote_pkg (j=0x801b62600, rp=0x801adaa00, req=0x0, with_version=0) at pkg_jobs.c:768 #1 0x000000080085081d in pkg_jobs_find_upgrade (j=0x801b62600, pattern=0x800a02c60 "pkg", m=MATCH_EXACT) at pkg_jobs.c:933 #2 0x000000080085058a in new_pkg_version (j=0x801b62600) at pkg_jobs.c:705 #3 0x000000080084aab5 in jobs_solve_install_upgrade (j=0x801b62600) at pkg_jobs.c:1558 #4 0x000000080084a1d0 in pkg_jobs_solve (j=0x801b62600) at pkg_jobs.c:1760 #5 0x000000000041fb41 in exec_upgrade (argc=0, argv=0x7fffffffea68) at upgrade.c:403 #6 0x000000000041648e in main (argc=2, argv=0x7fffffffea58) at main.c:887 (gdb) bt full #0 0x000000080085236b in pkg_jobs_process_remote_pkg (j=0x801b62600, rp=0x801adaa00, req=0x0, with_version=0) at pkg_jobs.c:768 nit = 0x8007e6880 cur = 0x0 nrit = 0x0 lp = 0x801ad9c00 rdep = 0x0 #1 0x000000080085081d in pkg_jobs_find_upgrade (j=0x801b62600, pattern=0x800a02c60 "pkg", m=MATCH_EXACT) at pkg_jobs.c:933 p = 0x801adaa00 it = 0x801b64150 found = false rc = 5 with_version = 0 rdep = 0x0 flags = 64529 unit = 0x0 #2 0x000000080085058a in new_pkg_version (j=0x801b62600) at pkg_jobs.c:705 p = 0x801ad8e00 uid = 0x800a02c60 "pkg" old_flags = (PKG_FLAG_PKG_VERSION_TEST | PKG_FLAG_UPGRADE_VULNERABLE) ret = false nit = 0x30 cit = 0x800a097e0 <pkgdb_begin_solver.solver_sql> #3 0x000000080084aab5 in jobs_solve_install_upgrade (j=0x801b62600) at pkg_jobs.c:1558 pkg = 0x0 it = 0x7fffffffdf40 sqlbuf = "\200A\266\001\b\000\000\000\b\020\242\001\b\000\000\000\310\347\316\001\b\000\000\000p\352\377\377\000\000\000\000+\253D^\230\024\262\233P\352\377\377\377\177\000\000H\352\377\377\377\177", '\000' <repeats 34 times>, "\340\227\240\000\b\000\000\000+\253D^\230\024\262\233P\352\377\377\377\177\000\000H\352\377\377\377\177\000\000\000\000\000\000\000\000\000\000\003\000\000\000\000\000\000\000p\352\377\377\377\177\000\000\000\340\377\377\377\177\000\000Q\202\211\000\b\000\000\000\300\337\377\377\377\177\000\000\034\226:\001\b\000\000\000@\241\204\000\b\000\000\000\000\216c\000\000\000\000\000\000\360e\000\b", '\000' <repeats 19 times>... jcount = 0 jp = 0x7fffffffdee0 req = 0x801cee7c8 rtmp = 0x801a21008 flags = 46097 candidates = 0xfffffffffffffd70 c = 0x801b64180 retcode = 0 #4 0x000000080084a1d0 in pkg_jobs_solve (j=0x801b62600) at pkg_jobs.c:1760 ret = 0 pstatus = 514 problem = 0x0 job = 0x0 solver = 0x0 dotfile = 0x0 spipe = {0x0, 0xffffffffffffffc8} dot = 0x0 pchild = 0 #5 0x000000000041fb41 in exec_upgrade (argc=0, argv=0x7fffffffea68) at upgrade.c:403 db = 0x801a17b00 jobs = 0x801b62600 reponame = 0x0 retcode = 70 updcode = 0 ch = -1 lock_type = 1 match = MATCH_EXACT done = 0 rc = true f = (PKG_FLAG_PKG_VERSION_TEST | PKG_FLAG_UPGRADE_VULNERABLE) longopts = {{name = 0x42c515 "case-sensitive", has_arg = 0, flag = 0x0, val = 67}, {name = 0x42b1f4 "force", has_arg = 0, flag = 0x0, val = 102}, {name = 0x42f2b6 "fetch-only", has_arg = 0, flag = 0x0, val = 70}, {name = 0x42b923 "glob", has_arg = 0, flag = 0x0, val = 103}, {name = 0x42b90b "case-insensitive", has_arg = 0, flag = 0x0, val = 105}, { name = 0x42f2c1 "no-install-scripts", has_arg = 0, flag = 0x0, val = 73}, {name = 0x42bef0 "dry-run", has_arg = 0, flag = 0x0, val = 110}, {name = 0x42b209 "quiet", has_arg = 0, flag = 0x0, val = 113}, {name = 0x430630 "repository", has_arg = 1, flag = 0x0, val = 114}, {name = 0x42e383 "no-repo-update", has_arg = 0, flag = 0x0, val = 85}, {name = 0x42b934 "regex", has_arg = 0, flag = 0x0, val = 120}, {name = 0x42b93a "yes", has_arg = 0, flag = 0x0, val = 121}, {name = 0x434bb9 "vulnerable", has_arg = 0, flag = 0x0, val = 118}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}} #6 0x000000000041648e in main (argc=2, argv=0x7fffffffea58) at main.c:887 i = 32 command = 0x6393a0 <cmd+1024> ambiguous = 0 chroot_path = 0x0 rootdir = 0x0 jid = 0 jail_str = 0x0 len = 7 ch = -1 '\377' debug = 0 version = 0 ret = 0 plugins_enabled = true plugin_found = false show_commands = false activation_test = false init_flags = (unknown: 0) c = 0x0 conffile = 0x0 reposdir = 0x0 save_argv = 0x7fffffffea58 realrootdir = "\000\000\000\000\000\000\000\000\070\350\377\377\377\177\000\000\000\000\000\000\000\000\000\000`\331e\000\b\000\000\000\300\346\377\377\377\177\000\000[\235d\000\b", '\000' <repeats 19 times>, "o0@\000\000\000\000\000\004\317\212\006\000\000\000\000\364\362\217\362\000\000\000\000H\000f\000\b\000\000\000\001\000\000\000\000\000\000\000\000\200f\000\b\000\000\000\270h\373\000\b\000\000\000\370\350\377\377\377\177\000\000o0@\000\000\000\000\000\004\317\212\006\000\000\000\000H\000f\000\b\000\000\000\370\350\377\377\377\177\000\000\364\362\217\362\001\000\000\000\320\346\377\377\377\177\000\000\000\360e\000\b\000\000\000G\000\000\000\000\000\000\000\000\360e\000\b\000\000\000"... j = 0 longopts = {{name = 0x42faf0 "debug", has_arg = 0, flag = 0x0, val = 100}, {name = 0x42faf6 "jail", has_arg = 1, flag = 0x0, val = 106}, {name = 0x42fafb "chroot", has_arg = 1, flag = 0x0, val = 99}, { name = 0x42fb02 "config", has_arg = 1, flag = 0x0, val = 67}, {name = 0x42fb09 "repo-conf-dir", has_arg = 1, flag = 0x0, val = 82}, {name = 0x42fbf2 "rootdir", has_arg = 1, flag = 0x0, val = 114}, {name = 0x42cc98 "list", has_arg = 0, flag = 0x0, val = 108}, {name = 0x430034 "version", has_arg = 0, flag = 0x0, val = 118}, {name = 0x432376 "option", has_arg = 1, flag = 0x0, val = 111}, { name = 0x42fb17 "only-ipv4", has_arg = 0, flag = 0x0, val = 52}, {name = 0x42fb21 "only-ipv6", has_arg = 0, flag = 0x0, val = 54}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
peter@ your kdump look like mine, consider your database is also corrupt. I had also repo-* and this files does not exist on my system. Except the files exists on your system. mikael's looks complete different.
(In reply to w.schwarzenfeld from comment #20) @w.schwarzenfeld, could you please provide more information how to check/fix the sqlite dbs? I installed the sqlite3 package and it could open all .sqlite files under /var/db/pkg without any errors.
mikael.urankar@ can you also provide a kdump from ktrace -i pkg upgrade -v ? So we can compare?
If I set in pkg.conf DEBUG_LEVEL greater 0 pkg provide does not segfault.
The issue seems to be caused by a corrupted database. Unable to reproduce in any configuration with or without a fresh FreeBSd install
This is https://github.com/freebsd/pkg/issues/1842