Tech Junkie Blog - Real World Tutorials, Happy Coding!: Linux System Administration: Working With grubby

Monday, February 7, 2022

Linux System Administration: Working With grubby

 Having to change our grub menus with a text editor every time we want to make a change and be cumbersome and error prone.  Luckily there's a tool that we can use to work with grub called grubby.  In this post we are going to go over some of the useful commands that comes with grubby.

The first command we are going to look at is the grubby --default-kernel as you may have guess this will display the current default kernel



In addition to showing the default kernel we could set the default kernel with the command --set-default kernel command, with this command though you need to know the exact path to the kernel.  Let's set the default kernel to be the second choice.  To do that we want to see all the choices first, to list all the kernels we type the command grubby --info=ALL












From the command we see that the second choice is kernel=/boot/vmlinuz-3.10.0-1160.el7.x86_64

Now we can set the default kernel to be the second choice by typing gubby --set-default /boot/vmlinuz-3.10.0-1160.el7.x86_64





Now if you reboot you will see that the second choice is selected in the boot menu instead of the first choice






Set the default kernel to the first choice again.

grubby --set-default /boot/vmlinuz-3.10.0-1160.25.1.el7.x86_64

Another useful use of grubby is the ability to add and remove arguments so let's we want to add the arguments rhgb and quiet to the default boot option we can just type grubby --args="rhgb quiet" --update-kernel /boot/vmlinuz-3.10.0-1160.25.1.el7.x86_64










To remove the argument just add the --remove to the args command like so  grubby --remove-args="rhgb quiet" --update-kernel /boot/vmlinuz-3.10.0-1160.25.1.el7.x86_64










No comments:

Post a Comment

Search This Blog