dch
Developer
Sometimes, pkg gets confused and thinks a process that has long since disappeared, still holds the lock on the package database.
You can "unlock" pkg by removing the pid entry from the package database. Just make sure that
That's clearly not a pkg pid, something is horribly wrong. Let's fix it with sqlite3 power tools:
Code:
$ sudo pkg install -yr FreeBSD net/ipxe
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
process with pid 49 still holds the lock
process with pid 49 still holds the lock
process with pid 49 still holds the lock
process with pid 49 still holds the lock
process with pid 49 still holds the lock
process with pid 49 still holds the lock
pkg: Cannot get an advisory lock on a database, it is locked by another process
You can "unlock" pkg by removing the pid entry from the package database. Just make sure that
ps auxwwd -p <pid>
is long gone:
Code:
# ps auxwwd -p 49
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
dch 49 0.0 0.1 275180 69128 - Ss 10:09 0:01.59 /usr/local/bin/node --no-warnings /usr/home/..index.js
That's clearly not a pkg pid, something is horribly wrong. Let's fix it with sqlite3 power tools:
Code:
root@wintermute /v/d/pkg# pkg shell
SQLite version 3.32.3 2020-06-18 14:00:33
Enter ".help" for usage hints.
sqlite> .database
main: /var/db/pkg/local.sqlite
sqlite> .tables
annotation packages pkg_requires
categories pkg_annotation pkg_script
config_files pkg_categories pkg_shlibs
deps pkg_conflicts pkg_shlibs_provided
directories pkg_directories pkg_shlibs_required
files pkg_groups pkg_users
groups pkg_licenses provides
licenses pkg_lock requires
lua_script pkg_lock_pid script
...
sqlite> select * from pkg_lock_pid;
49
sqlite> delete from pkg_lock_pid where pid=49;
sqlite> .q