[Bug 1974223] Re: FTBFS and autopkgtest failure since changes in apt for automatic kernel removal

Olivier Gayot 1974223 at bugs.launchpad.net
Mon Jun 27 15:02:46 UTC 2022


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.

** Patch added: "2-2.3ubuntu0.2__2.3ubuntu0.3.debdiff (focal)"
   https://bugs.launchpad.net/ubuntu/bionic/+source/unattended-upgrades/+bug/1974223/+attachment/5600012/+files/2-2.3ubuntu0.2__2.3ubuntu0.3.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to unattended-upgrades in Ubuntu.
https://bugs.launchpad.net/bugs/1974223

Title:
  FTBFS and autopkgtest failure since changes in apt for automatic
  kernel removal

Status in unattended-upgrades package in Ubuntu:
  Fix Released
Status in unattended-upgrades source package in Bionic:
  Incomplete
Status in unattended-upgrades source package in Focal:
  Incomplete
Status in unattended-upgrades package in Debian:
  Fix Released

Bug description:
  [Impact]
  Since the following changes in apt have landed in focal-updates (and is currently in bionic-proposed), unattended-upgrades FTBFS and fails autopkgtest on both series:

    * Revert "Protect currently running kernel at run-time"
    * Backport Determine autoremovable kernels at run-time (LP: #1615381) as of
      2.4.5; including the change to only protect two kernels, not last installed
      one (LP: #1968154)

  ======================================================================
  FAIL: test_remove_unused_dependencies_new_unused_only (__main__.TestRemoveUnused)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "./test_remove_unused.py", line 165, in test_remove_unused_dependencies_new_unused_only
      haystack))
  AssertionError: False is not true : Can not find 'Removing unused kernel packages: linux-image-4.05.0-1021-kvm

  [Test plan]
  1. focal:
    * run autopkgtest against -updates:
      $ autopkgtest unattended-upgrades --apt-upgrade --apt-pocket=updates --test-name run-tests -- <virt-server ...>
    * try to build the package
  2. bionic:
    * run autopkgtest against -proposed:
      $ autopkgtest unattended-upgrades --apt-upgrade --apt-pocket=proposed --test-name run-tests -- <virt-server ...>
    * try to build the package

  [Where problems could occur]
    * The fix only affects the test-suite (that runs both at build time & autopkgtest time) so the impact should be minimal. Something wrong in the patch would make the unattended package FTBFS or fail autopkgtest but it is already failing ATM.
    * The new tests dependency on apt can trigger more autopkgtest runs. Since unattended-upgrades has a non-trivial autopkgtest suite, this can have a slight impact on the queues.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1974223/+subscriptions




More information about the foundations-bugs mailing list