Nvidia drivers are marked as "auto" at installation and thus removed by `apt autoremove`

Bug #1955047 reported by quazgar
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ubiquity (Ubuntu)
Incomplete
Critical
Unassigned
Jammy
Incomplete
Critical
Unassigned
ubuntu-release-upgrader (Ubuntu)
Invalid
Critical
Unassigned
Jammy
Fix Released
Critical
Unassigned

Bug Description

[Impact]
The installer doesn't install the nvidia-driver-* metadata on 20.04.3 Desktop, which means that on
upgrade the user will be prompted to remove the actual driver packages as the final step of the install,
which will likely break their user session.

[Test plan]

This test plan is for the fix in ubuntu-release-upgrader:

On a system with a nvidia GPU:
* Install 20.04.3 with proprietary drivers enabled:
  https://old-releases.ubuntu.com/releases/focal/ubuntu-20.04.3-desktop-amd64.iso
* `sudo apt -s autoremove` should list quite a few libnvidia* packages, including libnvidia-gl-*
* Manually download the -proposed upgrader since jammy isn't available for LTS upgrades yet:
  $ mkdir -p /tmp/u-r-u && wget http://archive.ubuntu.com/ubuntu/dists/jammy-proposed/main/dist-upgrader-all/current/jammy.tar.gz && tar -xaf jammy.tar.gz -C /tmp/u-r-u
  $ cd /tmp/u-r-u
  $ ./jammy
    -> At the end of the upgrade process, the only nvidia packages that should be up for removal are kernel modules for obsolete kernel

On the nvidia-enabled system (test that the fix doesn't break systems that are working)
* Install 21.10 with proprietary drivers enabled
  https://old-releases.ubuntu.com/releases/impish/ubuntu-21.10-desktop-amd64.iso
* Fix the sources.list as noted there: https://help.ubuntu.com/community/EOLUpgrades#Update_sources.list
* dpkg -l | grep libnvidia-gl- should return one package
* sudo apt -s autoremove shouldn't list that same package
* do-release-upgrade -p
  -> fully functional system at the end including nvidia drivers

[Potential regressions]Potential regressions include:
* Crashing the upgrader, preventing users from upgrading
* Installing the nvidia proprietary stack on systems without user consent
* Totally breaking the graphics stack for desktop users

[Original report]
When installing Ubuntu 20.04 LTS and choosing the proprietary Nvidia drivers, they seem to be marked as "auto". Consequently, any subsequent `apt` commands recommend to call `apt autoremove`:

```
root@ubuntu-nvidia:~# apt-get install htop
Reading package lists... Done
Building dependency tree
Reading state information... Done
htop is already the newest version (2.2.0-2build1).
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libatomic1:i386 libbsd0:i386 libdrm-amdgpu1:i386
libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386
libexpat1:i386 libffi7:i386 libglvnd0:i386 libgstreamer-plugins-bad1.0-0 libllvm12:i386
libnvidia-cfg1-390 libnvidia-common-390 libnvidia-compute-390:i386 libnvidia-decode-390
libnvidia-decode-390:i386 libnvidia-encode-390 libnvidia-encode-390:i386 libnvidia-fbc1-390
libnvidia-gl-390 libnvidia-gl-390:i386 libnvidia-ifr1-390 libpciaccess0:i386 libsensors5:i386
libstdc++6:i386 libva-wayland2 libvulkan1:i386 libwayland-client0:i386 libx11-6:i386
libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386
libxcb-present0:i386 libxcb-randr0:i386 libxcb-shm0:i386 libxcb-sync1:i386 libxcb-xfixes0:i386
libxcb1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxnvctrl0 libxshmfence1:i386
libxxf86vm1:i386 mesa-vulkan-drivers:i386 nvidia-compute-utils-390 nvidia-kernel-source-390
nvidia-prime nvidia-settings nvidia-utils-390 screen-resolution-extra xserver-xorg-video-nvidia-390
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 142 not upgraded.
```

Calling `apt autoremove`, of course results in removal of drivers which are necessary for X11 to start. At the next boot attempt, the user will be presented with just a black screen and possibly some information about a successful fsck on /dev/sda2.

Related branches

Revision history for this message
quazgar (quazgar) wrote :

Workaround: Install the Nvidia package manually, for example `apt install nvidia-384` (or whichever version works best for your hardware).

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1955047/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
affects: ubuntu → ubiquity (Ubuntu)
Revision history for this message
Steve Langasek (vorlon) wrote :

this is going to require follow-up handling in ubuntu-release-upgrader to fix the state on upgrade to 22.04.

Changed in ubiquity (Ubuntu):
importance: Undecided → Critical
Changed in ubuntu-release-upgrader (Ubuntu):
importance: Undecided → Critical
Steve Langasek (vorlon)
tags: added: fr-1937
Revision history for this message
Steve Langasek (vorlon) wrote :

Please attach the contents of /var/log/installer from the affected system.

Changed in ubiquity (Ubuntu Jammy):
status: New → Incomplete
Revision history for this message
Brian Murray (brian-murray) wrote (last edit ):

I tested an installation of Focal using the Ubuntu 20.04.3 installation media (and choosing to install restricted software) and while I didn't have nvidia hardware some packages were suggested for auto-removal - chromium-codecs-ffmpeg-extra, gstreamer1.0-vaapi, libgstreamer-plugins-bad1.0-0 and libva-wayland2. These were also in the autoremove list for the reporter.

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

Attached is /var/log/installer/syslog

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
Revision history for this message
Brian Murray (brian-murray) wrote :

Testing this again today I discovered that "ubuntu-restricted-addons" was not installed on the resultant system and that by installing it nothing was autoremovable anymore.

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

I tested a daily install of Ubuntu 20.04 from 20220131 and no packages are suggested for autoremoval and ubuntu-restricted-addons was installed after the reboot. However, I didn't test with nvidia hardware so its possible the bug in the original description still exists.

Additionally, Steve's point about this needing fixing in ubuntu-release-upgrader might still apply in that systems that install from Ubuntu 20.04.3 media may have had packages autoremoved that should not have been.

Revision history for this message
Simon Chopin (schopin) wrote :

I installed a new Focal desktop on a machine with a NVidia discrete GPU yesterday using a daily ISO, and the resulting system didn't have any package marked to autoremove. The nvidia-driver-510 package was marked as manually installed, but its dependencies were correctly marked as auto-installed.

Changed in ubuntu-release-upgrader (Ubuntu Jammy):
milestone: none → ubuntu-22.04.1
Revision history for this message
Simon Chopin (schopin) wrote :
Revision history for this message
Chris Halse Rogers (raof) wrote : Proposed package upload rejected

An upload of ubuntu-release-upgrader to jammy-proposed has been rejected from the upload queue for the following reason: "Contains Python cache detritus".

Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello quazgar, 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.13 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: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-jammy
Simon Chopin (schopin)
description: updated
Simon Chopin (schopin)
description: updated
Revision history for this message
Simon Chopin (schopin) wrote :

I verified by following the steps detailed above, as well as trying out some other upgrade scenarios to watch for regressions.

tags: added: verification-done-jammy
removed: verification-needed verification-needed-jammy
Revision history for this message
Brian Murray (brian-murray) wrote :

This only affects the upgrade path from Focal to Jammy so fixing it in Kinetic is unnecessary. Although maybe we should still have this safety check in place as it doesn't hurt anything.

Changed in ubuntu-release-upgrader (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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

  [ Simon Chopin ]
  * Add a quirk to resolve an issue where the nvidia driver would get
    suggested for autoremoval. (LP: #1955047)

  [ Steve Langasek ]
  * On upgrade to 22.04, detect the presence of pam_tally* in /etc/pam.d and
    block the upgrade early, to avoid an abort from libpam-modules in the
    middle of the apt upgrade. LP: #1977493.
  * Run pre-build.sh: updating mirrors and translations.

 -- Steve Langasek <email address hidden> Tue, 02 Aug 2022 17:15:07 -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.

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

Other bug subscribers

Bug attachments