File README.grub2 of Package bootcycle

   Boot cycle detection using systemd bootcycle
   =================================================

The package bootcycle provides a boot script which is used for boot
cycle detection to avoid unconditional reboot cycles of not supervised
system.  For this the GNU GRUB 2.00 multiboot loader is used.

For boot cycle detection the GRUB default boot entry has the title
"halt".  With this entry the system is halted at boot up. To avoid
this the script /usr/sbin/bootcycle is called to set up an other only
once but default boot entry for the next reboot. In other words: on
every successful boot up the only once entry is chosen for next boot
time.  If the system fails on boot and falls into reboot the halt
entry is automatically used on next try.

The configuration can be done with /etc/sysconfig/bootloader. With the
variable CYCLE_DETECTION the script can be activated or deactivated.
The value given with CYCLE_NEXT_ENTRY is the name or number of the
boot entry in /boot/grub2/grub.cfg file. Note that the entries within
grub.cfg will be counted starting at 0. The default and next entry
settings are represented by saved_entry and next_entry environment
variable respectively and stored at /boot/grub2/grubenv file that can
be modified at grub runtime. We can observer settings in environment
block by running "grub2-editenv list".

Just an example: The default entry is set to linux.

----------- grub2-editenv list ----------------------------

saved_entry=linux

-------------------------------------------------------------

----------- /boot/grub2/grub.cfg ----------------------------
timeout 8
default saved

menuentry 'linux' {
  linux /boot/vmlinuz root=/dev/sda6 noapic
  initrd /boot/initrd
}

menuentry 'halt' { halt }
-------------------------------------------------------------

With CYCLE_NEXT_ENTRY set to "linux" or "0" and CYCLE_DETECTION the
system will boot the entry "linux" if and only if /usr/sbin/boot.cycle
was called. As the settings are done in grub environmental block, you
don't have to call /usr/sbin/bootcycle again after calling
grub2-mkconfig. The settings in environment block will look like:

----------- grub2-editenv list ----------------------------

saved_entry=halt
next_entry=linux

-------------------------------------------------------------
openSUSE Build Service is sponsored by