Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu support for EOL release upgrades

Ubuntu support for EOL release upgrades

Background

(do-release-upgrade's source code): https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/tree/do-release-upgrade

References:

(How did I get there)

http://manpages.ubuntu.com/manpages/jammy/man8/do-release-upgrade.8.html => https://launchpad.net/ubuntu/jammy/+package/ubuntu-release-upgrader-core => https://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/1:22.04.10

do-reloase-upgrade source code

git clone https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader
cat DistUpgrade/DistUpgradeController.py
 394             self._view.error(_("Can not upgrade"),
 395                              _("An upgrade from '%s' to '%s' is not "
 396                                "supported with this tool." % (release, self.toDist)))

Questions:

  1. How it is called from the ubuntu-release-upgrader/do-release-upgrade(.py) (https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/tree/do-release-upgrade)
  2. What is the condition in the DistUpgrade/DistUpgradeController.py triggering the error.

TODO:

  1. Create UbuntuOne account
  2. Post a bug/question here: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader . Similar bugs:
@mikbuch
Copy link
Author

mikbuch commented Jun 2, 2022

In order to reproduce the problem:

  1. Install VirtualBox
  2. Download Groovy http://old-releases.ubuntu.com/releases/ -> http://old-releases.ubuntu.com/releases/groovy/
  3. Install Groovy in the VirtualBox
  4. Update sources list
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

See https://gist.github.com/dergachev/f5da514802fcbbb441a1 and https://serverfault.com/questions/622735/how-do-i-upgrade-an-end-of-life-ubuntu-distribution/1101453#1101453

  1. sudo apt-get update
  2. sudo apt-get upgrade -y
  3. sudo apt-get dist-upgrade
  4. sudo do-release-upgrade

Expect an error:

An upgrade from ‘groovy’ to ‘impish’ is not supported with this tool.

Looking for a way to solve the issue (see also: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1975533).

Here is the next step of the analysis:

Question: how to /tmp files end up being there? It looks like a zip/tarball has been downloaded (sudo do-release-upgrade).

Answer: self.script creation: https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/tree/DistUpgrade/DistUpgradeFetcherCore.py?h=applied%2Fubuntu%2Fgroovy#n118 -- At this step the tarball is being downloaded.

Traceback do-release-upgrade: https://www.reddit.com/r/Python/comments/v79f6s/tracing_method_calls_in_a_python_script_in_an/ | Usage of trace: https://www.tutorialspoint.com/trace-or-track-python-statement-execution-trace

Next task: find the URL of the tarball that is being downloaded (hint: print URI here: https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/tree/DistUpgrade/DistUpgradeFetcherCore.py?h=applied%2Fubuntu%2Fgroovy#n196 ; and here: https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/tree/DistUpgrade/DistUpgradeFetcherCore.py?h=applied%2Fubuntu%2Fgroovy#n203)

@mikbuch
Copy link
Author

mikbuch commented Jun 9, 2022

python3 -c "import DistUpgrade;print(DistUpgrade.__file__)"
/usr/lib/python3/dist-packages/DistUpgrade
cd /usr/lib/python3/dist-packages/DistUpgrade

@mikbuch
Copy link
Author

mikbuch commented Jun 9, 2022

In:

sudo do-release-upgrade

Out:

TEST TEST
http://archive.ubuntu.com/ubuntu/dists/impish-updates/main/dist-upgrader-all/current/impish.tar.gz.gpg
Self.URI
http://archive.ubuntu.com/ubuntu/dists/impish-updates/main/dist-upgrader-all/current/impish.tar.gz
Get:1 Upgrade tool signature [819 B]                                          
Get:2 Upgrade tool [1 278 kB]                                                 
Fetched 1 279 kB in 0s (0 B/s)                                                
authenticate 'impish.tar.gz' against 'impish.tar.gz.gpg' 
extracting 'impish.tar.gz'
['/tmp/ubuntu-release-upgrader-lvcpnz2_/impish', '--mode=server', '--frontend=DistUpgradeViewText']
/tmp/ubuntu-release-upgrader-lvcpnz2_/impish

@mikbuch
Copy link
Author

mikbuch commented Jun 9, 2022

I know which modifications to suggest where.

I don't know yet how to test if my modifications will work, see: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1975533

@mikbuch
Copy link
Author

mikbuch commented Jun 9, 2022

Probable way of testing:

  1. Modifications in /tmp/ubuntu-release-upgrader-lvcpnz2_/impish
  2. Run: /tmp/ubuntu-release-upgrader-lvcpnz2_/impish --mode=server --frontend=DistUpgradeViewText

@mikbuch
Copy link
Author

mikbuch commented Jun 9, 2022

Yes, this is the way.

@mikbuch
Copy link
Author

mikbuch commented Jun 11, 2022

Steps to test the solution:

  1. sudo -i
  2. apt-get update
  3. apt-get upgrade
  4. do-release-upgrade
  5. cd /tmp/ubuntu-release-upgrader-tp_hytp6 (where tp_hytp6 can be different in your case)
  6. cp DistUpgrade.cfg.focal DistUpgrade.cfg.groovy
  7. sed -i s/From=focal/From=groovy/ DistUpgrade.cfg.groovy
  8. grep From DistUpgrade.cfg.groovy (sanity check; optional)
  9. cp demoted.cfg.focal demoted.cfg.groovy
  10. ./impish --mode=server --frontend=DistUpgradeViewText

@mikbuch
Copy link
Author

mikbuch commented Jun 11, 2022

Problem: aborted, no enough space (2 GB missing on my virtual machine).
Solution: increase space.

@mikbuch
Copy link
Author

mikbuch commented Jun 20, 2022

Another attempt succeeded. 21.10 impish is in place.

@mikbuch
Copy link
Author

mikbuch commented Jun 20, 2022

Summary

Requirements:

  • Ubuntu Groovy with at least 15 GB storage.

Steps to test the solution:

  1. sudo -i
  2. apt-get update
  3. apt-get upgrade
  4. do-release-upgrade

Expect an error:

An upgrade from ‘groovy’ to ‘impish’ is not supported with this tool.
  1. cd /tmp/ubuntu-release-upgrader-tp_hytp6 (where tp_hytp6 can be different in your case)
  2. cp DistUpgrade.cfg.focal DistUpgrade.cfg.groovy
  3. sed -i s/From=focal/From=groovy/ DistUpgrade.cfg.groovy
  4. grep From DistUpgrade.cfg.groovy (sanity check; optional)
  5. cp demoted.cfg.focal demoted.cfg.groovy
  6. ./impish --mode=server --frontend=DistUpgradeViewText

Supplementary/Optional steps

What you may also need to do is to update sources list, before running apt-get update & apt-get upgrade, although during the most recent try I didn't have to do it.

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

@mikbuch
Copy link
Author

mikbuch commented Jun 21, 2022

To sum up, the required changes in the original ubuntu-release-upgrader repository (https://code.launchpad.net/ubuntu/+source/ubuntu-release-upgrader) are:

cd ubuntu-release-upgrader
git checkout ubuntu/impish
cd data
cp DistUpgrade.cfg.focal DistUpgrade.cfg.groovy
sed -i s/From=focal/From=groovy/ DistUpgrade.cfg.groovy
cp demoted.cfg.focal demoted.cfg.groovy

Then check the differences:

(1)

diff DistUpgrade.cfg.groovy DistUpgrade.cfg.focal

should be:

109c109
< From=groovy
---
> From=focal

and
(2)

diff demoted.cfg.focal demoted.cfg.groovy

should be none.

Then follow the instructions from: https://code.launchpad.net/ubuntu/+source/ubuntu-release-upgrader , i.e.:

To fork this repository and propose fixes from there, push to this repository:

git push git+ssh://mikbuch@git.launchpad.net/~mikbuch/ubuntu/+source/ubuntu-release-upgrader BRANCHNAME 

or fork it directly to your account.

@mikbuch
Copy link
Author

mikbuch commented Jul 11, 2022

The fix has been committed and tested (verified). The package is pending a new release: https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1975533

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