Public bug reported:

While working on LP: #2154822 discovered an obscure, but still rather
serious issue during upgrade. If a system has a "disabled" sources.list
configuration, but a valid deb822 sources configuration for the same
sources, ubuntu-release-upgrader will clobber the deb822 sources config
(trying to migrate the disabled sources.list), then complain it can't
find any valid sources, but upon exit it *doesn't* restore the deb822
sources, leaving the system with a broken apt configuration.

To reproduce:

$ lxc launch ubuntu:n upgrade-test
$ lxc shell upgrade-test
$ cat << EOF > /etc/apt/sources.list
#deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe 
multiverse
#deb http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted 
universe multiverse
#deb http://ports.ubuntu.com/ubuntu-ports noble-backports main restricted 
universe multiverse
#deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted 
universe multiverse
EOF
$ cat << EOF > /etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports
Suites: noble noble-updates noble-backports noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
$ apt update
$ apt full-upgrade -y

At this point, the system has a valid (if unusual) configuration for
noble which works. Now attempt to run the release upgrader:

$ do-release-upgrade

The upgrade will fail complaining there are no valid sources. Upon
exiting the upgrader, run "apt update" and observe all the sources are
gone.

The issue is that migrateToDeb822 clobbers ubuntu.sources when it
attempts to "migrate" the *disabled* sources.list. It should never
clobber anything, but move it to a backup file which can be restored by
restoreMigratedSources later, and arguably it probably shouldn't be
trying to migrate sources it considers disabled either.

** Affects: ubuntu-release-upgrader (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  While working on LP: #2154822 discovered an obscure, but still rather
  serious issue during upgrade. If a system has a "disabled" sources.list
  configuration, but a valid deb822 sources configuration for the same
  sources, ubuntu-release-upgrader will clobber the deb822 sources config
  (trying to migrate the disabled sources.list), then complain it can't
  find any valid sources, but upon exit it *doesn't* restore the deb822
  sources, leaving the system with a broken apt configuration.
  
  To reproduce:
  
  $ lxc launch ubuntu:n upgrade-test
  $ lxc shell upgrade-test
- # cat << EOF > /etc/apt/sources.list
+ $ cat << EOF > /etc/apt/sources.list
+ #deb http://ports.ubuntu.com/ubuntu-ports noble main restricted universe 
multiverse
+ #deb http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted 
universe multiverse
+ #deb http://ports.ubuntu.com/ubuntu-ports noble-backports main restricted 
universe multiverse
+ #deb http://ports.ubuntu.com/ubuntu-ports noble-security main restricted 
universe multiverse
  EOF
- # cat << EOF > /etc/apt/sources.list.d/ubuntu.sources
+ $ cat << EOF > /etc/apt/sources.list.d/ubuntu.sources
+ Types: deb
+ URIs: http://ports.ubuntu.com/ubuntu-ports
+ Suites: noble noble-updates noble-backports noble-security
+ Components: main universe restricted multiverse
+ Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
  EOF
- # apt update
- # apt full-upgrade -y
+ $ apt update
+ $ apt full-upgrade -y
  
  At this point, the system has a valid (if unusual) configuration for
  noble which works. Now attempt to run the release upgrader:
  
- # do-release-upgrade
+ $ do-release-upgrade
  
  The upgrade will fail complaining there are no valid sources. Upon
  exiting the upgrader, run "apt update" and observe all the sources are
  gone.
  
  The issue is that migrateToDeb822 clobbers ubuntu.sources when it
  attempts to "migrate" the *disabled* sources.list. It should never
  clobber anything, but move it to a backup file which can be restored by
  restoreMigratedSources later, and arguably it probably shouldn't be
  trying to migrate sources it considers disabled either.

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

Title:
  Commented list-style source causes deb822 source to be deleted
  (upgrade fails, apt config corrupted)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/2166117/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to