我正在运行一个标准的 Ubuntu 22.04 桌面,它是从 amd64 USB 映像安装的。除了我的 GPU 有 Nvidia 二进制驱动程序来为双显示器供电外,没有什么不寻常的。
几天前安装了更新,一天结束时关机,第二天早上开机 - 只有一个屏幕出现,X 启动大约需要 10 秒钟,通常几乎是立即启动,调查时我发现我使用的是 nouveau 驱动程序而不是 Nvidia。重新启动,使用 grub 选择另一个内核,注意 linux-image-6.2.0-xx-gcp 是默认内核,并且安装了大量其他不同版本的平台特定内核:
linux-image-5.15.0-1029-nvidia/jammy-updates,jammy-security,now 5.15.0-1029.29 amd64 [installed,automatic]
linux-image-5.15.0-1036-intel-iotg/jammy-updates,jammy-security,now 5.15.0-1036.41 amd64 [installed,automatic]
linux-image-5.15.0-1038-gcp/jammy-updates,jammy-security,now 5.15.0-1038.46 amd64 [installed,automatic]
linux-image-5.15.0-1039-oracle/jammy-updates,jammy-security,now 5.15.0-1039.45 amd64 [installed,automatic]
linux-image-5.15.0-1040-aws/jammy-updates,jammy-security,now 5.15.0-1040.45 amd64 [installed,automatic]
linux-image-5.15.0-78-generic/jammy-updates,jammy-security,now 5.15.0-78.85 amd64 [installed,automatic]
linux-image-5.15.0-78-lowlatency/jammy-updates,jammy-security,now 5.15.0-78.85 amd64 [installed,automatic]
linux-image-5.17.0-1035-oem/jammy-updates,jammy-security,now 5.17.0-1035.36 amd64 [installed,automatic]
linux-image-5.19.0-1014-nvidia-lowlatency/jammy-updates,jammy-security,now 5.19.0-1014.14 amd64 [installed,automatic]
linux-image-5.19.0-1014-nvidia/jammy-updates,jammy-security,now 5.19.0-1014.14 amd64 [installed,automatic]
linux-image-5.19.0-1027-gcp/jammy-updates,jammy-security,now 5.19.0-1027.29~22.04.1 amd64 [installed,automatic]
linux-image-5.19.0-1027-oracle/jammy-updates,jammy-security,now 5.19.0-1027.30 amd64 [installed,automatic]
linux-image-5.19.0-1029-aws/jammy-updates,jammy-security,now 5.19.0-1029.30~22.04.1 amd64 [installed,automatic]
linux-image-5.19.0-1030-lowlatency/jammy-updates,jammy-security,now 5.19.0-1030.30 amd64 [installed,automatic]
linux-image-5.19.0-50-generic/jammy-updates,jammy-security,now 5.19.0-50.50 amd64 [installed,automatic]
linux-image-6.0.0-1020-oem/jammy-updates,jammy-security,now 6.0.0-1020.20 amd64 [installed,automatic]
linux-image-6.1.0-1017-oem/jammy-updates,jammy-security,now 6.1.0-1017.17 amd64 [installed,automatic]
linux-image-6.2.0-1003-nvidia/jammy-updates,jammy-security,now 6.2.0-1003.3~22.04.1+1 amd64 [installed,automatic]
linux-image-6.2.0-1008-aws/jammy-updates,jammy-security,now 6.2.0-1008.8~22.04.1 amd64 [installed,automatic]
linux-image-6.2.0-1009-lowlatency/jammy-updates,jammy-security,now 6.2.0-1009.9~22.04.1 amd64 [installed,automatic]
linux-image-6.2.0-1010-gcp/jammy-updates,jammy-security,now 6.2.0-1010.10~22.04.1 amd64 [installed,automatic]
linux-image-6.2.0-26-generic/jammy-updates,jammy-security,now 6.2.0-26.26~22.04.1 amd64 [installed,automatic]
linux-image-generic/jammy-updates,jammy-security,now 5.15.0.78.75 amd64 [installed]
我从 grub 菜单中选择了另一个内核,一个屏幕空白但有背光,我无法在 VT 之间切换。另一个屏幕根本不亮。强制重启,一遍又一遍地选择各种内核,要么得到一个可以工作的显示器,要么什么都没有,直到意识到最低公分母是 5.15.0-78-generic,它可以启动,在安装 linux-image-generic 元包和 nvidia-driver-535 后,重新启动,再次使用 Nvidia 驱动程序为我提供双屏幕。
我不知道为什么安装了所有这些内核变体,我自己没有安装。我认为是某个打包错误将它们全部作为依赖项拉入,但当我尝试删除它们时,apt 坚持安装每个的 -unsigned 版本。我确实也发现了已安装的 -hwe 内核,但设法手动删除了它们,以及我在删除 linux-base-sgx 后设法卸载的 -azure 内核。我找不到任何论坛帖子或错误提到其他人遇到此问题。
我尝试回顾 apt 日志并使用 apt-rdepends 找出是什么引入了这些内核,但我仍然无法弄清楚,也无法删除它们。升级后,我的 apt history.log 中有以下内容,其中出现了所有这些内核:
Start-Date: 2023-07-26 09:54:25
Commandline: packagekit role='install-packages'
Requested-By: adam (1000)
Install: linux-image-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), libnvidia-common-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-objects-nvidia-525-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), linux-objects-nvidia-525-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1+2, automatic), linux-image-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), libnvidia-fbc1-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-fbc1-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-modules-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-modules-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), linux-modules-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1, automatic), libnvidia-gl-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-gl-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), linux-signatures-nvidia-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-modules-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-modules-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-modules-nvidia-535-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), linux-modules-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), linux-signatures-nvidia-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-signatures-nvidia-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), libnvidia-extra-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-signatures-nvidia-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), nvidia-compute-utils-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), nvidia-driver-535:amd64 (535.54.03-0ubuntu0.22.04.1), linux-modules-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic), dctrl-tools:amd64 (2.24-3build2, automatic), linux-image-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-image-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), linux-signatures-nvidia-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), libnvidia-encode-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-encode-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), nvidia-utils-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-image-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-signatures-nvidia-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), linux-signatures-nvidia-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), xserver-xorg-video-nvidia-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-image-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), linux-modules-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-modules-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), linux-image-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1+1, automatic), linux-objects-nvidia-525-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-modules-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), linux-image-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-objects-nvidia-525-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), linux-modules-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), libnvidia-decode-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-decode-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-image-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-objects-nvidia-535-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), nvidia-firmware-535-535.54.03:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-objects-nvidia-525-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-signatures-nvidia-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), linux-image-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), nvidia-kernel-common-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-modules-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-image-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-objects-nvidia-525-5.15.0-78-lowlatency:amd64 (5.15.0-78.85+1, automatic), linux-image-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-signatures-nvidia-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), linux-objects-nvidia-525-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), linux-modules-nvidia-535-generic-hwe-22.04:amd64 (5.19.0-50.50), linux-signatures-nvidia-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1+2, automatic), linux-modules-5.15.0-78-lowlatency:amd64 (5.15.0-78.85, automatic), linux-objects-nvidia-525-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-image-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-image-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-signatures-nvidia-6.2.0-1009-lowlatency:amd64 (6.2.0-1009.9~22.04.1, automatic), linux-image-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-objects-nvidia-525-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-modules-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), linux-image-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-image-5.15.0-78-lowlatency:amd64 (5.15.0-78.85, automatic), linux-image-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), linux-signatures-nvidia-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), linux-base-sgx:amd64 (4.5ubuntu9, automatic), linux-image-6.2.0-26-generic:amd64 (6.2.0-26.26~22.04.1, automatic), linux-modules-6.2.0-1003-nvidia:amd64 (6.2.0-1003.3~22.04.1, automatic), linux-image-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1, automatic), linux-modules-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-signatures-nvidia-5.15.0-1038-gcp:amd64 (5.15.0-1038.46, automatic), linux-modules-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-signatures-nvidia-5.15.0-78-lowlatency:amd64 (5.15.0-78.85+1, automatic), linux-modules-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), linux-image-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), linux-image-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1027-oracle:amd64 (5.19.0-1027.30, automatic), linux-signatures-nvidia-5.19.0-1030-lowlatency:amd64 (5.19.0-1030.30, automatic), linux-modules-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-objects-nvidia-525-6.2.0-1010-gcp:amd64 (6.2.0-1010.10~22.04.1, automatic), linux-signatures-nvidia-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-objects-nvidia-525-5.19.0-1014-nvidia-lowlatency:amd64 (5.19.0-1014.14, automatic), linux-modules-5.19.0-1014-nvidia:amd64 (5.19.0-1014.14, automatic), linux-objects-nvidia-525-5.19.0-1010-nvidia-lowlatency:amd64 (5.19.0-1010.10, automatic), linux-objects-nvidia-525-5.19.0-50-generic:amd64 (5.19.0-50.50, automatic), linux-image-5.15.0-1036-intel-iotg:amd64 (5.15.0-1036.41, automatic), libnvidia-cfg1-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), linux-objects-nvidia-525-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1+5, automatic), linux-modules-5.15.0-1040-aws:amd64 (5.15.0-1040.45, automatic), nvidia-kernel-source-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), linux-objects-nvidia-525-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-objects-nvidia-525-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), libnvidia-compute-535:amd64 (535.54.03-0ubuntu0.22.04.1, automatic), libnvidia-compute-535:i386 (535.54.03-0ubuntu0.22.04.1, automatic), linux-signatures-nvidia-5.15.0-1029-nvidia:amd64 (5.15.0-1029.29, automatic), linux-modules-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-signatures-nvidia-5.17.0-1035-oem:amd64 (5.17.0-1035.36, automatic), linux-signatures-nvidia-6.0.0-1020-oem:amd64 (6.0.0-1020.20, automatic), linux-signatures-nvidia-5.19.0-1027-gcp:amd64 (5.19.0-1027.29~22.04.1+5, automatic), linux-signatures-nvidia-5.19.0-1029-aws:amd64 (5.19.0-1029.30~22.04.1, automatic), linux-objects-nvidia-525-6.2.0-1008-aws:amd64 (6.2.0-1008.8~22.04.1, automatic), linux-modules-6.1.0-1017-oem:amd64 (6.1.0-1017.17, automatic), linux-objects-nvidia-525-5.15.0-1042-azure:amd64 (5.15.0-1042.49, automatic), dkms:amd64 (2.8.7-2ubuntu2.2, automatic), linux-modules-5.15.0-78-generic:amd64 (5.15.0-78.85, automatic), linux-image-5.15.0-1039-oracle:amd64 (5.15.0-1039.45, automatic), linux-signatures-nvidia-6.2.0-1008-azure:amd64 (6.2.0-1008.8~22.04.1, automatic)
从现在开始我必须告诉 grub 默认启动我正在运行的内核,并且每次我获得内核更新时我都必须在 grub 菜单中手动选择最新的 5.15.0-xx-generic 内核,直到我可以删除所有那些不必要的内核。
有人能帮我弄清楚如何删除它们吗?
答案1
每次我获得内核更新时,我都必须在 grub 菜单中手动选择最新的 5.15.0-xx-generic 内核,直到我可以删除所有那些不必要的内核。
不。看/etc/default/grub
。你需要
GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
然后执行sudo update-grub
,重新启动,并选择一次所需的内核。下次启动将使用该选择。
有人能帮我弄清楚如何删除它们吗?
开始:
sudo apt autoremove
这将自动删除旧内核。
列出所有已安装的:dpkg --list | egrep -i --color 'linux-image|linux-headers|linux-modules' | awk '{ print $2 }' > kernels.txt
它将在文件中创建一个列表kernels.txt
。编辑它并删除所有你想保留的内容。或者使用grep -v $(uname -r) kernels.txt > kernels.txt
并确认grep $(uname -r) kernels.txt
没有显示任何内容。这将删除它们:
cat kernels.txt | xargs sudo apt purge -y
我不知道为什么要安装所有这些内核变体,我自己没有这么做。
我认为您确实安装了它们。22.10 从内核 5.19 开始。可能是您安装了 HWE?检查一下/etc/lsb-release
。
答案2
我今天在使用 22.04 时遇到了同样的问题。不久前在使用 23.04 时也遇到了这个问题。所有内核都已下载。我已自动下载安全更新。如果您安装它们,那么下次我运行更新程序时,它会自动删除其中的大部分。然后重新安装它们。我不明白。我一直在更改 grub 以使用我选择的最后一个内核来保持机器运行。23.04 也是如此。我搜索了解决这个问题的方法,但找不到任何解决方案。
然后我将软件和更新自动更改为从不。我使用时间机器将系统恢复到这一切开始前几天。
我注意到的一件事是使用更新程序进行更新与使用终端 apt update and upgrade 进行更新之间存在差异。这些内核没有出现在我的系统中。这很奇怪。