|
|
| (23 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| == GRUB 2 ==
| | == Packages == |
| | |
| === Packages ===
| |
|
| |
|
| Exherbo: {{Package|sys-boot/grub}} | | Exherbo: {{Package|sys-boot/grub}} |
| Line 12: |
Line 10: |
| </pre> | | </pre> |
|
| |
|
| === Installation ===
| | == Installation == |
| {{Root|mount /boot}}
| | === EFI === |
| | |
| {{Root|mount /boot/efi}}
| |
| | |
| {{Root|<nowiki>grub-install --boot-directory=/boot/efi/EFI --no-floppy --recheck</nowiki>}}
| |
| {{Root|efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "Linux" --loader "\\EFI\\grub\\grub.efi"}}
| |
| | |
| Gentoo:
| |
| {{Root|<nowiki>grub2-install --boot-directory=/boot/efi/efi --no-floppy --recheck</nowiki>}}
| |
| {{Root|efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "Linux" --loader "\\EFI\\grub2\\grub.efi"}}
| |
| | |
| | |
| {{Root|efibootmgr}}
| |
|
| |
|
| | {{Code|Assuming following GPT partition layout| |
| <pre> | | <pre> |
| BootCurrent: 0001
| | /dev/sda1 200 MiB /boot/efi EF00 vfat EFI System Partition |
| BootOrder: 0004,0000,0001,0002,0003
| | /dev/sda2 500 MiB /boot 8300 ext4 Linux filesystem |
| Boot0000* EFI SCSI Hard Drive
| | /dev/sda3 512 MiB 8200 swap Linux swap |
| Boot0001* EFI IDE CD/DVD Drive
| | /dev/sda4 25 GiB / 8300 ext4 Linux filesystem |
| Boot0002* EFI Network
| |
| Boot0003* EFI Internal Shell (Unsupported option)
| |
| Boot0004* Linux
| |
| </pre> | | </pre> |
| | }} |
|
| |
|
| == SET ACTIVE ==
| | {{Root|mount /boot}} |
|
| |
|
| {{Root|efibootmgr -b 4 -a}} | | {{Root|mount /boot/efi}} |
|
| |
|
| == DELETE == | | {{Root|<nowiki>grub-install --efi-directory=/boot/efi --no-floppy --recheck</nowiki>}} |
|
| |
|
| {{Root|efibootmgr -b 4 -B}}
| | ==== efibootmgr ==== |
|
| |
|
| {{Root|efibootmgr}} | | {{Root|efibootmgr}} |
| Line 54: |
Line 39: |
| Boot0002* EFI Network | | Boot0002* EFI Network |
| Boot0003* EFI Internal Shell (Unsupported option) | | Boot0003* EFI Internal Shell (Unsupported option) |
| | Boot0004* exherbo |
| </pre> | | </pre> |
|
| |
|
| | ===== SET ACTIVE ===== |
|
| |
|
| | {{Root|efibootmgr --bootnum 0004 --active}} |
|
| |
|
| | ===== DELETE ===== |
|
| |
|
| ==== Standard, single drive GPT/MBR (SATA/IDE/SCSI) ====
| | {{Root|efibootmgr --bootnum 0004 --delete-bootnum}} |
|
| |
|
| {{Root|grub-install --recheck --no-floppy /dev/sda}}
| | === GPT/MBR === |
| | |
| === Configuration ===
| |
| | |
| {{Note|Manual grub2 configuration should always happen in {{Path|/etc/default/grub}} and {{Path|/etc/grub.d/40_custom}}.}}
| |
| | |
| {{File|/etc/default/grub|
| |
| <pre>
| |
| GRUB_DISTRIBUTOR="Exherbo"
| |
| GRUB_DEFAULT="Exherbo GNU/Linux, current kernel"
| |
| </pre>
| |
| }}
| |
| | |
| ==== Standard, single drive GPT (SATA/IDE/SCSI) ====
| |
|
| |
|
| {{Code|Assuming following GPT partition layout| | | {{Code|Assuming following GPT partition layout| |
| Line 85: |
Line 61: |
| }} | | }} |
|
| |
|
| {{File|/etc/grub.d/40_custom| | | {{Root|mount /boot}} |
| <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 'Exherbo GNU/Linux, current kernel' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cf602240-7bac-4b29-8930-2080a5aac7cd' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_gpt
| |
| insmod ext2
| |
| set root='hd0,gpt2'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz root=/dev/sda4 ro
| |
| }
| |
| submenu 'Advanced options for Exherbo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-cf602240-7bac-4b29-8930-2080a5aac7cd' {
| |
| menuentry 'Exherbo GNU/Linux, current kernel (recovery mode)' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-advanced-current-recovery-cf602240-7bac-4b29-8930-2080a5aac7cd' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_gpt
| |
| insmod ext2
| |
| set root='hd0,gpt2'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz root=/dev/sda4 ro single
| |
| }
| |
| menuentry 'Exherbo GNU/Linux, previous kernel' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-advanced-previous-cf602240-7bac-4b29-8930-2080a5aac7cd' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_gpt
| |
| insmod ext2
| |
| set root='hd0,gpt2'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz.old root=/dev/sda4 ro
| |
| }
| |
| menuentry 'Exherbo GNU/Linux, previous kernel (recovery mode)' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-advanced-previous-recovery-cf602240-7bac-4b29-8930-2080a5aac7cd' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_gpt
| |
| insmod ext2
| |
| set root='hd0,gpt2'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 0930a69b-f2d5-4607-93fe-4f8bfdf2ea87
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz.old root=/dev/sda4 ro single
| |
| }
| |
| }
| |
| </pre>
| |
| }} | |
|
| |
|
| ==== Standard, single drive MBR (SATA/IDE/SCSI) ====
| | {{Root|grub-install --recheck --no-floppy /dev/sda}} |
|
| |
|
| {{Code|Assuming following MBR partition layout|
| | == Generate grub.cfg == |
| <pre>
| |
| /dev/sda1 32 MiB /boot ext2 Boot
| |
| /dev/sda2 512 MiB swap ext4 Swap
| |
| /dev/sda3 25 GiB / swap Root
| |
| </pre>
| |
| }}
| |
| | |
| {{File|/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 'Exherbo GNU/Linux, current kernel' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-010c7d23-2031-4c4b-b0e2-3fddbcd9bf61' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_msdos
| |
| insmod ext2
| |
| set root='hd0,msdos1'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz root=/dev/sda3 ro
| |
| }
| |
| submenu 'Advanced options for Exherbo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-010c7d23-2031-4c4b-b0e2-3fddbcd9bf61' {
| |
| menuentry 'Exherbo GNU/Linux, current kernel (recovery mode)' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-advanced-current-recovery-010c7d23-2031-4c4b-b0e2-3fddbcd9bf61' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_msdos
| |
| insmod ext2
| |
| set root='hd0,msdos1'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz root=/dev/sda3 ro single
| |
| }
| |
| menuentry 'Exherbo GNU/Linux, previous kernel' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-advanced-previous-010c7d23-2031-4c4b-b0e2-3fddbcd9bf61' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_msdos
| |
| insmod ext2
| |
| set root='hd0,msdos1'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz.old root=/dev/sda3 ro
| |
| }
| |
| menuentry 'Exherbo GNU/Linux, previous kernel (recovery mode)' --class exherbo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-advanced-previous-recovery-010c7d23-2031-4c4b-b0e2-3fddbcd9bf61' {
| |
| load_video
| |
| insmod gzio
| |
| insmod part_msdos
| |
| insmod ext2
| |
| set root='hd0,msdos1'
| |
| if [ x$feature_platform_search_hint = xy ]; then
| |
| search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| else
| |
| search --no-floppy --fs-uuid --set=root 5e056c75-61b4-42a5-8dd8-9fefd5f5b7fb
| |
| fi
| |
| echo 'Loading Linux ...'
| |
| linux /vmlinuz.old root=/dev/sda3 ro single
| |
| }
| |
| }
| |
| </pre>
| |
| }}
| |
| | |
| === Generate grub.cfg ===
| |
|
| |
|
| {{Warning|Running the following command will overwrite any changes in grub.cfg you manually made.}} | | {{Warning|Running the following command will overwrite any changes in grub.cfg you manually made.}} |
|
| |
|
| EFI:
| |
| {{Root|grub-mkconfig -o /boot/efi/efi/grub/grub.cfg}}
| |
|
| |
| EFI GENTOO:
| |
| {{Root|grub2-mkconfig -o /boot/efi/efi/grub2/grub.cfg}}
| |
|
| |
| NON EFI:
| |
| {{Root|grub-mkconfig -o /boot/grub/grub.cfg}} | | {{Root|grub-mkconfig -o /boot/grub/grub.cfg}} |
|
| |
|
| {{Root|umount /boot}}
| | == Configuration == |
|
| |
|
| === Updating Grub 2 ===
| | {{Note|Manual grub2 configuration should always happen in {{Path|/etc/default/grub}} and/or {{Path|/etc/grub.d/40_custom}}.}} |
| | |
| {{Root|mount /boot}} | |
| | |
| {{Root|grub-install --recheck --no-floppy /dev/sda}} | |
| | |
| {{Root|grub-mkconfig -o /boot/grub/grub.cfg}} | |
| | |
| {{Root|umount /boot}}
| |
|
| |
|
| === Optional: Additional Kernel Parameters === | | === Optional: Additional Kernel Parameters === |
| Line 265: |
Line 84: |
|
| |
|
| Regenerate your grub.cfg for the changes to take effect. | | Regenerate your grub.cfg for the changes to take effect. |
|
| |
| {{Root|mount /boot}}
| |
|
| |
| {{Root|grub-mkconfig -o /boot/grub/grub.cfg}}
| |
|
| |
| {{Root|umount /boot}}
| |
|
| |
|
| === Optional: Theme === | | === Optional: Theme === |
| Line 276: |
Line 89: |
| {{File|/etc/default/grub| | | {{File|/etc/default/grub| |
| <pre> | | <pre> |
| | GRUB_THEME=/boot/efi/EFI/grub/themes/starfield/theme.txt |
| GRUB_TERMINAL_OUTPUT=gfxterm | | GRUB_TERMINAL_OUTPUT=gfxterm |
| GRUB_THEME=/boot/grub/themes/starfield/theme.txt
| |
| </pre> | | </pre> |
| }} | | }} |
|
| |
|
| Regenerate your grub.cfg for the changes to take effect.
| | If your display resolutions isn't automatically detected you can manually force a specific resolution. |
|
| |
|
| {{Root|mount /boot}} | | {{File|/etc/default/grub| |
| | <pre> |
| | GRUB_GFXMODE=1600x1200 |
| | </pre> |
| | }} |
|
| |
|
| {{Root|grub-mkconfig -o /boot/grub/grub.cfg}}
| | Regenerate your grub.cfg for the changes to take effect. |
| | |
| {{Root|umount /boot}}
| |
|
| |
|
| === Optional: Serial Console === | | === Optional: Serial Console === |
| Line 300: |
Line 115: |
|
| |
|
| Regenerate your grub.cfg for the changes to take effect. | | Regenerate your grub.cfg for the changes to take effect. |
|
| |
| {{Root|mount /boot}}
| |
|
| |
| {{Root|grub-mkconfig -o /boot/grub/grub.cfg}}
| |
|
| |
| {{Root|umount /boot}}
| |
|
| |
|
| If you want to be able to login to your system via the serial console you need to edit {{Path|/etc/inittab}}. | | If you want to be able to login to your system via the serial console you need to edit {{Path|/etc/inittab}}. |
Packages
Exherbo: sys-boot/grub
Gentoo: sys-boot/grub
/etc/portage/make.conf
GRUB_PLATFORMS="efi-64"
Installation
EFI
| Code: Assuming following GPT partition layout
|
/dev/sda1 200 MiB /boot/efi EF00 vfat EFI System Partition
/dev/sda2 500 MiB /boot 8300 ext4 Linux filesystem
/dev/sda3 512 MiB 8200 swap Linux swap
/dev/sda4 25 GiB / 8300 ext4 Linux filesystem
|
# mount /boot
# mount /boot/efi
# grub-install --efi-directory=/boot/efi --no-floppy --recheck
efibootmgr
# efibootmgr
BootCurrent: 0001
BootOrder: 0004,0000,0001,0002,0003
Boot0000* EFI SCSI Hard Drive
Boot0001* EFI IDE CD/DVD Drive
Boot0002* EFI Network
Boot0003* EFI Internal Shell (Unsupported option)
Boot0004* exherbo
SET ACTIVE
# efibootmgr --bootnum 0004 --active
DELETE
# efibootmgr --bootnum 0004 --delete-bootnum
GPT/MBR
| Code: Assuming following GPT partition layout
|
/dev/sda1 1 MiB EF02 BIOS boot BIOS boot partition
/dev/sda2 100 MiB /boot 8300 ext4 Linux filesystem
/dev/sda3 512 MiB 8200 swap Linux swap
/dev/sda4 25 GiB / 8300 ext4 Linux filesystem
|
# mount /boot
# grub-install --recheck --no-floppy /dev/sda
Generate grub.cfg
Warning: Running the following command will overwrite any changes in grub.cfg you manually made.
# grub-mkconfig -o /boot/grub/grub.cfg
Configuration
Note: Manual grub2 configuration should always happen in /etc/default/grub and/or /etc/grub.d/40_custom.
Optional: Additional Kernel Parameters
File: /etc/default/grub
GRUB_CMDLINE_LINUX="acpi=off"
Regenerate your grub.cfg for the changes to take effect.
Optional: Theme
File: /etc/default/grub
GRUB_THEME=/boot/efi/EFI/grub/themes/starfield/theme.txt
GRUB_TERMINAL_OUTPUT=gfxterm
If your display resolutions isn't automatically detected you can manually force a specific resolution.
File: /etc/default/grub
GRUB_GFXMODE=1600x1200
Regenerate your grub.cfg for the changes to take effect.
Optional: Serial Console
File: /etc/default/grub
GRUB_TERMINAL=serial
GRUB_SERIAL=COMMAND="serial --unit=0 --speed=57600 --word=8 --parity=no --stop=1"
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,57600"
Regenerate your grub.cfg for the changes to take effect.
If you want to be able to login to your system via the serial console you need to edit /etc/inittab.
File: /etc/inittab
Uncomment the s0 entry and change the speed to your needs.
# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty 57600 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100