release detection relies on lsb-release

Bug #1725359 reported by Brian Murray
46
This bug affects 6 people
Affects Status Importance Assigned to Milestone
ubuntu-release-upgrader (Ubuntu)
Fix Released
Low
Julian Andres Klode

Bug Description

ubuntu-release-upgrader uses lsb-release to determine the version of Ubuntu the system is running, however no double checking is done. As we can see in bug 1725176, the user installed the version of lsb-release from Ubuntu 17.04 although they are running Ubuntu 16.10. The release-upgrader tries to upgrade them from zesty to artful but this fails as their /etc/apt/sources.list is full of yakkety entries and everything ends up being disabled.

The release upgrader should likely confirm they either have their releases lsb-release installed or double check that their /etc/apt/sources.list matches the release lsb-release returns.

I'll also use this as a tracking bug to find out how many people this is affecting.

Related branches

summary: - release detection depends on lsb-release
+ release detection relies on lsb-release
tags: added: artful
tags: added: id-59ea20b4591cda0fc786e8b6
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-release-upgrader (Ubuntu):
status: New → Confirmed
description: updated
Revision history for this message
Scott (scott-dergousoff) wrote :

Thanks for the guidance, I was able to upgrade after doing a couple of things. First I changed the file names from Xenial to Zesty in /etc/apt/sources.list. After that I tried to upgrade the dist to 17.10 but it was going to do a partial upgrade which I heard is not a good thing to do. I cancelled the upgrade ran the following commands in the terminal: and

Revision history for this message
Scott (scott-dergousoff) wrote :

Sorry, I hit comment before finishing, anyways, I ran the following commands in the terminal: sudo apt-get install aptitude
sudo aptitude update
sudo aptitude dist-upgrade
This upgraded me fully to 17.04 and then I was able to upgrade fully to 17.10 right after. Thanks 😀

Revision history for this message
Julian Andres Klode (juliank) wrote :

I think we need something like that:

=== modified file 'DistUpgrade/DistUpgradeController.py'
--- DistUpgrade/DistUpgradeController.py 2018-01-29 09:43:48 +0000
+++ DistUpgrade/DistUpgradeController.py 2018-02-07 10:01:22 +0000
@@ -772,6 +772,17 @@
         logging.debug("updateSourcesList()")
         self.sources = SourcesList(matcherPath=self.datadir)
         # backup first!
+
+ if not any(e.dist == self.fromDist for e in self.sources):
+ res = self._view.askYesNoQuestion(_("No valid sources.list entry found"),
+ _("While scanning your repository "
+ "information no entry about %s could be "
+ "found.\n\n"
+ "An upgrade might not succeed.\n\n"
+ "Do you want to continue anyway?" % self.fromDist)
+ if not res:
+ self.abort()
+
         self.sources.backup(self.sources_backup_ext)
         if not self.rewriteSourcesList(mirror_check=True):
             logging.error("No valid mirror found")

It might be a bit too stupid, though.

Changed in ubuntu-release-upgrader (Ubuntu):
assignee: nobody → Julian Andres Klode (juliank)
status: Confirmed → In Progress
importance: Undecided → Low
Revision history for this message
Julian Andres Klode (juliank) wrote :
Revision history for this message
Brian Murray (brian-murray) wrote :

While this looks fine perhaps this should be fixed in the function get_dist() from DistUpgrade/utils.py that way the release-upgrader tarball for the wrong next release never gets downloaded.

Revision history for this message
Julian Andres Klode (juliank) wrote :

I'm not sure how we'd achieve that. Figuring out which release is the correct one is a much harder problem than figuring out that the release we're being told is not the same as in sources.list.

Revision history for this message
Brian Murray (brian-murray) wrote :

Maybe we can just check that the lsb-release package has the right package origin? I'm thinking of something along the lines of https://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu/bionic/apport/ubuntu/view/head:/backends/packaging-apt-dpkg.py#L166.

This way we could exit out of the upgrade process much earlier.

Revision history for this message
Julian Andres Klode (juliank) wrote :

What is the right origin? How'd you determine that? You cannot really know whether lsb-release is wrong or something else (or nothing). Imagine a user with artful and bionic sources, and lsb-release from bionic - he might be running

(a) bionic
(b) artful with wrong lsb-release
(c) some artful-bionic limbo thingy

How would you figure out what it is?

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

---------------
ubuntu-release-upgrader (1:18.04.12) bionic; urgency=medium

  [ Simon Quigley ]
  * Port away from kdesudo.

  [ Brian Murray ]
  * Increase the size of the buffer used when calculating the free space to
    estimate for the initramfs.

 -- Brian Murray <email address hidden> Wed, 21 Mar 2018 16:32:15 -0700

Changed in ubuntu-release-upgrader (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.