Univention Bugzilla – Bug 51583
Failed updates due to two simultaneous updates
Last modified: 2022-03-14 13:39:12 CET
Within the last 6 weeks the update failed at three customers due to two parallel running update processes. The effects were different but I always found the two competing update processes as the cause. As far as I know the customers started the update via the UMC; there were no cron controlled updates on at least two systems. Two systems were on UCS 4.4-4 (err602) at the time, one 4.4-3 err455. In the first ticket, a complete USI is attached, and the second ticket I surly can get more logfiles if necessary
This should work: root@master10:~# univention-upgrade Starting univention-upgrade. Current UCS version is 4.4-4 errata644 Another updater process is currently running - abort Locked by PID 11246. Check lockfile /var/lock/univention-updater There is a Python context manager for that: arequate@braeda:~/git/ucs on feature/ucs5$ rgrep UpdaterLock base/univention-updater base/univention-updater/debian/changelog: * Bug #43625: Acquire an UpdaterLock also for --check base/univention-updater/python/univention-upgrade:from univention.updater.locking import UpdaterLock base/univention-updater/python/univention-upgrade: with UpdaterLock(): base/univention-updater/python/univention-repository-update:from univention.updater.locking import UpdaterLock base/univention-updater/python/univention-repository-update: with UpdaterLock(): base/univention-updater/python/univention-repository-create:from univention.updater.locking import UpdaterLock base/univention-updater/python/univention-repository-create: with UpdaterLock(): base/univention-updater/python/univention-updater:from univention.updater.locking import UpdaterLock base/univention-updater/python/univention-updater: with UpdaterLock(): base/univention-updater/python/univention-actualise:from univention.updater.locking import UpdaterLock base/univention-updater/python/univention-actualise: with UpdaterLock(): base/univention-updater/modules/univention/updater/locking.py:class UpdaterLock(object):
This is exactly what happens when I start /usr/share/univention-updater/univention-updater-umc-dist-upgrade twice: =================================================================================================================== Starting dist-upgrade at Di 7. Jul 17:51:50 CEST 2020 E: Konnte Sperre /var/lib/dpkg/lock-frontend nicht bekommen - open (11: Die Ressource ist zur Zeit nicht verfügbar) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? ERROR: An error occurred during update. Please check the logfiles. =================================================================================================================== And the first process continues to update. This looks to me like the lock mechanism works exactly as intended. The same happens when I start univention-upgrade while univention-updater-umc-dist-upgrade is running. The second issue looks different and we will have to investigate this further: ================================== Another case (second ticket) was quite more inconvenient; apt was broken: Entpacken von apt (1.4.10A~4.4.0.202005191916) über (1.4.9A~4.3.3.201901230932) ... dpkg: Fehler: dpkg-Status-Datenbank ist von einem anderen Prozess gesperrt E: Sub-process /usr/bin/dpkg returned an error code (2 ==================================
We fixed a similar thing in Bug 43625#c2, where univention-upgrade --check, run periodically via cron, interfered. In this case it seems to be something else. Maybe something like this, but I have no clue about the exact flow of this issue: The shell script /usr/share/univention-updater/univention-updater-umc-dist-upgrade relies only on the apt-get/dpkg lock mechanisms, but doesn't check/use the locking mechanism that univention-upgrade (and the legacy script /usr/share/univention-updater/univention-updater-check) uses today, which uses the Python context manager univention.updater.locking.UpdaterLock to manage the file /var/lock/univention-updater. This is the situation while univention-updater-umc-dist-upgrade relies is running: =============================================================================== root@master10:~# lsof /var/lib/dpkg/lock-frontend COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME apt-get 19662 root 4uW REG 253,0 0 523532 /var/lib/dpkg/lock-frontend root@master10:~# lsof /var/lib/dpkg/lock COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dpkg 19953 root 3uW REG 253,0 0 523516 /var/lib/dpkg/lock root@master10:~# lsof /var/lock/univention-updater lsof: status error on /run/lock/univention-updater: No such file or directory root@master10:~# ps fax [...] 19659 pts/1 T 0:00 | \_ /bin/sh /usr/share/univention-updater/univention-updater-umc-dist-upgrade 19662 pts/1 T 0:01 | | \_ apt-get -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-overwrite -o DPkg::Options::=--force-overwrite-dir --trivial-o nly=no --assume-yes --quiet=1 -u dist-upgrade 19953 pts/2 Ss+ 0:01 | | \_ /usr/bin/dpkg [...] --install [...] [...] ===============================================================================
All customers started the update via UMC. Second customer reports during phone call, that also app-updates did not work in the immediate past. After click on update button nothing happens in gui.