我有一台 Dell Precision 64 位笔记本电脑,在更新 Ubuntu 20.10 上的软件包时遇到了问题。我的机器上安装了几个内核,这些内核是我从 Ubuntu 获得的常规更新的一部分。但在更新到 linux-image-5.8.0-31-generic 后,我开始遇到问题。所以我目前使用的是内核 5.8.0-29-generic。除了我尝试更新任何软件包时,一切都运行良好。当我这样做时apt upgrade
,我收到以下错误。
sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package linux-modules-extra-5.8.0-31-generic needs to be reinstalled, but an archive for it can't be found.
以下是操作系统详细信息
lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.10
Release: 20.10
Codename: groovy
uname -a
Linux precision-3541 5.8.0-29-generic #31-Ubuntu SMP Fri Nov 6 12:37:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
当我列出所有内核时,我得到以下信息
╭─ ~ ✔ 1126 19:12:21
╰─ sudo dpkg --list | egrep -i --color 'linux-image|linux-headers'
ii linux-headers-4.15.0-1037-oem 4.15.0-1037.42 amd64 Linux kernel headers for version 4.15.0 on 64 bit x86 SMP
ii linux-headers-5.8.0-28 5.8.0-28.30 all Header files related to Linux kernel version 5.8.0
ii linux-headers-5.8.0-28-generic 5.8.0-28.30 amd64 Linux kernel headers for version 5.8.0 on 64 bit x86 SMP
ii linux-headers-5.8.0-29 5.8.0-29.31 all Header files related to Linux kernel version 5.8.0
ii linux-headers-5.8.0-29-generic 5.8.0-29.31 amd64 Linux kernel headers for version 5.8.0 on 64 bit x86 SMP
ii linux-headers-generic 5.8.0.29.34 amd64 Generic Linux kernel headers
rc linux-image-4.15.0-1037-oem 4.15.0-1037.42 amd64 Signed kernel image oem
ii linux-image-4.15.0-1081-oem 4.15.0-1081.91 amd64 Signed kernel image oem
rc linux-image-5.4.0-31-generic 5.4.0-31.35 amd64 Signed kernel image generic
rc linux-image-5.4.0-33-generic 5.4.0-33.37 amd64 Signed kernel image generic
rc linux-image-5.4.0-37-generic 5.4.0-37.41 amd64 Signed kernel image generic
rc linux-image-5.4.0-39-generic 5.4.0-39.43 amd64 Signed kernel image generic
rc linux-image-5.4.0-40-generic 5.4.0-40.44 amd64 Signed kernel image generic
rc linux-image-5.4.0-42-generic 5.4.0-42.46 amd64 Signed kernel image generic
rc linux-image-5.4.0-45-generic 5.4.0-45.49 amd64 Signed kernel image generic
rc linux-image-5.4.0-48-generic 5.4.0-48.52 amd64 Signed kernel image generic
rc linux-image-5.4.0-52-generic 5.4.0-52.57 amd64 Signed kernel image generic
rc linux-image-5.8.0-26-generic 5.8.0-26.27 amd64 Signed kernel image generic
ii linux-image-5.8.0-28-generic 5.8.0-28.30 amd64 Signed kernel image generic
ii linux-image-5.8.0-29-generic 5.8.0-29.31 amd64 Signed kernel image generic
iU linux-image-5.8.0-31-generic 5.8.0-31.33 amd64 Signed kernel image generic
iU linux-image-generic 5.8.0.31.36 amd64 Generic Linux kernel image
如果我尝试删除内核,也会得到同样的错误
╭─ ~ 1 ↵ 1122 19:10:17
╰─ sudo apt remove linux-image-5.8.0-31-generic --verbose-versions
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package linux-modules-extra-5.8.0-31-generic needs to be reinstalled, but an archive for it can't be found.
我不知道还有什么办法可以解决这个问题。有人能帮我解决这个问题吗?
答案1
我建议使用以下命令对有问题的软件包进行低级删除:
sudo dpkg -P --force-all linux-modules-extra-5.8.0-31-generic
sudo dpkg -P --force-all $(dpkg --list | egrep -i --color 'linux-image|linux-headers' | grep ^rc | awk '{print $2}')
然后删除剩余的内核包
sudo apt-get update
sudo apt-get install byobu
sudo purge-old-kernels
最后安装最新升级
sudo apt-get dist-upgrade
答案2
尝试
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get 更新