Difference between revisions of "Grub2"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
To configure the GRUB2 bootloader on SUSE Linux, use the file /etc/grub2/grub.cfg. I can be generated by the command
+
To configure the GRUB2 bootloader on SUSE Linux, use the file /etc/grub2/grub.cfg. It can be generated by the command
 
  grub2-mkconfig -o /boot/grub2/grub.cfg
 
  grub2-mkconfig -o /boot/grub2/grub.cfg
 
from /etc/default/grub and the files in /etc/default/grub
 
from /etc/default/grub and the files in /etc/default/grub
Line 5: Line 5:
 
  /etc/grub.d/*____
 
  /etc/grub.d/*____
 
                   \
 
                   \
                     --- (grub2-mkconfig -o /boot/grub2/grub.cfg --->  /etc/grub2/grub.cfg
+
                     --- (grub2-mkconfig -o /boot/grub2/grub.cfg --->  /boot/grub2/grub.cfg
 
                   /
 
                   /
 
  /etc/default/grub
 
  /etc/default/grub

Latest revision as of 13:19, 4 March 2016

To configure the GRUB2 bootloader on SUSE Linux, use the file /etc/grub2/grub.cfg. It can be generated by the command

grub2-mkconfig -o /boot/grub2/grub.cfg

from /etc/default/grub and the files in /etc/default/grub

/etc/grub.d/*____
                 \
                   --- (grub2-mkconfig -o /boot/grub2/grub.cfg --->  /boot/grub2/grub.cfg
                 /
/etc/default/grub


The best way to add a menu item to your grub2 boot menu is to add the command menuentry to the end of /etc/grub.d/40_custom like this:

  • change /etc/grub.d/40_custom to look like:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry linuxintro{
}
  • call grub2-mkconfig:
# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub.cfg ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-3.7.10-1.40-desktop
Found initrd image: /boot/initrd-3.7.10-1.40-desktop
Found linux image: /boot/vmlinuz-3.7.10-1.16-desktop
Found initrd image: /boot/initrd-3.7.10-1.16-desktop
  No volume groups found
error: syntax error.
  • woops ;) Add a volume to the configuration in /etc/grub.d/40_custom:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry linuxintro{
  set hd=(hd0,0)
}
  • and run mkconfig again:
# grub2-mkconfig -o /boot/grub2/grub.cfg