#7 grub2 script

Sergei Haller
General (7)
A Mennucc

hi, I prepared some code for grub2. It helps (a lot) people that need to reboot the machine to set up the RTC alarm in their motherboard. (Note that the instructions that are provided in the README files are useless for people using grub2 ).

The end result is that there is a new menu voice in the grub boot, on bottom, that will immediately halt the machine; this menu is autoselected if the command '/usr/bin/grub-editenv /boot/grub/grubenv set nvram_halt_once=1' is run before reboot; this autoselection happens only once, that is, when you then boot the machine, the usual menu is selected (whatever "usual" means to you).

What follows is tested in Debian: the attached file is to be saved in /etc/grub.d/50_nvram_wakeup and then 'update-grub' so that the file /boot/grub/grub.cfg is regenerated to contain the new menu voice . That's all folks.

I use it in my Freevo box, that now is in a PC with a mobo that needs a reboot. In /etc/freevo/local_conf.py, I set

AUTOSHUTDOWN_GRUB_CMD = "/usr/bin/grub-editenv /boot/grub/grubenv set nvram_halt_once=1"

(the above assumes that the user running freevo can also edit the file /boot/grub/grubenv , so in some setups 'sudo' may be used)

Bye, and thanks for nvram-wakeup . a.


  • A Mennucc
    A Mennucc