更改默认内核不会改变 uname

更改默认内核不会改变 uname

我有一台 hetzner 服务器,我想在服务器上使用 wireguard。如下所示,我的 wireguard 模块仅适用于内核版本“4.18.0-348.el8.x86_64”。

$ rpm -ql kmod-wireguard
    /etc/depmod.d/kmod-wireguard.conf
    /lib/modules/4.18.0-348.el8.x86_64
    /lib/modules/4.18.0-348.el8.x86_64/extra
    /lib/modules/4.18.0-348.el8.x86_64/extra/wireguard
    /lib/modules/4.18.0-348.el8.x86_64/extra/wireguard/wireguard.ko
    /usr/share/doc/kmod-wireguard-1.0.20211208
    /usr/share/doc/kmod-wireguard-1.0.20211208/GPL-v2.0.txt
    /usr/share/doc/kmod-wireguard-1.0.20211208/greylist.txt

但我的默认内核是“4.18.0-348.2.1.el8_5.x86_64”。

$ uname -r
    4.18.0-348.2.1.el8_5.x86_64

因此,我无法加载 wireguard 模块。因此,我使用 grubby 切换到其他版本,

$ sudo grubby --info=ALL
    index=0
    kernel="/boot/vmlinuz-4.18.0-365.el8.x86_64"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 crashkernel=auto rhgb quiet $tuned_params"
    root="UUID=7f43b423-ee85-4c1d-a417-41c68e8a8b40"
    initrd="/boot/initramfs-4.18.0-365.el8.x86_64.img $tuned_initrd"
    title="CentOS Stream (4.18.0-365.el8.x86_64) 8"
    id="78424947c1b94df5bc577331dc9da098-4.18.0-365.el8.x86_64"
    index=1
    kernel="/boot/vmlinuz-0-rescue-78424947c1b94df5bc577331dc9da098"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 crashkernel=auto rhgb quiet"
    root="UUID=7f43b423-ee85-4c1d-a417-41c68e8a8b40"
    initrd="/boot/initramfs-0-rescue-78424947c1b94df5bc577331dc9da098.img"
    title="CentOS Stream (0-rescue-78424947c1b94df5bc577331dc9da098) 8"
    id="78424947c1b94df5bc577331dc9da098-0-rescue"
    index=2
    kernel="/boot/boot/vmlinuz-4.18.0-348.2.1.el8_5.x86_64"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 crashkernel=auto rhgb quiet $tuned_params"
    root="UUID=7f43b423-ee85-4c1d-a417-41c68e8a8b40"
    initrd="/boot/boot/initramfs-4.18.0-348.2.1.el8_5.x86_64.img $tuned_initrd"
    title="CentOS Linux (4.18.0-348.2.1.el8_5.x86_64) 8"
    id="7345eea605f14507b00f718a0027f23c-4.18.0-348.2.1.el8_5.x86_64"
    index=3
    kernel="/boot/boot/vmlinuz-0-rescue-7345eea605f14507b00f718a0027f23c"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 crashkernel=auto rhgb quiet"
    root="UUID=7f43b423-ee85-4c1d-a417-41c68e8a8b40"
    initrd="/boot/boot/initramfs-0-rescue-7345eea605f14507b00f718a0027f23c.img"
    title="CentOS Linux (0-rescue-7345eea605f14507b00f718a0027f23c) 8"
    id="7345eea605f14507b00f718a0027f23c-0-rescue"
    index=4
    kernel="/boot/vmlinuz-4.18.0-348.el8.x86_64"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 crashkernel=auto rhgb quiet $tuned_params"
    root="UUID=7f43b423-ee85-4c1d-a417-41c68e8a8b40"
    initrd="/boot/initramfs-4.18.0-348.el8.x86_64.img $tuned_initrd"
    title="CentOS Stream (4.18.0-348.el8.x86_64) 8"
    id="5ac25cd9d1bc40c78c39fd3edc9a219b-4.18.0-348.el8.x86_64"
    index=5
    kernel="/boot/vmlinuz-0-rescue-5ac25cd9d1bc40c78c39fd3edc9a219b"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 crashkernel=auto rhgb quiet"
    root="UUID=7f43b423-ee85-4c1d-a417-41c68e8a8b40"
    initrd="/boot/initramfs-0-rescue-5ac25cd9d1bc40c78c39fd3edc9a219b.img"
    title="CentOS Stream (0-rescue-5ac25cd9d1bc40c78c39fd3edc9a219b) 8"
    id="5ac25cd9d1bc40c78c39fd3edc9a219b-0-rescue"
$ sudo grubby --set-default-index=4
    The default is /boot/loader/entries/5ac25cd9d1bc40c78c39fd3edc9a219b-4.18.0-348.el8.x86_64.conf with index 4 and kernel /boot/vmlinuz-4.18.0-348.el8.x86_64

重启后,我仍然没有看到 uname 结果有任何变化,它仍然保持为“4.18.0-348.2.1.el8_5.x86_64”。我还看到这个内核的标题是 CentOS Linux 8 而不是 stream,但检查 centos 发布文件显示我正在使用 CentOS Stream 8。

$ cat /etc/centos-release
    CentOS Stream release 8

有人能告诉我如何切换内核吗?谢谢。

相关内容