我正在尝试升级 Firefox,但提示我需要重新安装 linux-headers 4.4.0-98。我尝试安装,但出现的情况是“需要重新安装 linux-headers 软件包,但我找不到它的存档”。
答案1
首先尝试修复缺失功能
sudo apt upgrade --fix-missing
其次,尝试从命令行安装标头:
也许您只需要这些特定的标题(linux-headers-4.4.0-98-generic):
sudo apt install linux-headers-4.4.0-98-generic
如果这不起作用,请查看您使用的内核类型(通用、低延迟等):
uname -r
这将返回类似“4.15.0-30-generic”或“4.15.0-30-lowlatency”的内容。安装/重新安装与您的内核类型相对应的标头。例如,如果它是通用内核(最有可能):
sudo apt install --reinstall linux-headers-generic
这将导致当前内核的当前标头自动安装和升级。
如果以上方法不起作用,请尝试以下操作:
更新至最新内核:
sudo apt update && sudo apt upgrade
重新启动以确保您使用的是最新内核。
清除旧标题并删除未使用的应用程序/内核:
sudo apt remove --purge linux-headers-*
sudo apt autoremove && sudo apt autoclean
重新安装标题:
sudo apt install linux-headers-generic
答案2
这些命令对我有用。
寻找linux-headers-4.4.0-98
$ apt-cache search linux-headers-4.4.0-98
linux-headers-4.4.0-98 - Header files related to Linux kernel version 4.4.0
linux-headers-4.4.0-98-generic - Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
linux-headers-4.4.0-98-lowlatency - Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
安装linux-headers-4.4.0-98
要重新安装,您需要输入:
sudo apt install --reinstall linux-headers-4.4.0-98-generic
但对我自己来说这是一个新包所以我会使用:
$ sudo apt install linux-headers-4.4.0-98-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
linux-headers-4.4.0-98
The following NEW packages will be installed:
linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.7 MB of archives.
After this operation, 78.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-98 all 4.4.0-98.121 [9,913 kB]
Get:2 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-98-generic amd64 4.4.0-98.121 [793 kB]
Fetched 10.7 MB in 3s (3,463 kB/s)
Selecting previously unselected package linux-headers-4.4.0-98.
(Reading database ... 288111 files and directories currently installed.)
Preparing to unpack .../linux-headers-4.4.0-98_4.4.0-98.121_all.deb ...
Unpacking linux-headers-4.4.0-98 (4.4.0-98.121) ...
Selecting previously unselected package linux-headers-4.4.0-98-generic.
Preparing to unpack .../linux-headers-4.4.0-98-generic_4.4.0-98.121_amd64.deb ...
Unpacking linux-headers-4.4.0-98-generic (4.4.0-98.121) ...
Setting up linux-headers-4.4.0-98 (4.4.0-98.121) ...
Setting up linux-headers-4.4.0-98-generic (4.4.0-98.121) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
消除linux-headers-4.4.0-98
因为这是一个测试,我不需要在我的计算机上使用它们:
$ sudo apt remove --purge linux-headers-4.4.0-98-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
linux-headers-4.4.0-98
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
linux-headers-4.4.0-98-generic*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 7,431 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 314874 files and directories currently installed.)
Removing linux-headers-4.4.0-98-generic (4.4.0-98.121) ...
dpkg: warning: while removing linux-headers-4.4.0-98-generic, directory '/lib/modules/4.4.0-98-generic' not empty so not removed
清理剩余垃圾
我看到最后一行还有剩余的垃圾,所以我将手动清理它:
$ sudo rm -rf /lib/modules/4.4.0-98-generic
$ ll /lib/modules/4.4.0-98-generic
ls: cannot access '/lib/modules/4.4.0-98-generic': No such file or directory
现在4.4.0-98
几乎被删除了。使用以下命令可将其完全删除:
sudo apt autoremove
答案3
如果您有互联网连接...
运行software-properties-gtk
。在 Ubuntu 软件选项卡中,注意下载自字段。你那里有什么?(我使用“ubuntu.trumpetti.atm.tut.fi/ubuntu”,因为我住在芬兰;至少该服务器目前有 linux-headers-4.4.0-98。)尝试更改字段中的设置。在更新选项卡中,查看是否已选中“重要安全更新”。按照对话框的要求进行操作。然后关闭它。然后在终端中执行以下操作(但请停止,如果有错误,请在评论中报告。):
sudo apt install --reinstall linux-headers-4.4.0-98
sudo apt-mark auto linux-headers-4.4.0-98
sudo apt install linux-generic
并运行update-manager
安装进一步的更新。
如果您没有互联网连接...
如果问题是你没有互联网连接,但你有 Ubuntu CD-ROM/DVD 安装介质,你可以将其用作软件源,请参阅这里。如果您没有光盘,但有 USB 介质,请尝试这。
检查媒体是否包含其他内核:
apt-cache policy linux-generic
如果它包含不同的版本,你最好清除 4.4.0-98 标头:
sudo dpkg --purge --force-remove-reinstreq linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic
并从媒体安装内核:
sudo apt install linux-generic
最后清除旧的内核映像:
sudo apt purge linux-image-4.4.0-98-generic
答案4
尝试了上述许多选项后,(也许有帮助)我尝试了以下命令并且有效:
sudo apt --fix-broken install
我希望它对其他人也有效...