#7 grub2 script

open
Sergei Haller
General (7)
5
2010-02-06
2010-02-06
A Mennucc
No

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_BIOS_NEEDS_REBOOT=True
AUTOSHUTDOWN_BOOT_LOADER = "GRUB"
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.

Discussion

  • A Mennucc
    A Mennucc
    2010-02-06

     
    Attachments