linux - "FATAL: cannot determine kernel version"更新 initramfs 时

标签 linux ubuntu linux-kernel

我下载了 linux kernel-5.0.0 并尝试在我的 Ubuntu-18.04.3 上编译和安装它

我在/usr/src/linux-5.0 中使用的命令:

sudo make mrproper

sudo make menuconfig

sudo make -j4

sudo make modules_install

sudo make install

在最后一个命令的结果,有一个错误:
 * dkms: running auto installation service for kernel 5.0.02173611831    

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.0.02173611831 /boot/vmlinuz-5.0.02173611831

update-initramfs: Generating /boot/initrd.img-5.0.02173611831

FATAL: cannot determine kernel version

我不知道为什么这是“致命:无法确定内核版本”以及如何修复它。

一开始,我跳过它,但后来我发现一旦我像这样打开 vim,“无法确定内核版本”总是出现。
when i open vim

顺便说一句,奇怪的数字 5.0.02173611831 是(内核版本)+(我在大学的数字),我在“sudo make menuconfig”时按照老师的要求进行了配置。

最佳答案

我有这个错误“致命:无法确定内核版本”,结果证明是在 ./configure 脚本中滥用了“cpp”。
其他用途就像

# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
但是这个错误来自一行
kernsrcver=`(echo "#include <$utsrelease>";
    echo "kernsrcver=UTS_RELEASE") |
    cpp -I $kernelbuild/include |
    grep "^kernsrcver=" | cut -d \" -f 2`
我将 cpp 行更改为(并且有效):
    cpp -I $kernelbuild/include -E - |

关于linux - "FATAL: cannot determine kernel version"更新 initramfs 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58394650/

相关文章:

c++ - linux c++ 创建具有最大值的信号量

linux - Linux 中的 QtWebkit 重音

sockets - 套接字对和成对的未命名管道之间有什么区别吗?

c - C 编程 Linux 驱动程序中的异或字符串

windows - 为 CPAN(和 CorporatePAN)打包 perl 脚本的推荐方法是什么?

linux - 如何在 Debian 中将简单的 Go 服务器作为守护进程运行?

linux - 无法将 Genymotion 路径添加到 PATH 变量 linux xubuntu

eclipse - Ubuntu Eclipse 版本

ubuntu - 所有CUDA设备都用于显示: Can not debug my CUDA-code from within desktop environment

linux - 使用 get_wchan()