![内核构建错误:缺少 /lib/modules](https://linux22.com/image/1154379/%E5%86%85%E6%A0%B8%E6%9E%84%E5%BB%BA%E9%94%99%E8%AF%AF%EF%BC%9A%E7%BC%BA%E5%B0%91%20%2Flib%2Fmodules.png)
大家好!我是 Linux 新手,我一直在尝试安装与我的 ubuntu 发行版 (16.04.4 LTS) 不同的内核版本。配置和构建内核 (4.15.7) 都很顺利,但当我尝试安装它 (sudo make install) 时,我总是收到以下警告,最终无法启动新内核。我搜索了互联网并尝试了建议的解决方案,但仍然无法解决问题。这是我运行 sudo make install 时得到的结果
sh ./arch/x86/boot/install.sh 4.15.7 arch/x86/boot/bzImage \
System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.15.7 /boot/vmlinuz-4.15.7
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.15.7 /boot/vmlinuz-4.15.7
update-initramfs: Generating /boot/initrd.img-4.15.7
WARNING: missing /lib/modules/4.15.7
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.15.7: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_VgOuon/lib/modules/4.15.7/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_VgOuon/lib/modules/4.15.7/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.15.7 /boot/vmlinuz-4.15.7
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.15.7 /boot/vmlinuz-4.15.7
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.15.7 /boot/vmlinuz-4.15.7
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.15.7 /boot/vmlinuz-4.15.7
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.7
Found initrd image: /boot/initrd.img-4.15.7
Found linux image: /boot/vmlinuz-4.15.7.old
Found initrd image: /boot/initrd.img-4.15.7
Found linux image: /boot/vmlinuz-4.9.75
Found linux image: /boot/vmlinuz-4.9.75.old
Found linux image: /boot/vmlinuz-4.4.0-116-generic
Found initrd image: /boot/initrd.img-4.4.0-116-generic
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
这是 uname -r 4.4.0-31-generic 的输出