Note that you have to run dpkg as root. Run as normal user, dpkg cannot locak its lock file and error with error "2" (as it cannot lock its lock file).
The libdvd-pkg script runs as root so if dpkg returns "2" in its script then it means another program is holding the dpkg lock file. Could you check if this bug is fixed? It looks to me that if dpkg returns error "2" on success then it had a bug. It might well have been fixed since then. Else you might have had the dpkg lock held even after dpkg complete (I don' know if this is possible). Thus dpkg itself would return error 2 because it cannot run as the its lock is held. This would also not be a bug in libdvd-pkg bug a local leftover form a crash which is not in libdvd-pkg scope to fix. Could you close this bug report if the issue is no more on your system? Cheers, Alban On Sat, 05 Feb 2022 18:58:09 +0100 Martin Strauss <mar...@clan-strauss.de> wrote: > Package: libdvd-pkg > Version: 1.4.2-1-1 > Severity: important > X-Debbugs-Cc: mar...@clan-strauss.de > > Dear Maintainer, > > I upgraded from debian buster to bullseye. Afterwards libdvd-pkg reported the > following error: > > libdvd-pkg: dpkg database is locked. You may need to use command "sudo dpkg- > reconfigure libdvd-pkg". > libdvd-pkg: Building and installation of package(s) [libdvdcss2 libdvdcss-dev] > postponed till after next APT operation. > > This repeats for each "apt update". I spotted the same message on two different > computers, guess more people might be affected. > The package should download libdvdcss2 build and install it, which it doesn't > because of the failed check. > > I tried the proposed "dpkg-reconfigure libdvd-pkg" which just produces the same > message. After some internet search I found the debian bug report #824093. > There someone reported that the check had been broken and provided a patch. > The patch is applied in the current version, however it seems that > the check for the lock is once again broken. > > Basiclly it boils down to the following lines in the script: > /usr/lib/libdvd-pkg/b-i_libdvdcss.sh line 20 > > dpkg -P non-existent-package 2>/dev/null > if [ "$?" -eq 2 ]; then > > It seems the with dpkg in version 1.20.9 the return code is always 2 > independent of whether a package manager like aptitude is running or not. > Same is true for "dpkg -i /dev/zero" which was the previous version. > I checked this on the command line, the return code does not reflect > the lock status. > No idea how to fix this, the returned message is translated, so no good > to use that one. Maybe there is an official way how to do it, searching the > internet didn't help there. Maybe ask the dpkg maintainer? > > -- System Information: > Debian Release: 11.2 > APT prefers stable-updates > APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, > 'stable') > Architecture: amd64 (x86_64) > > Kernel: Linux 5.10.0-11-amd64 (SMP w/4 CPU threads) > Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), LANGUAGE not set > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) > LSM: AppArmor: enabled > > Versions of packages libdvd-pkg depends on: > ii build-essential 12.9 > ii debconf [debconf-2.0] 1.5.77 > ii debhelper 13.3.4 > ii dh-autoreconf 20 > ii wget 1.21-1+deb11u1