Comment 9 for bug 1974223

Revision history for this message
Olivier Gayot (ogayot) wrote :

Adding a new debdiff for focal that includes a work around for the autopkgtest failure:

```
  File "/tmp/autopkgtest.BHhHkG/build.sjh/src/test/unattended_upgrade.py", line 863, in cache_commit
    res = cache.commit(install_progress=iprogress)
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 686, in commit
    raise SystemError("installArchives() failed")
SystemError: installArchives() failed
Auto-removing the packages failed!
Error message: installArchives() failed
dpkg returned an error! See ./root.unused-deps/var/log/unattended-upgrades/unattended-upgrades-dpkg.log for details
```

when the error occurs, unattended-upgrades-dpkg.log contains the following error:

```
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
apt_pkg.Error: E:Problem closing the gzip file - close (9: Bad file descriptor)

The above exception was the direct cause of the following exception:

SystemError: <built-in method remove of apt_pkg.PackageManager object at 0x7f20c3e894e0> returned a result with an error set
```

During investigation, I observed that the second invocation of test_remove_unused.py (which is executed with python-coverage) would fail if __pycache__/unattended_upgrades.cpython-38.pyc was present.

Removing this __pycache__ file seems to be a good workaround for this bug.

Having said that, I don't have any sensible explanation to why:
 * removing __pycache__ would prevent the error from occurring ;
 * such error would only occur in focal.

This could be caused by a race condition or some sort of undefined behavior (e.g., in unattended-upgrades, in python-apt or in apt itself).

Moving forward, I suggest we continue the investigation to identify the root cause.