Ubuntu 无法更新:“需要重新安装软件包 linux-modules-5.19.0-32-generic”,但我找不到它的存档

Ubuntu 无法更新:“需要重新安装软件包 linux-modules-5.19.0-32-generic”,但我找不到它的存档

每次我尝试使用sudo apt 升级我收到此错误:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: The package linux-modules-5.19.0-32-generic needs to be reinstalled, but I can't find an archive for it.

Gnome 软件无法运行。如果我尝试,系统托盘中会出现一个带有白线的红色圆圈,并显示一条错误消息: 错误消息的屏幕截图

我一直尝试按照这篇文章中的说明来修复它:我在 18.04 LTS 上的包管理器中遇到了问题。显然,这与我遇到问题的 Ubuntu 版本不同,但问题似乎是相同的。

我已经下载了与缺失软件包最接近的 .deb 软件包https://ubuntu.pkgs.org/22.04/ubuntu-updates-main-amd64/linux-modules-5.19.0-41-generic_5.19.0-41.42~22.04.1_amd64.deb.html

这是我能得到的最接近的答案,但尝试在本地安装它只会sudo apt install抛出上面相同的错误消息。

这些信息可能有用。ls -la /etc/apt/sources.list 的输出:

-rw-r--r-- 1 root root 838 May 20 15:15 /etc/apt/sources.list

uname -a 的输出:

Linux slug 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/apt/sources.list 的输出:

deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ jammy partner
# deb-src http://archive.canonical.com/ubuntu/ jammy partner

sudo dpkg-reconfigure -a 的输出:

Unknown option: a

在评论中 Marco 建议将此代码的更正形式改为

dpkg --configure -a

这根本不会产生任何输出。终端中只会出现另一行带有 ~$ 的内容。

dpkg -l | egrep linux-'[g|i|h|m]' 的输出符合以下要求没有人

ii  linux-generic-hwe-22.04                    5.15.0.60.58                            amd64        Complete Generic Linux kernel and headers
ii  linux-headers-5.15.0-58                    5.15.0-58.64                            all          Header files related to Linux kernel version 5.15.0
ii  linux-headers-5.15.0-58-generic            5.15.0-58.64                            amd64        Linux kernel headers for version 5.15.0 on 64 bit x86 SMP
ii  linux-headers-5.15.0-60                    5.15.0-60.66                            all          Header files related to Linux kernel version 5.15.0
ii  linux-headers-5.15.0-60-generic            5.15.0-60.66                            amd64        Linux kernel headers for version 5.15.0 on 64 bit x86 SMP
ii  linux-headers-generic-hwe-22.04            5.15.0.60.58                            amd64        Generic Linux kernel headers
rc  linux-image-5.15.0-43-generic              5.15.0-43.46                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-56-generic              5.15.0-56.62                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-57-generic              5.15.0-57.63                            amd64        Signed kernel image generic
ii  linux-image-5.15.0-58-generic              5.15.0-58.64                            amd64        Signed kernel image generic
ii  linux-image-5.15.0-60-generic              5.15.0-60.66                            amd64        Signed kernel image generic
ii  linux-image-generic-hwe-22.04              5.15.0.60.58                            amd64        Generic Linux kernel image
rc  linux-modules-5.15.0-43-generic            5.15.0-43.46                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-56-generic            5.15.0-56.62                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-57-generic            5.15.0-57.63                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-5.15.0-58-generic            5.15.0-58.64                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-5.15.0-60-generic            5.15.0-60.66                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
iHR linux-modules-5.19.0-32-generic            5.19.0-32.33~22.04.1                    amd64        (no description available)
rc  linux-modules-extra-5.15.0-43-generic      5.15.0-43.46                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-56-generic      5.15.0-56.62                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-57-generic      5.15.0-57.63                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.15.0-58-generic      5.15.0-58.64                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.15.0-60-generic      5.15.0-60.66                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP

答案1

请注意,这是暴力破解,该包不再可用。

sudo dpkg -P --force-remove-reinstreq linux-modules-5.19.0-32-generic

这样,软件包的某些部分就可能保留在您的系统上。

更多力量

sudo dpkg -P --force-all linux-modules-5.19.0-32-generic

为了避免此类问题,请配置 apt 以不删除下载的软件包

cat /etc/apt/apt.conf.d/01keep-debs 
# Heruntergeladene Pakete behalten.
Binary::apt::APT::Keep-Downloaded-Packages "true";
APT::Get::Keep-Downloaded-Packages "true";
Binary::apt-get::APT::Keep-Downloaded-Packages "true";

所以我可以使用 /var/cache/apt/archives/ 下的本地缓存

相关内容