无法在 debianstretch/Debian 9 上更新 Linux 标头

无法在 debianstretch/Debian 9 上更新 Linux 标头

运行以下命令后出现错误:

# apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-headers-4.9.0-3-amd64
E: Couldn't find any package by glob 'linux-headers-4.9.0-3-amd64'
E: Couldn't find any package by regex 'linux-headers-4.9.0-3-amd64'

为了排除故障,我检查了以下内容:

# apt-cache search linux-headers
aufs-dkms - DKMS files to build and install aufs
linux-libc-dev-arm64-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-armel-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-armhf-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-mips-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-mips64el-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-mipsel-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-ppc64el-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-s390x-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-alpha-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-hppa-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-m68k-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-mips64-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-powerpc-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-powerpcspe-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-ppc64-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-sh4-cross - Linux Kernel Headers for development (for cross-compiling)
linux-libc-dev-sparc64-cross - Linux Kernel Headers for development (for cross-compiling)
linux-headers-4.9.0-11-all - All header files for Linux 4.9 (meta-package)
linux-headers-4.9.0-11-all-amd64 - All header files for Linux 4.9 (meta-package)
linux-headers-4.9.0-11-amd64 - Header files for Linux 4.9.0-11-amd64
linux-headers-4.9.0-11-common - Common header files for Linux 4.9.0-11
linux-headers-4.9.0-11-common-rt - Common header files for Linux 4.9.0-11-rt
linux-headers-4.9.0-11-rt-amd64 - Header files for Linux 4.9.0-11-rt-amd64
linux-headers-amd64 - Header files for Linux amd64 configuration (meta-package)
linux-headers-rt-amd64 - Header files for Linux rt-amd64 configuration (meta-package)```


and 

# apt-cache search linux-image
linux-headers-4.9.0-11-amd64 - Header files for Linux 4.9.0-11-amd64
linux-headers-4.9.0-11-rt-amd64 - Header files for Linux 4.9.0-11-rt-amd64
linux-image-4.9.0-11-amd64 - Linux 4.9 for 64-bit PCs
linux-image-4.9.0-11-amd64-dbg - Debug symbols for linux-image-4.9.0-11-amd64
linux-image-4.9.0-11-rt-amd64 - Linux 4.9 for 64-bit PCs, PREEMPT_RT
linux-image-4.9.0-11-rt-amd64-dbg - Debug symbols for linux-image-4.9.0-11-rt-amd64
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-amd64-dbg - Debugging symbols for Linux amd64 configuration (meta-package)
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT
linux-image-rt-amd64-dbg - Debugging symbols for Linux rt-amd64 configuration (meta-package)
linux-image-4.9.0-3-amd64 - Linux 4.9 for 64-bit PCs

运行后 apt-cache 搜索 linux-image我明白了linux-image-4.9.0-3-amd64我想要的内核版本apt-cache 搜索 linux-headers命令也。

很少有人建议更改sources.list然后尝试。但由于我是新手,我不知道如何搜索 resources.list 的正确链接以及最适合解决我的问题的方法。

我在谷歌上搜索但没有找到解决方案。任何可以提供解决方案的链接或解决方案都会有很大的帮助。

答案1

为了

apt-get install linux-headers-$(uname -r)

为了工作,你需要跑步仍可从发行版存储库获取的内核;在大多数情况下,这基本上意味着您需要为您的发行版运行最新支持的内核。

在 Debian 上,最简单的选项是

apt-get update
apt-get install linux-image-amd64 linux-headers-amd64

(调整到您的体系结构)以获取当前内核和匹配的标头,然后重新启动。

答案2

linux-headers-4.9.0-3-amd64过时,已将其删除并替换为更新的软件包linux-headers-4.9.0-11-amd64这就是为什么您无法从常规存储库安装它的原因。

您可以安装linux-headers-4.9.0-3-amd64来自快照存档存储库:

编辑您的来源列表:

nano /etc/apt/sources.list.d/snapshot.list

添加以下行:

deb http://snapshot.debian.org/archive/debian/20170609T034604Z stretch main
deb http://snapshot.debian.org/archive/debian/20170609T034604Z stretch-updates main
deb http://snapshot.debian.org/archive/debian-security/20170920T221221Z stretch/updates main

然后:

apt -o Acquire::Check-Valid-Until=false update
apt install linux-headers-4.9.0-3-amd64

要使用 Valid-Until 访问十几天前的套件快照,有必要忽略 Release 文件中的 Valid-Until 标头,以防止 apt 忽略快照条目(“Release 文件已过期”)。为此目的使用aptitude -o Acquire::Check-Valid-Until=false update或更新。apt-get -o Acquire::Check-Valid-Until=false

答案3

在我提交命令后,这对我有用:apt-cache search linux-headers。我linux-headers-5.4.0-1009-oracle从列表中选择。我使用的是 Windows 10 专业版!

sudo apt-get install linux-headers-5.4.0-1009-oracle
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  linux-oracle-headers-5.4.0-1009
The following NEW packages will be installed:
  linux-headers-5.4.0-1009-oracle linux-oracle-headers-5.4.0-1009
0 upgraded, 2 newly installed, 0 to remove and 21 not upgraded.
Need to get 12.2 MB of archives.
After this operation, 87.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 linux-oracle-headers-5.4.0-1009 all 5.4.0-1009.9 [11.0 MB]Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 linux-headers-5.4.0-1009-oracle amd64 5.4.0-1009.9 [1244 kB]
Fetched 12.2 MB in 1min 12s (170 kB/s)
Selecting previously unselected package linux-oracle-headers-5.4.0-1009.
(Reading database ... 99989 files and directories currently installed.)
Preparing to unpack .../linux-oracle-headers-5.4.0-1009_5.4.0-1009.9_all.deb ...
Unpacking linux-oracle-headers-5.4.0-1009 (5.4.0-1009.9) ...

Selecting previously unselected package linux-headers-5.4.0-1009-oracle.
Preparing to unpack .../linux-headers-5.4.0-1009-oracle_5.4.0-1009.9_amd64.deb ...
Unpacking linux-headers-5.4.0-1009-oracle (5.4.0-1009.9) ...
Setting up linux-oracle-headers-5.4.0-1009 (5.4.0-1009.9) ...
Setting up linux-headers-5.4.0-1009-oracle (5.4.0-1009.9) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.4.0-1009-oracle

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.4.0-1009-oracle -C /lib/modules/5.4.0-1009-oracle/build M=/var/lib/dkms/virtualbox/6.1.10/build................
cleaning build area...

DKMS: build completed.

vboxdrv.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-1009-oracle/updates/dkms/

vboxnetadp.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-1009-oracle/updates/dkms/

vboxnetflt.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-1009-oracle/updates/dkms/

depmod...

DKMS: install completed.
   ...done.

相关内容