pkg
pkg copied to clipboard
pkg does not confirm that the process holding the lock is another instance of pkg
pkg version 1.9.4 on FreeBSD 11.0-RELEASE-p8
pkg database appears to pkg to be locked by a g_eli kernel thread due to pid reuse after a reboot.
(ee95ca16)[root@mtumishi /var/db/pkg]$ pkg check -d
process with pid 2570 still holds the lock
process with pid 2570 still holds the lock
process with pid 2570 still holds the lock
process with pid 2570 still holds the lock
process with pid 2570 still holds the lock
process with pid 2570 still holds the lock
pkg: Cannot get an advisory lock on a database, it is locked by another process
(ee95ca16)[root@mtumishi /var/db/pkg]$ ps -p 2570
PID TT STAT TIME COMMAND
2570 - DL 0:06.16 [g_eli[11] label/zp/]
Fixed by removing the errant pid from the table pkg_lock_pid in database /var/db/pkg/local.sqlite .
here's a few more steps for the next person trying to find out how to solve this problem https://forums.freebsd.org/threads/process-with-pid-49-still-holds-the-lock.79543/ to make this easier to find in future. I believe pkg clean may also fix this now, if so, let me know and I'll update the forum post. Interestingly, in my case, I had a wrap-around-pid with the same id, so that didn't work.