How to add shutdown option in GRUB2 menu | Linux OS | boot grub

preview_player
Показать описание
In this video, I am gonna show you how to add a shutdown option in GRUB2 menu.

Follow my steps and you are good to go.

###code starts
menuentry "Shutdown"{
halt
}
###code ends

Comment below if any error occurs.

NOTE:- always backup the grub file before editing.
Рекомендации по теме
Комментарии
Автор

Thanks. As a refinement I would propose to add this menuentry rather in /etc/grub.d because otherwise you will lose the entry when your OS is doing the next grub-update in the wake of any major system update.
You can easily copy the existing template "40_custom" e.g
cp /etc/init.d/40_custom /etc/init.d/31_shutdown
and then edit /etc/init.d/31_shutdown and put in the menuentry as proposed above. Then execute
grub-update
and the entries will be created and also will survive the next routing update.

skudooq
Автор

I was weird enough to find this helpful. Thanks

doyi
welcome to shbcf.ru