/lib/modules//build丢失(/Lib / modules / < kernel version > / build is missing)

问题背景:hook 系统调用 在加载模块时error. 原因应该是内核4.X版本太高,内核代码有更改。降级系统后发现没有3.16 -generic 目录遇到这个错误,主要是没安装内核安装包(类似于kernel-devel的名字)但是这种情况下一般有两种情况:有安装内核开发包,但是因为各种各样的原因没有识别。 首先到/lib/modules/4.4.0-53-generic/(这里的版本号需要根据错误提示进入对应目录)目录下,查看是否有build文件:a.如果有的话,那么则是链接出错,ls -l命令查看build链接文件是否存在(如果链接文件标红则说明链接文件不存在了),去对应/usr/src目录下查看链接文件是否存在,一般都是链接这个目录下对应内核版本,如果存在,则重新链接,如果不存在则进入情况2(没有安装kernel开发包);b.如果没有的话,则参照步骤a,查找源链接文件是否存在。没有安全内核开发包,则直接使用系统版本管理工具下载对应kernel-devel即可。 譬如Ubuntu是apt-get,centos是rpm,suse是zypper————————————————版权声明:本文为CSDN博主「SUKI547」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/SUKI547/article/details/104817280/

降级系统:

sudo apt-get install linux-image-extra-3.16.0-43-generic#若apt-get太慢可下载 apt-fast#检查是否安装成功dpkg -l | grep 3.16.0-43-generic#更改启动项sudo vim /etc/default/grubGRUB_DEFAULT=0 改为GRUB_DEFAULT=”Advanced options for Ubuntu>Ubuntu, with Linux 3.16.0-43-generic”#保存退出,更新启动项sudo update-grub#重启reboot#检查 uname -r

安装linux 内核:

sudo apt-get install linux-kernel-headers kernel-packageorsudo apt-get install linux-headers-$(uname -r)sudo apt-get update && sudo apt-get install build-essential linux-headers-$(uname -r)

https://blog.csdn.net/SUKI547/article/details/104817280/?utm_term=linux%E6%B2%A1%E6%9C%89build%E6%96%87%E4%BB%B6&utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~sobaiduweb~default-2-104817280&spm=3001.4430

————————

Problem background: the hook system call encountered error while loading the module The reason should be kernel 4 The X version is too high and the kernel code has changed. After the system is downgraded, it is found that the 3.16 – generic directory does not encounter this error, mainly because the kernel installation package (similar to the name of kernel devel) is not installed. However, there are generally two cases: the kernel development package is installed, but it is not recognized for various reasons. First, go to / lib / modules / 4.4.0-53-generic / (the version number here needs to enter the corresponding directory according to the error prompt) directory to check whether there is a build file: A. if so, the link error occurs. LS – L command to check whether the build link file exists (if the link file is marked red, it indicates that the link file does not exist), Go to the corresponding / usr / SRC directory to check whether the linked file exists. Generally, link the corresponding kernel version in this directory. If it exists, re link it. If it does not exist, enter case 2 (kernel development package is not installed); b. If not, refer to step a to find out whether the source link file exists. If there is no security kernel development package, you can directly use the system version management tool to download the corresponding kernel devel. For example, Ubuntu is apt get, CentOS is rpm, SUSE is zypper. Copyright notice: This article is the original article of CSDN blogger “suki547”, which follows the CC 4.0 by-sa copyright agreement. Please attach the original source link and this notice for reprint. Original link: https://blog.csdn.net/SUKI547/article/details/104817280/

Degraded system:

sudo apt-get install linux-image-extra-3.16.0-43-generic#若apt-get太慢可下载 apt-fast#检查是否安装成功dpkg -l | grep 3.16.0-43-generic#更改启动项sudo vim /etc/default/grubGRUB_DEFAULT=0 改为GRUB_DEFAULT=”Advanced options for Ubuntu>Ubuntu, with Linux 3.16.0-43-generic”#保存退出,更新启动项sudo update-grub#重启reboot#检查 uname -r

To install the Linux kernel:

sudo apt-get install linux-kernel-headers kernel-packageorsudo apt-get install linux-headers-$(uname -r)sudo apt-get update && sudo apt-get install build-essential linux-headers-$(uname -r)

https://blog.csdn.net/SUKI547/article/details/104817280/?utm_term=linux%E6%B2%A1%E6%9C%89build%E6%96%87%E4%BB%B6&utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~sobaiduweb~default-2-104817280&spm=3001.4430