Skip to content

Instantly share code, notes, and snippets.

@mikbuch
Created May 21, 2022 23:10
Show Gist options
  • Save mikbuch/2c349e1281c69818b48893a460c5accb to your computer and use it in GitHub Desktop.
Save mikbuch/2c349e1281c69818b48893a460c5accb to your computer and use it in GitHub Desktop.
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 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://[email protected]/~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