FTR, with the locking with statement, without the SRU, it fails, as expected (both in bionic and xenial), e.g.:
dpkg: error: dpkg status database is locked by another process E:Sub-process /usr/bin/dpkg returned an error code (2) Traceback (most recent call last): File "/home/jak/Projects/Ubuntu/Scratch/foo.py", line 11, in <module> c.commit() File "/usr/lib/python3/dist-packages/apt/cache.py", line 610, in commit raise SystemError("installArchives() failed") SystemError: installArchives() failed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1795407 Title: python-apt frontend locking To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1795407/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs