Ubuntu 22.04 内核无法升级

Ubuntu 22.04 内核无法升级

我们目前正在使用 Ubuntu 22.04.3 LTS (GNU/Linux 5.4.0-153-generic x86_64),并尝试将内核升级到 5.15 或更高版本。即使在搜索了多个帖子、wiki 等之后,内核仍停留在 5.4.0。我们没有主意了,希望有人能为我们指明正确的方向。

我们的尝试:

  • sudo apt update && sudo apt full-upgrade && sudo apt clean && sudo apt autoremove 根据这篇文章
  • sudo apt-get install linuxE: Unable to locate package linux
  • sudo apt-get install linux-genericlinux-generic is already the newest version (5.15.0.89.86)
  • sudo apt-get install linux-image-genericlinux-image-generic is already the newest version (5.15.0.89.86)
  • 根据答案使用 ubuntu-mainline-kernel.sh这个帖子经过测试我们通过相同的脚本卸载了内核。
  • sudo apt install linux-generic-hwe-22.04 根据这篇文章

重启后uname -r仍会返回5.4.0-153-generic

从我在其他帖子中读到的内容来看,您可能需要这些信息(如果缺少某些内容,请告诉我):

$ uname -a
Linux vm-server-1 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ sudo apt policy linux-image
linux-image:
  Installed: (none)
  Candidate: (none)
  Version table:
$ sudo apt-cache policy linux-generic
linux-generic:
  Installed: 5.15.0.89.86
  Candidate: 5.15.0.89.86
  Version table:
 *** 5.15.0.89.86 500
        500 http://de.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.15.0.25.27 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
$ sudo apt-mark showmanual | grep linux-image
linux-image-generic
$ sudo apt-mark showmanual | grep linux-headers
# nothing
$ sudo apt-mark showauto | grep linux-image
linux-image-5.15.0-89-generic
linux-image-6.2.0-37-generic
linux-image-generic-hwe-22.04
$ sudo apt-mark showauto | grep linux-headers
linux-headers-5.15.0-89
linux-headers-5.15.0-89-generic
linux-headers-6.2.0-37-generic
linux-headers-generic
linux-headers-generic-hwe-22.04
$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.2.0-37-generic
Found initrd image: /boot/initrd.img-6.2.0-37-generic
Found linux image: /boot/vmlinuz-5.15.0-89-generic
Found initrd image: /boot/initrd.img-5.15.0-89-generic
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
$ sudo grub-editenv list
# nothing
$ sudo dpkg --get-selections | grep linux-image
linux-image-5.15.0-76-generic           deinstall
linux-image-5.15.0-78-generic           deinstall
linux-image-5.15.0-79-generic           deinstall
linux-image-5.15.0-82-generic           deinstall
linux-image-5.15.0-83-generic           deinstall
linux-image-5.15.0-84-generic           deinstall
linux-image-5.15.0-86-generic           deinstall
linux-image-5.15.0-87-generic           deinstall
linux-image-5.15.0-88-generic           deinstall
linux-image-5.15.0-89-generic           install
linux-image-6.2.0-37-generic            install
linux-image-generic             install
linux-image-generic-hwe-22.04           install
$ sudo dpkg -l | egrep linux-'[g|h|i|m]'
ii  binutils-x86-64-linux-gnu             2.38-4ubuntu2.3                         amd64        GNU binary utilities, for x86-64-linux-gnu target
ii  linux-generic                         5.15.0.89.86                            amd64        Complete Generic Linux kernel and headers
ii  linux-generic-hwe-22.04               6.2.0.37.38~22.04.15                    amd64        Complete Generic Linux kernel and headers
ii  linux-headers-5.15.0-89               5.15.0-89.99                            all          Header files related to Linux kernel version 5.15.0
ii  linux-headers-5.15.0-89-generic       5.15.0-89.99                            amd64        Linux kernel headers for version 5.15.0 on 64 bit x86 SMP
ii  linux-headers-6.2.0-37-generic        6.2.0-37.38~22.04.1                     amd64        Linux kernel headers for version 6.2.0 on 64 bit x86 SMP
ii  linux-headers-generic                 5.15.0.89.86                            amd64        Generic Linux kernel headers
ii  linux-headers-generic-hwe-22.04       6.2.0.37.38~22.04.15                    amd64        Generic Linux kernel headers
ii  linux-hwe-6.2-headers-6.2.0-37        6.2.0-37.38~22.04.1                     all          Header files related to Linux kernel version 6.2.0
rc  linux-image-5.15.0-76-generic         5.15.0-76.83                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-78-generic         5.15.0-78.85                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-79-generic         5.15.0-79.86                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-82-generic         5.15.0-82.91                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-83-generic         5.15.0-83.92                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-84-generic         5.15.0-84.93                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-86-generic         5.15.0-86.96                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-87-generic         5.15.0-87.97                            amd64        Signed kernel image generic
rc  linux-image-5.15.0-88-generic         5.15.0-88.98                            amd64        Signed kernel image generic
ii  linux-image-5.15.0-89-generic         5.15.0-89.99                            amd64        Signed kernel image generic
ii  linux-image-6.2.0-37-generic          6.2.0-37.38~22.04.1                     amd64        Signed kernel image generic
ii  linux-image-generic                   5.15.0.89.86                            amd64        Generic Linux kernel image
ii  linux-image-generic-hwe-22.04         6.2.0.37.38~22.04.15                    amd64        Generic Linux kernel image
rc  linux-modules-5.15.0-76-generic       5.15.0-76.83                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-78-generic       5.15.0-78.85                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-79-generic       5.15.0-79.86                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-82-generic       5.15.0-82.91                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-83-generic       5.15.0-83.92                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-84-generic       5.15.0-84.93                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-86-generic       5.15.0-86.96                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-87-generic       5.15.0-87.97                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-5.15.0-88-generic       5.15.0-88.98                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-5.15.0-89-generic       5.15.0-89.99                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-6.2.0-37-generic        6.2.0-37.38~22.04.1                     amd64        Linux kernel extra modules for version 6.2.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-76-generic 5.15.0-76.83                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-78-generic 5.15.0-78.85                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-79-generic 5.15.0-79.86                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-82-generic 5.15.0-82.91                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-83-generic 5.15.0-83.92                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-84-generic 5.15.0-84.93                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-86-generic 5.15.0-86.96                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-87-generic 5.15.0-87.97                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.15.0-88-generic 5.15.0-88.98                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.15.0-89-generic 5.15.0-89.99                            amd64        Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
ii  linux-modules-extra-6.2.0-37-generic  6.2.0-37.38~22.04.1                     amd64        Linux kernel extra modules for version 6.2.0 on 64 bit x86 SMP
$ ls /boot
System.map-5.15.0-89-generic  config-5.15.0-89-generic  grub        initrd.img-5.15.0-89-generic  initrd.img.old  vmlinuz                    vmlinuz-6.2.0-37-generic
System.map-6.2.0-37-generic   config-6.2.0-37-generic   initrd.img  initrd.img-6.2.0-37-generic   lost+found      vmlinuz-5.15.0-89-generic  vmlinuz.old
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

分区信息:

$ sudo parted -l
Model: ATA Samsung SSD 870 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  2150MB  2147MB  ext4
 3      2150MB  2000GB  1998GB


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 1998GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0,00B  1998GB  1998GB  ext4


Model: Samsung SSD 960 EVO 500GB (nvme)
Disk /dev/nvme0n1: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB  ext4
 3      1612MB  500GB   498GB


$ sudo lsblk -f
NAME                      FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
loop0                     squashfs    4.0                                                         0   100% /snap/core20/1974
loop1                     squashfs    4.0                                                         0   100% /snap/core20/2015
loop2                     squashfs    4.0                                                         0   100% /snap/lxd/24322
loop3                     squashfs    4.0                                                         0   100% /snap/snapd/20092
loop4                     squashfs    4.0                                                         0   100% /snap/snapd/20290
sda
├─sda1
├─sda2                    ext4        1.0            a2c63d1f-fec5-4509-a3d6-5ad29a80659a      1,5G    14% /boot
└─sda3                    LVM2_member LVM2 001       ZfgXCe-fGAO-4892-UF2D-V4gq-d7hQ-5SggRI
  └─ubuntu--vg-ubuntu--lv ext4        1.0            6b157c55-6273-4694-bc9d-237cea92d8d8      1,7T     2% /
nvme0n1
├─nvme0n1p1               vfat        FAT32          4CEE-91B6
├─nvme0n1p2               ext4        1.0            f007e56e-a254-48ea-8468-c65ecc7b478e
└─nvme0n1p3

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-1OpWKw4SuxDrjnHjXbSxnsYuaTPZbHWZfd2iKx7srOOcU4DgSRcde81utmMRfYC1 / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/a2c63d1f-fec5-4509-a3d6-5ad29a80659a /boot ext4 defaults 0 1
/swap.img   none    swap    sw  0   0

硬件:

  • 华硕 PRIME B350-PLUS 主板
  • AMD Ryzen 7 1700 八核处理器

重启后uname -r仍会返回5.4.0-153-generic。最后说明:通过 安装新软件包时,apt install会出现一条消息,提示已找到新内核,重启后将使用该内核。但内核仍为 5.4。

答案1

由于我们完全重新安装了服务器,因此不再需要任何答案。

最有可能的是,Ubuntu 22.04 之前没有正确安装,在启动时选择了来自另一个分区的旧 Linux 内核,而不是较新安装的内核。

相关内容