nvidia drivers do not update initramfs properly

Bug #1947043 reported by Erich Eickmeyer 
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-restricted-modules (Ubuntu)
Undecided
Unassigned
Bionic
Undecided
Unassigned
Focal
Undecided
Unassigned
Hirsute
Undecided
Unassigned
Impish
Undecided
Unassigned
nvidia-graphics-drivers-470 (Ubuntu)
Undecided
Unassigned
Bionic
Undecided
Unassigned
Focal
Undecided
Unassigned
Hirsute
Undecided
Unassigned
Impish
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.

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

Other bug subscribers