Univention Bugzilla – Bug 43625
Update to UCS 4.2 interim-1 (+x) aborts: dpkg : status database locked
Last modified: 2017-04-04 18:28:14 CEST
My latest attempt of an update to UCS 4.2 interim-1 (+x) aborts with dpkg : status database area is locked by another process =========================================================================== Vorbereitung zum Entpacken von .../ncurses-base_5.9+20140913-1_all.deb ... Entpacken von ncurses-base (5.9+20140913-1) über (5.9-10.17.201403180024) ... ncurses-base (5.9+20140913-1) wird eingerichtet ... dpkg: Fehler: dpkg-Status-Datenbank ist von einem anderen Prozess gesperrt none Checking for app updates: E: Sub-process /usr/bin/dpkg returned an error code (2) Error: Failed to execute "apt-get -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-overwrite -o DPkg::Options::=--force-overwrite-dir --trivial-only=no --assume-yes --quiet=1 -u dist-upgrade" =========================================================================== I updated from repository/online/server='http://updates-test.software-univention.de'
Created attachment 8453 [details] updater.log
One potential culprit could be this cron job: /etc/cron.d/univention-updater-check calls /usr/share/univention-updater/univention-updater-check, which calls univention-upgrade --check --setucr. I've adjusted univention-upgrade to aquire an UpdaterLock also for --check, but I doubt that that fixes the issue.
I guess that's it. I've checked it the other way around: I've manually locked the status file by python -c 'import apt_pkg; fd = apt_pkg.get_lock("/var/lib/dpkg/lock"); raw_input("hit return to unlock")' When I run apt-get update in this situation, it returns the dreaded "is locked by another process" error. Out univention-upgrade script doesn't setup logging properly, so the univention-debug log messages from univention.updater.tools.UniventionUpdater.component_update_get_packages() disappear into byte-nirvana. But from printf-debugging I can see that the apt-get update calls fail there too in this situation (obviously). So by inverse reasoning, I assume the the apt-get update calls made by "univention-upgrade --check" every hour may be the ones interfering with the proper "univention-upgrade" too. I've also opened Bug #43882 for another improvement of locking.
OK, it looks good and makes sense. I was able to reproduce it with the following parallel script: while true; do univention-upgrade --check; sleep 30; done I've added a changelog entry: r77866 We also need to backport this issue to UCS 4.1-4: Bug #43917
UCS 4.2 has been released: https://docs.software-univention.de/release-notes-4.2-0-en.html https://docs.software-univention.de/release-notes-4.2-0-de.html If this error occurs again, please use "Clone This Bug".