Merge ~enr0n/ubuntu-release-upgrader:lp-2065229 into ubuntu-release-upgrader:ubuntu/main

Proposed by Nick Rosbrook
Status: Needs review
Proposed branch: ~enr0n/ubuntu-release-upgrader:lp-2065229
Merge into: ubuntu-release-upgrader:ubuntu/main
Diff against target: 62 lines (+37/-1)
2 files modified
DistUpgrade/DistUpgradeQuirks.py (+36/-0)
tests/data-deb822-migration-test/test_ports_sources_list_migration/expect/ubuntu.sources (+1/-1)
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+465857@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Unmerged commits

9446b79... by Nick Rosbrook

DistUpgradeQuirks: prevent upgrades of TPM FDE desktops

If a system has pc-kernel snap and ubuntu-desktop-minimal metpackage
installed, then it looks like a TPM FDE desktop. Use this as a condition
to prevent upgrades.

LP: #2065229

8941da8... by Nick Rosbrook

tests: fix un-templated expected ubuntu.sources

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
2index a50ce8a..4e82868 100644
3--- a/DistUpgrade/DistUpgradeQuirks.py
4+++ b/DistUpgrade/DistUpgradeQuirks.py
5@@ -125,6 +125,7 @@ class DistUpgradeQuirks(object):
6 self._test_and_fail_on_power8()
7 self._test_and_fail_on_bios_with_xfs_boot()
8 self._test_and_fail_on_armhf_raspi()
9+ self._test_and_fail_on_tpm_fde()
10
11 cache = self.controller.cache
12 self._test_and_warn_if_ros_installed(cache)
13@@ -1835,3 +1836,38 @@ class DistUpgradeQuirks(object):
14 if remove_ufw:
15 ufw.mark_delete(auto_fix=False)
16 apt.ProblemResolver(self.controller.cache).protect(ufw)
17+
18+ def _test_and_fail_on_tpm_fde(self):
19+ """
20+ LP: #2065229
21+ """
22+ try:
23+ snap_list = subprocess.check_output(['snap', 'list'])
24+ snaps = [s.decode().split()[0] for s in snap_list.splitlines() ]
25+ except FileNotFoundError:
26+ # snapd not installed?
27+ return
28+
29+ if (
30+ 'pc-kernel' in snaps and
31+ 'ubuntu-desktop-minimal' in self.controller.cache and
32+ self.controller.cache['ubuntu-desktop-minimal'].is_installed
33+ ):
34+ logging.debug('Detected TPM FDE system')
35+
36+ di = distro_info.UbuntuDistroInfo()
37+ version = di.version(self.controller.toDist) or 'next release'
38+
39+ self._view.error(
40+ _(
41+ f'Sorry, cannot upgrade this system to {version}'
42+ ),
43+ _(
44+ 'Upgrades for desktop systems running TPM FDE are not '
45+ 'currently supported. '
46+ 'Please see https://launchpad.net/bugs/2065229 '
47+ 'for more information.'
48+
49+ ),
50+ )
51+ self.controller.abort()
52diff --git a/tests/data-deb822-migration-test/test_ports_sources_list_migration/expect/ubuntu.sources b/tests/data-deb822-migration-test/test_ports_sources_list_migration/expect/ubuntu.sources
53index e16fa2d..8bfd1f8 100644
54--- a/tests/data-deb822-migration-test/test_ports_sources_list_migration/expect/ubuntu.sources
55+++ b/tests/data-deb822-migration-test/test_ports_sources_list_migration/expect/ubuntu.sources
56@@ -1,5 +1,5 @@
57 Types: deb
58 URIs: http://ports.ubuntu.com/ubuntu-ports
59-Suites: mantic mantic-updates mantic-security mantic-backports
60+Suites: {dist} {dist}-updates {dist}-security {dist}-backports
61 Components: main restricted universe multiverse
62 Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Subscribers

People subscribed via source and target branches