[Bug 1888916] Re: release upgrader can restore sources.list file from a previous release upgrade

Brian Murray 1888916 at bugs.launchpad.net
Mon Aug 31 16:18:24 UTC 2020


I tested a release upgrade from Bionic to Focal and confirm that my
sources.list file was not reverted back to Artful.

bdmurray at clean-bionic-amd64:/tmp/20.04$ head /var/log/dist-upgrade/main.log
2020-08-31 08:01:42,527 INFO Using config files '['./DistUpgrade.cfg.bionic']'
2020-08-31 08:01:42,527 INFO uname information: 'Linux clean-bionic-amd64 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64'
2020-08-31 08:01:42,819 INFO apt version: '1.6.12ubuntu0.1'
2020-08-31 08:01:42,820 INFO python version: '3.6.9 (default, Jul 17 2020, 12:50:27)
[GCC 8.4.0]'
2020-08-31 08:01:42,822 INFO release-upgrader version '20.04.25' started

bdmurray at clean-bionic-amd64:/tmp/20.04$ grep -A12 "no entry" /var/log/dist-upgrade/screenlog.0
While scanning your repository information no entry about bionic
could be found.

An upgrade might not succeed.

Do you want to continue anyway?

Continue [yN] n

Restoring original system state

Aborting
Reading package lists... Done

bdmurray at clean-bionic-amd64:/tmp/20.04$ cat /etc/apt/sources.list
deb http://192.168.10.7/ubuntu focal main restricted universe multiverse
deb http://192.168.10.7/ubuntu focal-updates main restricted universe multiverse
#deb http://192.168.10.7/ubuntu focal-proposed main restricted universe multiverse
deb http://192.168.10.7/ubuntu focal-security main restricted universe multiverse
deb-src http://192.168.10.7/ubuntu focal main restricted universe multiverse
deb-src http://192.168.10.7/ubuntu focal-updates main restricted universe multiverse
#deb-src http://192.168.10.7/ubuntu focal-proposed main restricted universe multiverse
deb-src http://192.168.10.7/ubuntu focal-security main restricted universe multiverse

Keep in mind the sources.list file is correct as the test case had you
modify it to the release which you are upgrading.

bdmurray at clean-bionic-amd64:/tmp/20.04$ md5sum /etc/apt/sources.list
6d4439d7fd3f142f81b70e00abd7b95a  /etc/apt/sources.list
bdmurray at clean-bionic-amd64:/tmp/20.04$ md5sum /etc/apt/sources.list.distUpgrade 
6d4439d7fd3f142f81b70e00abd7b95a  /etc/apt/sources.list.distUpgrade

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

Title:
  release upgrader can restore sources.list file from a previous release
  upgrade

Status in ubuntu-release-upgrader package in Ubuntu:
  Fix Released
Status in ubuntu-release-upgrader source package in Focal:
  Fix Committed
Status in ubuntu-release-upgrader source package in Groovy:
  Fix Released

Bug description:
  Impact
  ------
  The distribution upgrader creates a backup of your sources.list named sources.list.distUpgrade before upgrading your system. This file is not cleaned up after the upgrade and under the right set of circumstances (re-attaching to a screen session which starts the dist-upgrade again, or having a strange sources.list file) the sources.list.distUpgrade file will be restored which can result in a mismatch between what you are running and what is in sources.list.

  Test Case
  ---------
  A simple test case is the following:
  1) Copy /etc/apt/sources.list to /etc/apt/sources.list.distUpgrade
  2) Modify /etc/apt/sources.list.distUpgrade to contain a previous release of Ubuntu e.g. 's/focal/eoan/'. (This simulates that you upgraded to your current release of Ubuntu.)
  3) Modify /etc/apt/sources.list to contain the release to which you want to upgrade (strange right‽)
  4) Run do-release-upgrade (with or w/o -d as necessary)
  5) When prompted about "No valid sources.list entry found" choose not to upgrade
  6) Observe that /etc/apt/sources.list has the same content as /etc/apt/sources.list.distUpgrade and that it doesn't match your current release.

  With the version of the release upgrader in -proposed sources.list and
  sources.list.distUpgrade will still have the same content but it will
  be your current release.

  A more involved test case would have one complete a release upgrade
  choose not to reboot then reattach to the screen session (by pressing
  r). After that they'd see the same thing as in Step 5 and Step 6 but
  given that its the same code path it seems unnecessary.

  Regression Potential
  --------------------
  The fix involves backing up your sources.list file before presenting the error dialog regarding "No valid sources.list entry found". So its literally moving the same two lines before the dialog but the copy and paste could have gone wrong so be observant for any Tracebacks.

  Original Description
  --------------------
  I've upgraded a server via `do-release-upgrade` from Ubuntu Bionic to Focal, with molly-guard installed on it - molly-guard configured to always ask for the hostname.

  After it has finished:

  ```
  System upgrade is complete.

  Restart required

  To finish the upgrade, a restart is required.
  If you select 'y' the system will be restarted.

  Continue [yN] y
  I: molly-guard: reboot is always molly-guarded on this system.
  Please type in hostname of the machine to reboot:
  Good thing I asked; I won't reboot bates ...

  === Command detached from window (Tue Jul 21 15:23:36 2020) ===

  === Command terminated normally (Tue Jul 21 15:23:46 2020) ===
  ```

  It doesn't alert you it was restoring original state of sources.list.
  After rebooting the system and it came back up showing `Welcome to Ubuntu 20.04 LTS`, I've just noticed it was pointing out to bionic instead of focal installing a package.

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



More information about the foundations-bugs mailing list