pkg: Package database is busy while closing!

Just did a fresh install of FreeBSD 13.2 amd64.
Oddly, I regularly get the message "pkg: Package database is busy while closing!" after installing stuff.
Any idea what I could have done wrong?
Same here, and besides that # pkg autoremove stoped working. It 's hangs there waiting for something.
 
Same here, and besides that # pkg autoremove stoped working. It 's hangs there waiting for something.

Exactly the same as your case, but using pkg-static built from ports solved my problem
Am I correct in the following two statements?
  1. You've built ports-mgmt/pkg/ ( = pkg(8) ) from the head of the ports branche.
  2. After the previous step you've used pkg-static and that worked as expected.

After that build does using pkg and especially pkg autoremove seem to work as expected?
 
Am I correct in the following two statements?
  1. You've built ports-mgmt/pkg/ ( = pkg(8) ) from the head of the ports branche.
  2. After the previous step you've used pkg-static and that worked as expected.

After that build does using pkg and especially pkg autoremove seem to work as expected?
That's exactly what I was trying to say, after that pkg autoremove just work.
 
It might have something to do with these commits:
  1. devel/pkgconf: update to 2.0.2 - from 2023-09-01 13:38:18 +0000
  2. devel/pkgconf: fix regression introduced by last minute patch - from 2023-09-02 17:51:53 +0000

The very recent commit www/pkgconf: update to 2.0.3 from 2023-09-04 07:14:13 +0000 bumps the version number. These changes have to work their way through the package build servers; specifically with regard to ports-mgmt/pkg/

I'm not that knowledgeable about the details (of dependencies) of the ports (head) branche, perhaps someone with more knowledge can confirm or deny?
 
Here the issue disappeared after I had to reboot the system. No idea why.
My work around was delete the packages I want out of the "explicit installed" list, and the dependencies I removed issuing:

Code:
$ pkg query -e '%a = 0' %o | sort > pkg_list.txt
# pkg delete -a
# cat pkg_list.txt | xargs pkg install -y
 
Is it back?

Bash:
....
[87/89] Extracting linux-rl9-curl-7.76.1_5: 100%
[88/89] Installing linux-rl9-alsa-plugins-pulseaudio-1.2.7.1...
[88/89] Extracting linux-rl9-alsa-plugins-pulseaudio-1.2.7.1: 100%
[89/89] Installing linux-chrome-121.0.6167.160_1...
[89/89] Extracting linux-chrome-121.0.6167.160_1: 100%
==> Running trigger: desktop-file-utils.ucl
Building cache database of MIME types
==> Running trigger: gtk-update-icon-cache.ucl
Generating GTK icon cache for /usr/local/share/icons/hicolor
pkg: Package database is busy while closing!
beastie@BattleStar-Lat54 --> ~
Ψ
 
Had this issue again a few days ago, and other strange pkg corruption issues.
Not really rejoicing, but, oh well, there are other viable solutions that aren't appropriate to talk about here.
 
I had the message a few times, maybe ten, since my comment last week.

Yes, I got accustomed to this. However, after it resulted in a bricked system after failing to install a package due to database error, I feel no more safe to use FreeBSD, or even advocate it. Being in the progress to move everything to Debian.
 
Indeed. As a counterpoint to the leitmotif of this thread, I have never encountered this message even once, let alone with any sort of regularity. And mere failure to install a package shouldn't be sufficient to brick a system either.
 
It's happening for me on 14.1-RELEASE-p3, with pkg 1.21.3. I noticed corrupted package installations (pkg check -s reported missing files and bad checksums), and when I attempted to reinstall the packages in question (pkg install -f ...) I had to do it twice -- the first time resulted in the "package database is busy during close", the second time worked, and resolved the checksum/missing file errors.
 
That usually happens to me after a lengthy compilation of a port (think LLVM or GCC).

The make portion completes OK, then I get the same error as others in this thread. So I have to run make install separately. Sometimes that does the trick, sometimes not. When make install fails on me several times, I reboot. Then make install succeeds.

This has me thinking, it could be a semaphore issue - the install process wants to access the pkg database, and finds that the semaphore is still up, so that means that when the pkg database was accessed previously, the semaphore was not checked and put down cleanly after that earlier turn was completed.

Very well could be that make deinstall or pkg remove are part of the issue - but to know for sure, one would need to look at source code, the repo, and related bug ticket situation. I could be incorrect, this is just an educated guess on my end.
 
… failure to install a package shouldn't be sufficient to brick a system …

For clarity – and off-topic from "Package database is busy while closing!":
  • failure to install a port package does not brick an operating system.

… corrupted package installations (pkg check -s reported missing files and bad checksums), …

I can't imagine that corruption as a consequence of "Package database is busy while closing!".
 
I get the message fairly frequently.

A few times a week, maybe.

I rarely paid attention (never noticed any adverse effect), I'll pay closer attention when it next appears.

I continued to not pay close attention, because in each case I had no sense of how to make the issue reproducible.

Today, I found something that might be useful.



bapt@ I added to closed issue 2182.

-d debug output available on request, I can add it here, or there in GitHub, or (if you prefer) in a new issue. Thanks.
 
Back
Top