This bug was fixed in the package ubuntu-release-upgrader - 1:24.04.23

---------------
ubuntu-release-upgrader (1:24.04.23) noble; urgency=medium

  * Ensure that we remove only the right obsolete packages, specifically
    not kernel packages  (LP: #2078720):
    - Revert back to old obsolete logic if new one fails
    - Force obsolete removals on non-foreign packages
    - Consistently check that we do not remove protected obsolete packages
  * Run pre-build.sh: updating mirrors, demotions, and translations.

 -- Julian Andres Klode <juli...@ubuntu.com>  Thu, 05 Sep 2024 21:11:05
+0200

** Changed in: ubuntu-release-upgrader (Ubuntu Noble)
       Status: Fix Committed => Fix Released

** Changed in: apt (Ubuntu Jammy)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-aws in Ubuntu.
https://bugs.launchpad.net/bugs/2078720

Title:
  Upgrading from jammy to noble results in a linux-headers package being
  in a broken state

Status in apt package in Ubuntu:
  New
Status in linux-aws package in Ubuntu:
  Confirmed
Status in linux-gcp package in Ubuntu:
  Confirmed
Status in ubuntu-release-upgrader package in Ubuntu:
  Fix Released
Status in apt source package in Jammy:
  Fix Released
Status in linux-aws source package in Jammy:
  New
Status in linux-gcp source package in Jammy:
  New
Status in apt source package in Noble:
  New
Status in linux-aws source package in Noble:
  New
Status in linux-gcp source package in Noble:
  New
Status in ubuntu-release-upgrader source package in Noble:
  Fix Released

Bug description:
  (For APT SRU versioning, see https://wiki.ubuntu.com/AptUpdates)

  [Impact]
  Obsolete packages can be removed despite still having reverse dependencies 
installed, for example:

  Now that 24.04.1 has been released, 22.04 users are encouraged to upgrade to 
24.04 via the `do-release-upgrade` command. This issue was seen whilst testing 
this upgrade path.
  Upgrading and later rebooting a jammy GCP instance results in 
`linux-headers-6.5.0-1025-gcp` being a broken state.

  ```
  $ sudo apt install
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  You might want to run 'apt --fix-broken install' to correct these.
  The following packages have unmet dependencies:
   linux-headers-6.5.0-1025-gcp : Depends: linux-gcp-6.5-headers-6.5.0-1025 but 
it is not installable
  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or 
specify a solution).
  ```
  `linux-gcp-6.5-headers-6.5.0-1025` is a dependency of 
`linux-image-6.5.0-1025-gcp` which is also not removed during the upgrade.

  ```
  $ apt-cache rdepends linux-headers-6.5.0-1025-gcp
  linux-headers-6.5.0-1025-gcp
  Reverse Depends:
    linux-image-6.5.0-1025-gcp
  $ apt-cache rdepends linux-image-6.5.0-1025-gcp
  linux-image-6.5.0-1025-gcp
  Reverse Depends:
  ```

  Running `apt --fix-broken install` resolves the error.
  ```
  $ sudo apt --fix-broken install
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  Correcting dependencies... Done
  The following packages will be REMOVED:
    linux-headers-6.5.0-1025-gcp
  0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  After this operation, 27.9 MB disk space will be freed.
  Do you want to continue? [Y/n] y
  (Reading database ... 83770 files and directories currently installed.)
  Removing linux-headers-6.5.0-1025-gcp (6.5.0-1025.27~22.04.1) ...
  $ sudo apt install
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  ```

  This issue was also observed after upgrading a jammy AWS instance to
  noble.

  ```
  $ sudo apt install
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  You might want to run 'apt --fix-broken install' to correct these.
  The following packages have unmet dependencies:
   linux-headers-6.5.0-1024-aws : Depends: linux-aws-6.5-headers-6.5.0-1024 but 
it is not installable
  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or 
specify a solution).
  ```

  [Test plan]

  ## Jammy APT verification

  To prepare the VMs, follow the following scheme:

  $ lxc launch ubuntu:jammy jammy-to-noble --vm

  If using lxc shell or exec to connect to it, also perform the step
  below:

  $ lxc exec jammy-to-noble apt-mark lxd-agent-launcher # otherwise it
  resets

  On this jammy VM, edit /etc/update-manager/release-upgrades and set
  Prompt to "normal" (since release upgrades to noble via the lts prompt
  are temporarily blocked due to this bug)

  If this test run is meant to test the fix, then at this point you
  should install apt from jammy proposed. Otherwise, continue directly
  with the release upgrade.

  Then to continue with the test, proceed to the release upgrade:

  $ sudo do-release-upgrade

  Check that currently booted linux-headers- are *not* removed as
  obsolete.

  After the reboot at the end, in the rebooted system, issue:

  $ sudo apt upgrade

  With the bug present, you will get an error like this:
  $ sudo apt upgrade
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  You might want to run 'apt --fix-broken install' to correct these.
  The following packages have unmet dependencies:
   linux-headers-5.15.0-1065-kvm : Depends: linux-kvm-headers-5.15.0-1065 but 
it is not installable
  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or 
specify a solution).

  ## Noble APT verification

  To validate the APT change on noble, we must rely on the test suite as
  we won't have a noble->oracular upgrade bug causing it, most likely.

  To validate an ubuntu-release-upgrader change, instead run:

  ubuntu@jammy-to-noble$ do-release-upgrade -p
  ubuntu@mantic-to-noble$ do-release-upgrade -p

  [Where problems could occur: APT SRU]

  For the APT change, the function in question is used in a small number
  of places:

  In APT library:
  - In the `upgrade` command and library function. Removals are already undone 
there before calling it so we never reach the new code path.
  - In the phased update implementation, during dist-upgrade. I expect a 
failure is lurking there that is fixed by this, but I haven't been able to 
write a reproducer to trigger it just yet.

  In aptitude:
  - The function is wrapped, but the wrapper never called

  In QApt:
  - QApt seems to rely on it for upgrading and doesn't seem to have any error 
checking of the return value. I expect it will read the error

  [Where problems could occur: u-r-u SRU]
  Upgrades will now result in a consistent state, but may spend hours searching 
for obsolete software again.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2078720/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to