Kernels galore and no NVIDIA driver in sight

Keith keithw at caramail.com
Fri Dec 20 17:09:54 UTC 2024


On 12/20/24 8:19 AM, Little Girl wrote:
> Hey there,
> 
> I'm using Kubuntu 22.04 LTS and have gotten three new kernels in the
> past couple of days (!) and would like to sudo apt autoremove the
> oldest one, but am concerned about what that may do to my NVIDIA
> driver, which hasn't received an update despite all of these new
> kernels. Since the two are intertwined, I'm not sure what will happen
> if I get rid of the only kernel "known" to my NVIDIA driver or, worse
> yet, if there even is one on my system any more.
> 
> I thought I'd add that when I installed the OS, I opted in to let
> Ubuntu and NVIDIA manage my NVIDIA driver, so the drivers are built
> for the kernels automatically whenever there are NVIDIA updates and
> I'm under the impression that I'm supposed to keep my hands off of
> the drivers as a result of that.
> 
> ####################
> 
> After the latest update in which I got the third of the recent
> kernels, I did this command to check which kernel I'm using:
> 
> uname -r
> 
> That gave this output:
> 
> 5.15.0-130-generic
> 
> ####################
> 
> I did this command to see which kernels are currently installed:
> 
> apt list --installed | grep "linux-image"

$ man apt-patterns

It'll save you a little typing, and you won't have to pipe results to 
grep to filter out what you need as regex is built-in

$ apt list ~i~nlinux-image

> 
> That gave this output:
> 
> WARNING: apt does not have a stable CLI interface. Use with caution
> in scripts.

Add the following lines to a file and place it in /etc/apt/apt.conf.d/ 
In this case, it doesn't really matter what you name it, but it should 
have a .conf suffix. I named mine 90aptprefs.conf

apt::get::show-user-simulation-note "0";
apt::cmd::disable-script-warning "1";

First line turns off warning about running apt in simulation mode when 
you use the "-s" option with an apt command.

Second lines turns off the script warning that you listed above.

> 
> linux-image-5.15.0-127-generic/jammy-updates,jammy-security,now
> 5.15.0-127.137 amd64 [installed,auto-removable]
> linux-image-5.15.0-128-generic/jammy-updates,now 5.15.0-128.138 amd64
> [installed,automatic]
> linux-image-5.15.0-130-generic/jammy-updates,now 5.15.0-130.140 amd64
> [installed,automatic] linux-image-generic/jammy-updates,now
> 5.15.0.130.128 amd64 [installed,automatic]
> 
> ####################
> 
> I did this command (courtesy of Google) to see which NVIDIA modules
> are installed:
> 
> dpkg -l | grep -i nvidia
> 
> That gave me 118 lines of output (!!!), so I'm attaching it to this
> message as a text file instead of pasting it here. Can any of that be
> cleaned out? It seems excessive.

the entries that begin with "rc" means that those packages are not 
installed, but have been removed. However, they have config files that 
are still left on the system. You can remove them with apt

$ sudo apt -s purge ~c
the "-s" puts apt in simulation mode so you can see what its going to do 
when it executes the command without making any modifications to the 
system. The "~c" is an apt-pattern shortcut for configuration files.

You can also run the following command but I would check apt's sim 
output first to make sure nothing is removed unintentionally.

$ sudo apt -s autopurge

> 
> ####################
> 
> I ran this command (courtesy of Google) to display which kernel my
> NVIDIA driver is currently using:
> 
> modinfo /usr/lib/modules/$(uname -r)/kernel/drivers/video/nvidia.ko |
> grep version
> 
> That gave this output:
> 
> modinfo: ERROR: Module
> /usr/lib/modules/5.15.0-130-generic/kernel/drivers/video/nvidia.ko
> not found.
> 
> ####################
> 
> The ERROR word is never a good sign. I'm assuming it means that I'm
> not currently using the NVIDIA driver because it's floating out at
> sea and hasn't been given a boat. Oddly enough, everything looks
> fine, though.

the modinfo command internally runs "uname -r" and automatically 
searches "/lib/modules" for modules so you shouldn't have to specify a 
full path. But I would use lsmod to actually see what kernel modules are 
loaded since modinfo doesn't tell you if a module is in use or not. It 
just lists some module metadata, available parameters, device ids that 
it works with, and file location.

$ lsmod |grep -i nvidia
$ modinfo nvidia


> There are, at the time of this writing, no new updates whatsoever, so
> I'm hanging onto all of the kernels and keeping my hands off in high
> hopes that the NVIDIA team will produce something soon so that I can
> do my usual removal of the oldest, dustiest kernel.
> 
> Is there anything else I should be doing and/or can I clean up some of
> that huge mess from the attached file?
> 
> 
It looks like all the entries that have kernel specific versions in 
their package names are in "rc" status. So if you remove those (you'd be 
removing just the residual config files anyway since all other package 
files have already been removed), you'll be left with mostly 535 version 
nvidia packages which is likely what your running since you only have 
the 535 nvidia Xorg video driver package installed.

-- 
Keith




More information about the ubuntu-users mailing list