如何将我的内核更新到最新版本?

Sif*_*lah 34 updates kernel

我想将我的内核更新到最新的稳定版本v5.16.1

我遵循了一个显示如何安装内核的指南5.16。一切都很顺利,直到我收到此错误:

dpkg: dependency problems prevent configuration of linux-headers-5.16.1-051601-generic:
 linux-headers-5.16.1-851601-generic depends on libc6 (>= 2.34); however:
  Version of libc6:amd64 on system is 2.31-8ubuntu9.2. 
 linux-headers-5.16.1-851601-generic depends on libssl3 (>= 3.8.0--alphal); however:
  Package libssl3 is not installed. 
  
dpkg: error processing package linux-headers-5.16.1-051601-generic (--install):
 dependency problems - leaving unconfigured Setting up linux-image-unsigned-5.16.1-051601-generic (5.16.1-051601.282201160933) ... 
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.13.0-27-generic 
I: /boot/initrd.img.old is now a symlink to initrd.img-5.13.0-27-generic 
I: /boot/vmlinuz is now a symlink to vmlinuz-5.16.1-051601-generic 
I: /boot/initrd.img is now a symlink to initrd.img-5.16.1-051601-generic
Setting up linux-modules-5.16.1-051601-generic (5.16.1-051601.202201160933) 
Processing triggers for linux-image-unsigned-5.16.1-051601-generic (5.16.1-051601.202201160933) 
/etc/kernel/postinst.d/initramfs-tools: 
update-initramfs: Generating /boot/initrd.img-5.16.1-851681-generic 
I: The initramfs will attempt to resume from /dev/sda2 
I: (UUID=91b5f7d6-87fe-498a-a823-88828fa8256a) 
I: Set the RESUME variable to override this. 
/etc/kernel/postinst.d/zz-update-grub: 
Sourcing file 7etc/default/grub. 
Sourcing file 7etc/default/grub.d/99_breeze-grub.cfg. 
Sourcing file 7etc/default/grub.d/init-select.cfg. Generating grub configuration file ... 
Found theme: /boot/grub/themes/breeze/theme.txt 
Found linux image: /boot/vmlinuz-5.16.1-851681-generic 
Found initrd image: /boot/initrd.img-5.16.1-051601-generic 
Found linux image: /boot/vmlinuz-5.15.15-051515-generic 
Found initrd image: /boot/initrd.img-5.15.15-851515-generic 
Found linux image: /boot/vmlinuz-5.13.8-27-generic 
Found initrd image: /boot/initrd.img-5.13.8-27-generic 
Found linux image: /boot/vmlinuz-5.11.0-46-generic 
Found initrd image: /boot/initrd.img-5.11.0-46-generic 
Found linux image: /boot/vmlinuz-5.4.0-96-generic 
Found initrd image: /boot/initrd.img-5.4.0-96-generic 
Found memtest86+ image: /boot/memtest86+.elf 
Found memtest86+ image: /boot/memtest86+.bin 
done 
Errors were encountered while processing:
 linux-headers-5.16.1-051681-generic 
Run Code Online (Sandbox Code Playgroud)

有哪些依赖项?为什么在更新内核时不会自动安装它们?我需要一份逐步指南来将内核更新到最新版本。请帮忙。我看了很多 YouTube 视频,即使按照完全相同的步骤,他们也没有出现此错误。

我没有得到这个问题的任何满意的答案,请帮助我。我的操作系统是完全最新的。我是linux新手,由于这个问题我无法使用linux,因为我想要最新的内核。

硬件信息:

  • 操作系统:Kubuntu 21.10(当前运行内核 5.13)
  • CPU:i3-8100
  • 存储:250GB NVMe M.2 SSD
  • 显卡:Nvidia GeForce GTX 1650
  • 内存:8GB 2400 MHz

Err*_*404 37

:在继续之前,请确保从 BIOS 设置禁用安全启动。如果您不想禁用安全启动,则必须手动签署内核。这个答案可能会有所帮助。

注意:从 Ubuntu 主存储库外部安装的内核可能不受支持,并且不会获得安全更新。如果您寻求进一步的帮助,系统可能会告诉您恢复到受支持的内核。

有几点需要注意:

  • 您要安装的内核是5.16.1,而您遵循的教程显示了安装方法5.16

  • 5.16是一个主线内核

  • Ubuntu 使用最新的稳定 LTS 内核而不是最新的稳定内核。

  • 除非您需要某些特定的驱动程序支持,否则不应手动升级内核。

  • 5.16.1截至 2022 年 1 月 20 日,除了从源代码编译之外,没有简单的安装方法。您可以从其官方网站(直接链接)获取 Tarball 。编译很容易,但安装依赖项和配置安装却很困难。您更有可能遇到错误。

  • 手动内核安装不会自动升级apt upgrade。您每次都需要手动升级它们,或者使用本答案下面提到的脚本。

修复安装问题

这是由于依赖性问题,运行强制安装将修复它:

sudo apt -f install
Run Code Online (Sandbox Code Playgroud)

最好,您可以使用aptitude以获得更好的结果:

sudo aptitude -f install
Run Code Online (Sandbox Code Playgroud)

安装内核的替代方法5.16

或者,运行以下命令也将安装内核v5.16

cd ~/Downloads 

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600_5.16.0-051600.202201092355_all.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-image-unsigned-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-modules-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb

sudo dpkg -i *.deb
sudo apt -f install
Run Code Online (Sandbox Code Playgroud)

安装最新内核。

标题说要安装最新的内核,可以使用自动化脚本安装最新的内核:

  1. 安装自动检查并安装最新内核的 shell 脚本:

    wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
    sudo install ubuntu-mainline-kernel.sh /usr/local/bin/
    
    Run Code Online (Sandbox Code Playgroud)
  2. 运行外壳脚本:

    sudo ubuntu-mainline-kernel.sh -c     
    
    Run Code Online (Sandbox Code Playgroud)
  3. 安装最新的稳定内核:

    sudo ubuntu-mainline-kernel.sh -i
    
    Run Code Online (Sandbox Code Playgroud)
  4. Y接受安装。

  5. 重新启动以引导至最新内核:

    sudo reboot      
    
    Run Code Online (Sandbox Code Playgroud)

将来,如果您想重新检查并重新安装最新的稳定内核,您只需运行:

sudo ubuntu-mainline-kernel.sh -i
Run Code Online (Sandbox Code Playgroud)

注意:您可以使用以下命令检查正在使用的内核:

uname -r
Run Code Online (Sandbox Code Playgroud)

  • @SifatUllah `sudo apt autoremove` 应该删除它们。您还可以使用“sudo apt remove”手动删除它们 (2认同)