nvidia drivers do not update initramfs properly

Bug #1947043 reported by Erich Eickmeyer
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-restricted-modules (Ubuntu)
New
Undecided
Unassigned
Bionic
New
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Hirsute
New
Undecided
Unassigned
Impish
Won't Fix
Undecided
Unassigned
nvidia-graphics-drivers-470 (Ubuntu)
New
Undecided
Unassigned
Bionic
New
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Hirsute
Won't Fix
Undecided
Unassigned
Impish
Won't Fix
Undecided
Unassigned

Bug Description

When Nvidia drivers are installing, they are only rebuilding the initramfs for the currently running kernel and/or the newest kernel when installed. Unfortunately, that means that if one has two kernel flavors installed (such as -generic and -lowlatency) this means that the initramfs is only getting rebuild for the currently installed kernel flavor and its newest version. When a user then switches to the other kernel flavor, their video fails because the kernel they switched to does not have the kernel module in the initramfs despite the kernel module being compiled and available.

The root cause seems to be in nvidia-kernel-common-*.postinst and nvidia-dkms-*.postinst:

        # Update initramfs so that the blacklist ends up in the initramfs
        if [ -x /usr/sbin/update-initramfs ]; then
            /usr/sbin/update-initramfs -u

            if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then
                # This can fail when dealing with a chroot see LP: #556653
                /usr/sbin/update-initramfs -u -k $CURRENT_KERNEL
            fi
        fi

Instead of looking for the conditions to be met, this should be rebuilding for *all* installed kernels, despite the longer amount of time needed to do so in some cases. The rationale is that systems should work as expected and saving time, in this case, can cause that not to happen. As such the postinst scripts should do the following in lieu of the above:

    /usr/sbin/update-initramfs -u -k all

This ensures that all installed kernel initramfs images get rebuilt, which adds increased safety at the expense of speed during the install. This will also prevent a race condition where, if a kernel and the nvidia driver are updated at the same time, that the proper initramfs image will exist despite which order the nvidia driver and kernel get installed.

ProblemType: Bug
DistroRelease: Ubuntu 21.10
Package: nvidia-driver-470 470.74-0ubuntu1
ProcVersionSignature: Ubuntu 5.13.0-19.19-lowlatency 5.13.14
Uname: Linux 5.13.0-19-lowlatency x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu70
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: KDE
Date: Wed Oct 13 13:12:23 2021
InstallationDate: Installed on 2021-03-20 (206 days ago)
InstallationMedia: Ubuntu-Studio 21.04 "Hirsute Hippo" - Alpha amd64 (20210320)
SourcePackage: nvidia-graphics-drivers-470
UpgradeStatus: Upgraded to impish on 2021-06-13 (122 days ago)

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

Why are you using dkms modules, instead of signed lrm modules?

Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

We're using whatever nvidia-driver-470 pulls in.

Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

@xnox:

Upon investigation, and per our conversation on IRC, I did some experimenting with the prebuilt modules. Unfortunately, these use llvmpipe and don't interface well with nvidia-settings.

Using ubuntu-drivers to install the drivers used *the exact same mechanism* as installing nvidia-drivers-470 directly, but also configured our systems to use the hybrid graphics mode, which has been known to cause performance issues on our branded CLEVO chassis computers especially when connected to external displays.

Your suggestions were good, but in this instance they don't make a whole lot of sense. I do, however, understand your reluctance to rebuild all initramfs for each kernel as it might break things. I feel as though we can probably close this bug as your rationale is sound, and the mechanism we have works for our customers.

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

The Hirsute Hippo has reached End of Life, so this bug will not be fixed for that release.

Changed in nvidia-graphics-drivers-470 (Ubuntu Hirsute):
status: New → Won't Fix
Revision history for this message
Brian Murray (brian-murray) wrote :

Ubuntu 21.10 (Impish Indri) has reached end of life, so this bug will not be fixed for that specific release.

Changed in nvidia-graphics-drivers-470 (Ubuntu Impish):
status: New → Won't Fix
Changed in linux-restricted-modules (Ubuntu Impish):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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