欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 能源 > Ubuntu 16.04 通过deb包安装内核头文件

Ubuntu 16.04 通过deb包安装内核头文件

2025/10/31 9:26:35 来源:https://blog.csdn.net/weixin_45030965/article/details/141262128  浏览:    关键词:Ubuntu 16.04 通过deb包安装内核头文件

文章目录

  • 前言
  • 通过deb包安装内核头文件

前言

Ubuntu16.04部分内核版本无法通过 apt-get install linux-headers-$(uname -r) 来进行安装:

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"# uname -r
4.15.0-29-generic
# apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package linux-headers-4.15.0-29-generic is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another sourceE: Package 'linux-headers-4.15.0-29-generic' has no installation candidate
# dpkg-query -s linux-headers-$(uname -r)
dpkg-query: package 'linux-headers-4.15.0-29-generic' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
# dpkg-query -l "linux-headers*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                  Version                 Architecture            Description
+++-=====================================-=======================-=======================-===============================================================
un  linux-headers                         <none>                  <none>                  (no description available)
un  linux-headers-3.0                     <none>                  <none>                  (no description available)
ii  linux-headers-4.15.0-29               4.15.0-29.31            all                     Header files related to Linux kernel version 4.15.0
un  linux-headers-4.15.0-29-generic       <none>                  <none>                  (no description available)
ii  linux-headers-4.4.0-131               4.4.0-131.157           all                     Header files related to Linux kernel version 4.4.0
ii  linux-headers-4.4.0-131-generic       4.4.0-131.157           amd64                   Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii  linux-headers-generic                 4.4.0.131.137           amd64                   Generic Linux kernel headers

因此我们得去对应的官网找.deb来进行安装。

通过deb包安装内核头文件

官网找.deb来进行安装:
阿里云官网:https://mirrors.aliyun.com/ubuntu/pool/main/l/linux/找到以下安装包:
示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。

# dpkg -i *.deb
(Reading database ... 83994 files and directories currently installed.)
Preparing to unpack linux-headers-4.15.0-29_4.15.0-29.31_all.deb ...
Unpacking linux-headers-4.15.0-29 (4.15.0-29.31) over (4.15.0-29.31) ...
Selecting previously unselected package linux-headers-4.15.0-29-generic.
Preparing to unpack linux-headers-4.15.0-29-generic_4.15.0-29.31_amd64.deb ...
Unpacking linux-headers-4.15.0-29-generic (4.15.0-29.31) ...
Preparing to unpack linux-image-unsigned-4.15.0-29-generic_4.15.0-29.31_amd64.deb ...
Unpacking linux-image-unsigned-4.15.0-29-generic (4.15.0-29.31) over (4.15.0-29.31) ...
Preparing to unpack linux-modules-4.15.0-29-generic_4.15.0-29.31_amd64.deb ...
Unpacking linux-modules-4.15.0-29-generic (4.15.0-29.31) over (4.15.0-29.31) ...
Setting up linux-headers-4.15.0-29 (4.15.0-29.31) ...
dpkg: dependency problems prevent configuration of linux-headers-4.15.0-29-generic:linux-headers-4.15.0-29-generic depends on libssl1.1 (>= 1.1.0); however:Package libssl1.1 is not installed.dpkg: error processing package linux-headers-4.15.0-29-generic (--install):dependency problems - leaving unconfigured
Setting up linux-modules-4.15.0-29-generic (4.15.0-29.31) ...
Setting up linux-image-unsigned-4.15.0-29-generic (4.15.0-29.31) ...
Processing triggers for linux-image-unsigned-4.15.0-29-generic (4.15.0-29.31) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-29-generic

出现:

dpkg: dependency problems prevent configuration of linux-headers-4.15.0-29-generic:linux-headers-4.15.0-29-generic depends on libssl1.1 (>= 1.1.0); however:Package libssl1.1 is not installed.

去下载 libssl1.1 deb安装包进行安装:
http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/

在这里插入图片描述

# dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
# dpkg -i *.deb
......
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-4.15.0-29-generic
Found kernel: /vmlinuz-4.4.0-131-generic
Found kernel: /vmlinuz-4.15.0-29-generic
Found kernel: /vmlinuz-4.4.0-131-generic
Updating /boot/grub/menu.lst ... done/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-29-generic
Found initrd image: /boot/initrd.img-4.15.0-29-generic
Found linux image: /boot/vmlinuz-4.4.0-131-generic
Found initrd image: /boot/initrd.img-4.4.0-131-generic
done
# dpkg-query -l "linux-headers*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                Architecture           Description
+++-==================================-======================-======================-==========================================================================
un  linux-headers                      <none>                 <none>                 (no description available)
un  linux-headers-3.0                  <none>                 <none>                 (no description available)
ii  linux-headers-4.15.0-29            4.15.0-29.31           all                    Header files related to Linux kernel version 4.15.0
ii  linux-headers-4.15.0-29-generic    4.15.0-29.31           amd64                  Linux kernel headers for version 4.15.0 on 64 bit x86 SMP
ii  linux-headers-4.4.0-131            4.4.0-131.157          all                    Header files related to Linux kernel version 4.4.0
ii  linux-headers-4.4.0-131-generic    4.4.0-131.157          amd64                  Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii  linux-headers-generic              4.4.0.131.137          amd64                  Generic Linux kernel headers
# dpkg --get-selections |grep linux
console-setup-linux                             install
libselinux1:amd64                               install
linux-base                                      install
linux-firmware                                  install
linux-generic                                   install
linux-headers-4.15.0-29                         install
linux-headers-4.15.0-29-generic                 install
linux-headers-4.4.0-131                         install
linux-headers-4.4.0-131-generic                 install
......

安装成功。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词