Skip to content

Instantly share code, notes, and snippets.

@FauxFaux
Last active May 13, 2023 20:43
Show Gist options
  • Save FauxFaux/9686f285102bbaa59d63 to your computer and use it in GitHub Desktop.
Save FauxFaux/9686f285102bbaa59d63 to your computer and use it in GitHub Desktop.
What does Ubuntu's do-release-upgrade script actually do?

Ubuntu encourage upgrading between releases by running a command, instead of by manually editing sources and getting on with it. This tool's name is do-release-upgrade, and I believe it should just be doing:

sed -i 's/wily/xenial/g' /etc/apt/sources.list /etc/apt/sources.list.d/*

This command does not explain what it wants to do, or why it is doing anything. It has, in the past:

  • Disabled repos I was using, and hence broken the software in them.
  • Dropped the network on a remote machine which I was accessing over SSH.
  • Hung unresumably due to network conditions.

This makes me unhappy. Let's see what it actually does:

% python3 -m trace --trace =do-release-upgrade 2>&1 | fgrep -A3 \"http:
MetaRelease.py(106):         base_uri = "http://changelogs.ubuntu.com/"
MetaRelease.py(107):         self.METARELEASE_URI = base_uri + "meta-release"
MetaRelease.py(108):         self.METARELEASE_URI_LTS = base_uri + "meta-release-lts"
MetaRelease.py(109):         self.METARELEASE_URI_UNSTABLE_POSTFIX = "-development"

First, it downloads some metadata over plain http. The metadata contains the URL to the random binary we're going to execute:

% curl -s http://changelogs.ubuntu.com/meta-release-lts-development | sed -n '1,/xenial/d; /UpgradeTool:/p'
UpgradeTool: http://archive.ubuntu.com/ubuntu/dists/xenial/main/dist-upgrader-all/current/xenial.tar.gz

This tar appears to have been built from:

https://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-release-upgrader/trunk/files

... which contains plenty of metadata, about what to do. For example,

I do not know how those packages would be removed otherwise, unless they were originally marked as "automatically installed", and are now obsolete? This seems unlikely to have happened.

So, maybe the tool has non-zero value. I think I'd rather just have the list of packages, though, thanks...

@mikbuch
Copy link

mikbuch commented May 21, 2022

My case is somehow different from yours, @FauxFaux, so I created my own "issue" as a gist here: https://gist.github.com/mikbuch/2c349e1281c69818b48893a460c5accb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment