Difference between revisions of "Grub2"

From Linuxintro
imported>ThorstenStaerk
(Created page with "To configure the GRUB2 bootloader on SUSE Linux, use the file /etc/grub2/grub.cfg. I can be generated by the command grub2-mkconfig -o /boot/grub2/grub.cfg from /etc/default/...")
 
imported>ThorstenStaerk
Line 3: Line 3:
 
from /etc/default/grub and the files in /etc/default/grub
 
from /etc/default/grub and the files in /etc/default/grub
  
  /etc/grub.d
+
  /etc/grub.d/*____
 
                   \
 
                   \
 
                     --- (grub2-mkconfig -o /boot/grub2/grub.cfg --->  /etc/grub2/grub.cfg
 
                     --- (grub2-mkconfig -o /boot/grub2/grub.cfg --->  /etc/grub2/grub.cfg
 
                   /
 
                   /
 
  /etc/default/grub
 
  /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:
 +
<pre>
 +
#!/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{
 +
}
 +
</pre>
 +
* call grub2-mkconfig:
 +
<pre>
 +
# 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.
 +
</pre>
 +
* woops ;) Add a volume to the configuration in /etc/grub.d/40_custom:
 +
<pre>
 +
#!/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)
 +
}
 +
</pre>
 +
* and run mkconfig again:
 +
# grub2-mkconfig -o /boot/grub2/grub.cfg

Revision as of 13:59, 18 January 2016

To configure the GRUB2 bootloader on SUSE Linux, use the file /etc/grub2/grub.cfg. I 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 --->  /etc/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