Fedora 35 Server 使用grubby修改内核启动参数
通过dnf 或yum 安装grubby ,yum install grubby
查看当前默认启动内核: grubby --default-kernel
[root@fedora ~]# grubby --default-kernel /boot/vmlinuz-5.16.18-200.fc35.x86_64
查看已安装的所有内核:grubby --info=ALL
[root@fedora ~]# grubby --info=ALL index=0 kernel="/boot/vmlinuz-5.16.18-200.fc35.x86_64" args="ro resume=/dev/mapper/fedora_fedora-swap rd.lvm.lv=fedora_fedora/root rd.lvm.lv=fedora_fedora/swap rhgb quiet" root="/dev/mapper/fedora_fedora-root" initrd="/boot/initramfs-5.16.18-200.fc35.x86_64.img" title="Fedora Linux (5.16.18-200.fc35.x86_64) 35 (Server Edition)" id="32e63b43940d43d6bae0c13136c82060-5.16.18-200.fc35.x86_64" index=1 kernel="/boot/vmlinuz-5.14.10-300.fc35.x86_64" args="ro resume=/dev/mapper/fedora_fedora-swap rd.lvm.lv=fedora_fedora/root rd.lvm.lv=fedora_fedora/swap rhgb quiet" root="/dev/mapper/fedora_fedora-root" initrd="/boot/initramfs-5.14.10-300.fc35.x86_64.img" title="Fedora Linux (5.14.10-300.fc35.x86_64) 35 (Server Edition)" id="32e63b43940d43d6bae0c13136c82060-5.14.10-300.fc35.x86_64" index=2 kernel="/boot/vmlinuz-0-rescue-32e63b43940d43d6bae0c13136c82060" args="ro resume=/dev/mapper/fedora_fedora-swap rd.lvm.lv=fedora_fedora/root rd.lvm.lv=fedora_fedora/swap rhgb quiet" root="/dev/mapper/fedora_fedora-root" initrd="/boot/initramfs-0-rescue-32e63b43940d43d6bae0c13136c82060.img" title="Fedora Linux (0-rescue-32e63b43940d43d6bae0c13136c82060) 35 (Server Edition)" id="32e63b43940d43d6bae0c13136c82060-0-rescue"
设置新的默认启动内核:
通过grubby --set-default=[kernel path] ,通过路径来指定内核
[root@fedora ~]# grubby --set-default=/boot/vmlinuz-5.14.10-300.fc35.x86_64 The default is /boot/loader/entries/32e63b43940d43d6bae0c13136c82060-5.14.10-300.fc35.x86_64.conf with index 1 and kernel /boot/vmlinuz-5.14.10-300.fc35.x86_64
再次查看当前启动内核:
[root@fedora ~]# grubby --default-kernel /boot/vmlinuz-5.14.10-300.fc35.x86_64
通过grubby --set-default-index=[index] , 通过内核索引值来指定启动内核
[root@fedora ~]# grubby --set-default-index=0 The default is /boot/loader/entries/32e63b43940d43d6bae0c13136c82060-5.16.18-200.fc35.x86_64.conf with index 0 and kernel /boot/vmlinuz-5.16.18-200.fc35.x86_64
再次查看当前启动内核:
[root@fedora ~]# grubby --default-kernel /boot/vmlinuz-5.16.18-200.fc35.x86_64
添加/删除内核启动参数:
对所有内核添加参数:
[root@fedora proc]# grubby --update-kernel=ALL --args=intel_iommu=on [root@fedora proc]#
reboot后查看添加的参数:
[root@fedora proc]# cat /proc/cmdline BOOT_IMAGE=(hd1,gpt2)/vmlinuz-5.16.18-200.fc35.x86_64 root=/dev/mapper/fedora_fedora-root ro resume=/dev/mapper/fedora_fedora-swap rd.lvm.lv=fedora_fedora/root rd.lvm.lv=fedora_fedora/swap rhgb quiet intel_iommu=on
对所有内核删除参数:
[root@fedora proc]# grubby --update-kernel=ALL --remove-args=intel_iommu=on [root@fedora proc]#
reboot后查看是否删除成功:
[root@fedora ~]# cat /proc/cmdline BOOT_IMAGE=(hd1,gpt2)/vmlinuz-5.16.18-200.fc35.x86_64 root=/dev/mapper/fedora_fedora-root ro resume=/dev/mapper/fedora_fedora-swap rd.lvm.lv=fedora_fedora/root rd.lvm.lv=fedora_fedora/swap rhgb quiet
版权声明:本文由老瓦罐儿煨汤发布,如需转载请注明出处。