In a new 20.04 LXD container, do-release-upgrade crashes as lspci cannot be found

Bug #1985253 reported by Rik Mills
70
This bug affects 11 people
Affects Status Importance Assigned to Milestone
ubuntu-release-upgrader (Ubuntu)
Invalid
High
Unassigned
Jammy
Fix Released
High
Brian Murray

Bug Description

Impact
------
It is not possible to use do-release-upgrade on some installs (lxc containers, chroots) of Ubuntu as pci-utils may not be installed. It is called by nvidiadetector (bundled in the dist-upgrader tarball) which in turn is called by a newly added upgrade quirk.

Test Case
---------
1) lxc launch images:ubuntu/20.04
2) get a shell on the container
3) Install ubuntu-release-upgrader-core
4) Run do-release-upgrade

do-release-upgrade crashes with the trace below

With the version of ubuntu-release-upgrader from -proposed (testable by using do-release-upgrade -p) the release upgrade will no longer crash in this way and the upgrade will proceed.

Regression Potential
--------------------
There could be syntax errors or typos in the added check but running the test case will reveal those.

Installing pciutils for the lspci binary fixes the issue

***** shell input and trace *****

# do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]
Get:2 Upgrade tool [1267 kB]
Fetched 1268 kB in 0s (0 B/s)
authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg'
extracting 'jammy.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu focal InRelease
Hit http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit http://security.ubuntu.com/ubuntu focal-security InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done

A fatal error occurred

Please report this as a bug and include the files
/var/log/dist-upgrade/main.log and /var/log/dist-upgrade/apt.log in
your report. The upgrade has aborted.
Your original sources.list was saved in
/etc/apt/sources.list.distUpgrade.

Traceback (most recent call last):

File "/tmp/ubuntu-release-upgrader-4e8f3dz6/jammy", line 8, in
<module>
sys.exit(main())

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeMain.py",
line 241, in main
if app.run():

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeController.py",
line 2042, in run
return self.fullUpgrade()

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeController.py",
line 1873, in fullUpgrade
if not self.doPostInitialUpdate():

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeController.py",
line 906, in doPostInitialUpdate
self.quirks.run("PostInitialUpdate")

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeQuirks.py",
line 99, in run
func()

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeQuirks.py",
line 126, in jammyPostInitialUpdate
self._fix_missing_nvidia_metapackage()

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/DistUpgrade/DistUpgradeQuirks.py",
line 1492, in _fix_missing_nvidia_metapackage
nv = NvidiaDetection()

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/NvidiaDetector/nvidiadetector.py",
line 72, in __init__
self.detection()

File
"/tmp/ubuntu-release-upgrader-4e8f3dz6/NvidiaDetector/nvidiadetector.py",
line 113, in detection
p1 = Popen(['lspci', '-n'], stdout=PIPE, universal_newlines=True)

File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,

File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: 'lspci
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.24
Architecture: amd64
CasperMD5CheckResult: skip
CrashDB: ubuntu
DistroRelease: Ubuntu 20.04
Package: ubuntu-release-upgrader-core 1:20.04.38
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
ProcVersionSignature: Ubuntu 4.15.0-188.199-generic 4.15.18
Tags: focal dist-upgrade
Uname: Linux 4.15.0-188-generic x86_64
UpgradeStatus: Upgraded to focal on 2022-08-11 (0 days ago)
UserGroups: N/A
VarLogDistupgradeAptlog:
 Log time: 2022-08-11 17:10:43.752341
 Log time: 2022-08-11 17:10:46.113962
_MarkForUpload: True

Rik Mills (rikmills)
summary: - In a new 22.04 LXD container, do-release-upgrade crashes as lspci cannot
+ In a new 20.04 LXD container, do-release-upgrade crashes as lspci cannot
be found
tags: added: rls-jj-incoming
Changed in ubuntu-release-upgrader (Ubuntu):
importance: Undecided → High
Revision history for this message
Rik Mills (rikmills) wrote : CurrentDmesg.txt.txt

apport information

tags: added: apport-collected dist-upgrade focal
description: updated
Revision history for this message
Rik Mills (rikmills) wrote : Dependencies.txt

apport information

Revision history for this message
Rik Mills (rikmills) wrote : NonfreeKernelModules.txt

apport information

Revision history for this message
Rik Mills (rikmills) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Rik Mills (rikmills) wrote : VarLogDistupgradeAptclonesystemstate.tar.gz

apport information

Revision history for this message
Rik Mills (rikmills) wrote : VarLogDistupgradeMainlog.txt

apport information

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-release-upgrader (Ubuntu):
status: New → Confirmed
tags: added: fr-2609
Revision history for this message
Brian Murray (brian-murray) wrote :

For what it is worth ubuntu-drivers-common does depend on pciutils in Ubuntu 20.04, however because we ship nvidiadetector.py in the dist-upgrader tarball this doesn't actually come into play i.e. we are importing NvidiaDetection from the code we are bundling. A possible solution here might involve checking to see if the ubuntu-drivers-common package is installed on the system which is being upgraded.

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

Something like this is what I had in mind:

diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
index 4754b9449..79bb9cab1 100644
--- a/DistUpgrade/DistUpgradeQuirks.py
+++ b/DistUpgrade/DistUpgradeQuirks.py
@@ -1444,6 +1444,13 @@ class DistUpgradeQuirks(object):
         # Desktop installs for 20.04.3 on systems with nvidia graphics don't have the
         # driver metapackage installed
         logging.debug("running Quirks._test_and_fix_missing_nvidia_metapackage")
+ cache = self.controller.cache
+ if 'ubuntu-drivers-common' not in cache:
+ logging.error("ubuntu-drivers-common not be available")
+ return
+ elif not cache['ubuntu-drivers-common'].is_installed:
+ logging.error("ubuntu-drivers-common not installed")
+ return
         try:
             from NvidiaDetector.nvidiadetector import NvidiaDetection
         except (ImportError) as e:
@@ -1451,7 +1458,6 @@ class DistUpgradeQuirks(object):
             return
         nv = NvidiaDetection()
         versions = nv.drivers.keys()
- cache = self.controller.cache
         # Early exit if there's a driver metapackage installed
         for version in versions:
             driver = 'nvidia-driver-{}'.format(version)

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

I tested the above patch in a chroot and the following was logged:

2022-08-19 18:35:09,866 DEBUG quirks: running jammyPostInitialUpdate
2022-08-19 18:35:09,866 DEBUG running Quirks.jammyPostInitialUpdate
2022-08-19 18:35:10,354 DEBUG running Quirks._test_and_fix_missing_nvidia_metapackage
2022-08-19 18:35:10,354 ERROR ubuntu-drivers-common not installed

tags: removed: rls-jj-incoming
Revision history for this message
Brian Murray (brian-murray) wrote :

The quirk only exists for Jammy, so I'm setting the Kinetic task to Invalid.

Changed in ubuntu-release-upgrader (Ubuntu Jammy):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Brian Murray (brian-murray)
Changed in ubuntu-release-upgrader (Ubuntu):
status: Confirmed → Invalid
Changed in ubuntu-release-upgrader (Ubuntu Jammy):
status: Triaged → In Progress
description: updated
description: updated
description: updated
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Rik, or anyone else affected,

Accepted ubuntu-release-upgrader into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/1:22.04.14 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in ubuntu-release-upgrader (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
mjbrauer (mjbrauer) wrote :

Hi Steve and Brian,

thank you for your effort, unfortunately i get the same error like before. I added the proposed repo like described and tried "do-release-upgrade -p".
You wrote you added the patch to jammy-proposed, hasn't it to be in focal-proposed when we try to upgrade from focal to jammy?

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

The release upgrade process downloads a tarball of the dist-upgrader code from the release to which you are upgrading so adding the patch to jammy-proposed is correct.

However, the file which tells the upgrade process which dist-upgrader to download is incorrect and I'll fix that shortly. For reference the file is at https://changelogs.ubuntu.com/meta-release-lts-proposed .

Thanks for testing and letting us know about the error!

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

In an sbuild chroot I installed ubuntu-release-upgrader-core and then ran 'do-release-upgrade -p'. The upgrade did not crash and here are the relevant portions of /var/log/dist-upgrade/main.log:

2022-09-07 15:57:29,456 INFO Using config files '['./DistUpgrade.cfg.focal']'
2022-09-07 15:57:29,456 INFO uname information: 'Linux impulse 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64'
2022-09-07 15:57:29,753 INFO apt version: '2.0.9'
2022-09-07 15:57:29,754 INFO python version: '3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0]'
2022-09-07 15:57:29,756 INFO release-upgrader version '22.04.14' started
...
2022-09-07 15:57:36,091 DEBUG quirks: running jammyPostInitialUpdate
2022-09-07 15:57:36,091 DEBUG running Quirks.jammyPostInitialUpdate
2022-09-07 15:57:36,586 DEBUG running Quirks._test_and_fix_missing_nvidia_metapackage
2022-09-07 15:57:36,587 ERROR ubuntu-drivers-common not installed

tags: added: verification-done verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
mjbrauer (mjbrauer) wrote :

Now it's working here too, thank you very much.

tags: added: foundations-todo
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-release-upgrader - 1:22.04.14

---------------
ubuntu-release-upgrader (1:22.04.14) jammy; urgency=medium

  * When upgrading from Ubuntu 20.04 or Ubuntu 20.10 require a version of apt
    which fixed a bug in apt (LP: 1871268) and prevents an early failure to
    upgrade. (LP: #1987452)
  * In the nvidia driver quirk handle the case where ubuntu-drivers-common is
    not installed on the system to be upgraded. (LP: #1985253)
  * Run pre-build.sh: updating mirrors and translations.

 -- Brian Murray <email address hidden> Tue, 23 Aug 2022 16:25:59 -0700

Changed in ubuntu-release-upgrader (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for ubuntu-release-upgrader has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

tags: removed: foundations-todo
Revision history for this message
M (freeesty) wrote :
Download full text (3.9 KiB)

unfortunatly the issue seems not to be fixed in my case. I'm running

Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal

in proxmox container.

apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

do-release-upgrade

Checking for a new Ubuntu release
Get:1 Upgrade tool signature [833 B]
Get:2 Upgrade tool [1270 kB]
Fetched 1271 kB in 0s (0 B/s)
authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg'
extracting 'jammy.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu focal InRelease
Hit http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit http://archive.ubuntu.com/ubuntu focal-security InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done

Restoring original system state

Aborting
Reading package lists... Done
Building dependency tree
Reading state information... Done

tail -f -n99 /var/log/dist-upgrade/main.log
2024-04-03 15:10:19,698 INFO Using config files '['./DistUpgrade.cfg.focal', '/etc/update-manager/release-upgrades.d/ubuntu-advantage-upgrades.cfg']'
2024-04-03 15:10:19,698 INFO uname information: 'Linux lamp 6.5.13-3-pve #1 SMP PREEMPT_DYNAMIC PMX 6.5.13-3 (2024-03-20T10:45Z) x86_64'
2024-04-03 15:10:20,121 INFO apt version: '2.0.10'
2024-04-03 15:10:20,121 INFO python version: '3.8.10 (default, Nov 22 2023, 10:22:35)
[GCC 9.4.0]'
2024-04-03 15:10:20,127 INFO release-upgrader version '22.04.19' started
2024-04-03 15:10:20,137 INFO locale: 'en_US' 'UTF-8'
2024-04-03 15:10:20,190 INFO screen could not be run
2024-04-03 15:10:20,211 WARNING estimate_kernel_initrd_size_in_boot() returned '0' for kernel?
2024-04-03 15:10:20,211 WARNING estimate_kernel_initrd_size_in_boot() returned '0' for initrd?
2024-04-03 15:10:20,226 DEBUG Using 'DistUpgradeViewText' view
2024-04-03 15:10:20,276 DEBUG enable dpkg --force-overwrite
2024-04-03 15:10:20,321 DEBUG creating statefile: '/var/log/dist-upgrade/apt-clone_system_state.tar.gz'
2024-04-03 15:10:21,980 DEBUG lsb-release: 'focal'
2024-04-03 15:10:21,980 DEBUG _pythonSymlinkCheck run
2024-04-03 15:10:21,981 DEBUG openCache()
2024-04-03 15:10:21,981 DEBUG quirks: running PreCacheOpen
2024-04-03 15:10:21,981 DEBUG running Quirks.PreCacheOpen
2024-04-03 15:10:22,840 DEBUG /openCache(), new cache size 89803
2024-04-03 15:10:22,841 DEBUG need_server_mode(): can not find a desktop meta package or key deps, running in server mode
2024-04-03 15:10:22,841 DEBUG checkViewDepends()
2024-04-03 15:10:22,841 DEBUG depends: 'apt (>= 2.0.4)'
2024-04-03 15:10:22,842 DEBUG checking: '[('apt', '2.0.4', '>=')]'
2024-04-03 15:10:22,842 DEBUG depends: 'libapt-pkg6.0 (>= 2.0.4)'
2024-04-03 15:10:22,842 DEBUG checking: '[('libapt-pkg6.0', '2.0.4', '>=')]'
2024-04-03 15:10:22,846 DEBUG running doUpdate() (showErrors=Fa...

Read more...

Revision history for this message
M (freeesty) wrote :

nevermind, the following ERROR regarding snap store caused the upgrade problem.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.