Merge ~xnox/ubuntu-release-upgrader:ignore-base-tasks into ubuntu-release-upgrader:ubuntu/master

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 792294305c6f5df4c07ff8706e3292e6fa5021b9
Proposed branch: ~xnox/ubuntu-release-upgrader:ignore-base-tasks
Merge into: ubuntu-release-upgrader:ubuntu/master
Diff against target: 43 lines (+13/-0)
3 files modified
DistUpgrade/DistUpgradeCache.py (+3/-0)
data/DistUpgrade.cfg (+3/-0)
debian/changelog (+7/-0)
Reviewer Review Type Date Requested Status
Brian Murray Needs Fixing
Balint Reczey Abstain
Christian Ehrhardt  Pending
Michael Vogt Pending
Steve Langasek Pending
Julian Andres Klode Pending
Ubuntu Core Development Team Pending
Review via email: mp+382970@code.launchpad.net

Commit message

DistUpgradeCache: Ignore BaseMetaPkgs' & obsolete tasks
 during server upgrade

ubuntu-minimal and ubuntu-base are forced to stay installed via
BaseMetaPkgs / keepBaseMetaPkgs rule during either desktop or server
upgrades. During server upgrades, we try to establish which Tasks are
installed, we do this by iterating all packages and checking if all
packages of a given Task are installed. This is the case for
ubuntu-minimal & ubuntu-standard. But they are not manually-installed
tasks. Instead they are handled with a metapackage only, to allow
alternative implementations of certain components
(i.e. time-daemon). Thus during upgrade we should not force install
those, but instead rely on keeping BaseMetaPkg installed only to
esnure that alternative selections of time-daemons is permitted and is
not changed.

Also, this function might missdetect as obsolete tasks as
installed. For example Task: ubuntu-core should no longer exist, as
the metapackages for it got dropped, but we forgot to remove the
metadata from the archive. If it happens that ubuntu-core appears to
be fully installed, do not try to preserve it on upgrades.

LP: #1872902

Description of the change

DistUpgradeCache: Ignore BaseMetaPkgs' & obsolete tasks
 during server upgrade

ubuntu-minimal and ubuntu-base are forced to stay installed via
BaseMetaPkgs / keepBaseMetaPkgs rule during either desktop or server
upgrades. During server upgrades, we try to establish which Tasks are
installed, we do this by iterating all packages and checking if all
packages of a given Task are installed. This is the case for
ubuntu-minimal & ubuntu-standard. But they are not manually-installed
tasks. Instead they are handled with a metapackage only, to allow
alternative implementations of certain components
(i.e. time-daemon). Thus during upgrade we should not force install
those, but instead rely on keeping BaseMetaPkg installed only to
esnure that alternative selections of time-daemons is permitted and is
not changed.

Also, this function might missdetect as obsolete tasks as
installed. For example Task: ubuntu-core should no longer exist, as
the metapackages for it got dropped, but we forgot to remove the
metadata from the archive. If it happens that ubuntu-core appears to
be fully installed, do not try to preserve it on upgrades.

LP: #1872902

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

To try upgrading using this upgrader:

git clone -b ignore-base-tasks https://git.launchpad.net/~xnox/ubuntu-release-upgrader

cd ubuntu-release-upgrader/DistUpgrade

./dist-upgrade.py --datadir=../data --disable-gnu-screen

With eoan lxd container + chrony installed, previously we tried to force install:
Installed tasks are: {'standard', 'server', 'openssh-server', 'minimal', 'cloud-image'}

But with this change, we try to force install:
Installed tasks are: {'openssh-server', 'cloud-image', 'server'}

Which imho are the correct tasks to force-upgrade for a lxd container.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

minimal, standard tasks are already handled separately via _keepBaseMetaPkgsInstalled which forces to keep them installed as one of the last actions before finishing calculating the upgrade, to make sure they are installed/upgraded.

Revision history for this message
Balint Reczey (rbalint) wrote :

I think this change is a bit too intrusive for an SRU from testing/assessing the potential regressions POV and also does not fully resolve the redundancy between tasks and meta packages, just special-cases two of them.

I think the minimal fix of skipping just systemd-timesyncd either in u-r-u or in the seed generation for focal only would be a more appropriate to limit the impact.

For groovy and later I think the task generation should be changed to not pull in dependencies to tasks and as a result u-r-u could keep handling tasks the way they used to be handled.

I'm OK with picking this change and SRU-ing it because the change is not wronk, but I think it is between a minimal fix and a general solution and this makes it not optimal in my eyes.

review: Abstain
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

So old ubuntu server installer allowed to install tasks, and exposed them as a list. Hence the upgrader wanted to preserve tasks that users installed at the time.

However, tasks that were explicitely installed, vs accidentally all of a tasks fields are satisfied is arbitrary to me.

I'm not sure why we still publish Tasks in the archive =/

Or like for example, why we publish tasks for things that are metapackages.

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

I'm okay with this approach to resolving the issue, but this needs fixing as data/DistUpgrade.cfg.bionic will also need updating.

I tested desktop and server upgrades with and without chrony and did not notice any issues.

If and when we land this in -proposed I'd like to see the automatic upgrade testing use the version of the dist-upgrader with these changes.

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

If nobody objects I'm going to merge and upload this on 2020-05-05.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py
2index 3cd8504..8d9ba57 100644
3--- a/DistUpgrade/DistUpgradeCache.py
4+++ b/DistUpgrade/DistUpgradeCache.py
5@@ -818,6 +818,9 @@ class MyCache(apt.Cache):
6 tasks[task].add(pkg.name)
7 for task in tasks:
8 installed = True
9+ ignored_tasks = self.config.getlist("Distro", "IgnoredTasks")
10+ if task in ignored_tasks:
11+ installed = False
12 for pkgname in tasks[task]:
13 if not self[pkgname].is_installed:
14 installed = False
15diff --git a/data/DistUpgrade.cfg b/data/DistUpgrade.cfg
16index a349f4a..2b26f82 100644
17--- a/data/DistUpgrade.cfg
18+++ b/data/DistUpgrade.cfg
19@@ -16,6 +16,9 @@ MetaPkgs=ubuntu-desktop, kubuntu-desktop, xubuntu-core,
20 ubuntu-mate-core, ubuntu-mate-desktop,
21 ubuntukylin-desktop, ubuntu-budgie-desktop
22 BaseMetaPkgs=ubuntu-minimal, ubuntu-standard
23+# minimal & standard, are handed via BaseMetaPkgs rule
24+# ubuntu-core is left-over task we forgot to remove
25+IgnoredTasks=minimal, standard, ubuntu-core
26 Demotions=demoted.cfg
27 #RemoveEssentialOk=sysvinit, sysvutils, belocs-locales-bin
28 RemovalBlacklistFile=removal_blacklist.cfg
29diff --git a/debian/changelog b/debian/changelog
30index fe72e60..798f180 100644
31--- a/debian/changelog
32+++ b/debian/changelog
33@@ -1,3 +1,10 @@
34+ubuntu-release-upgrader (1:20.04.19) UNRELEASED; urgency=medium
35+
36+ * DistUpgradeCache: Ignore BaseMetaPkgs' & obsolete tasks during server upgrade
37+ (LP: #1872902)
38+
39+ -- Dimitri John Ledkov <xnox@ubuntu.com> Sun, 26 Apr 2020 17:07:08 +0100
40+
41 ubuntu-release-upgrader (1:20.04.18) focal; urgency=medium
42
43 [ Steve Langasek ]

Subscribers

People subscribed via source and target branches