GRUB: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
No edit summary
Tgurr (talk | contribs)
 
(48 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 7: Line 5:
Gentoo: {{Package|sys-boot/grub}}
Gentoo: {{Package|sys-boot/grub}}


=== Installation ===
/etc/portage/make.conf
{{Root|mount /boot}}
<pre>
GRUB_PLATFORMS="efi-64"
</pre>


Install grub after mounting /boot.
== Installation ==
=== EFI ===


{{Root|grub-mkconfig -o /boot/grub/grub.cfg}}
{{Code|Assuming following GPT partition layout|
<pre>
/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
</pre>
}}


Standard installation:
{{Root|mount /boot}}


{{Root|grub-install --recheck --no-floppy /dev/sda}}
{{Root|mount /boot/efi}}


HP Server /dev/cciss installation:
{{Root|<nowiki>grub-install --efi-directory=/boot/efi --no-floppy --recheck</nowiki>}}


{{Root|grub-install --recheck --no-floppy /dev/cciss/c0d0}}
==== efibootmgr ====


/sbin/grub-setup: warn: Your embedding area is unusually small.  core.img won't fit in it..
{{Root|efibootmgr}}
/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/sbin/grub-setup: error: will not proceed with blocklists.


{{Root|grub-install --recheck --no-floppy /dev/cciss/c0d0 --force}}
<pre>
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
</pre>


/sbin/grub-setup: warn: Your embedding area is unusually small.  core.img won't fit in it..
===== SET ACTIVE =====
/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
Installation finished. No error reported.


{{Root|umount /boot}}
{{Root|efibootmgr --bootnum 0004 --active}}


===== DELETE =====


=== Configuration ===
{{Root|efibootmgr --bootnum 0004 --delete-bootnum}}


==== Standard ====
=== GPT/MBR ===
 
{{Code|Assuming following GPT partition layout|
<pre>
<pre>
### BEGIN /etc/grub.d/10_linux ###
/dev/sda1 1   MiB EF02 BIOS boot BIOS boot partition
menuentry "Gentoo GNU/Linux" --class gentoo --class gnu-linux --class gnu --class os {
/dev/sda2 100 MiB /boot 8300 ext4 Linux filesystem
        set gfxpayload=keep
/dev/sda3 512 MiB 8200 swap Linux swap
        insmod ext2
/dev/sda4 25  GiB / 8300 ext4 Linux filesystem
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set ba16bd87-842c-46c2-a487-2a27d9be90dd
        echo    Loading Linux ...
        linux  /vmlinuz root=/dev/sda3 ro
}
menuentry "Gentoo GNU/Linux (recovery mode)" --class gentoo --class gnu-linux --class gnu --class os {
        set gfxpayload=keep
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set ba16bd87-842c-46c2-a487-2a27d9be90dd
        echo    Loading Linux ...
        linux  /vmlinuz root=/dev/sda3 ro single
}
menuentry "Gentoo GNU/Linux, previous kernel" --class gentoo --class gnu-linux --class gnu --class os {
        set gfxpayload=keep
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set ba16bd87-842c-46c2-a487-2a27d9be90dd
        echo    Loading Linux ...
        linux  /vmlinuz root=/dev/sda3 ro
}
menuentry "Gentoo GNU/Linux, previous kernel (recovery mode)" --class gentoo --class gnu-linux --class gnu --class os {
        set gfxpayload=keep
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set ba16bd87-842c-46c2-a487-2a27d9be90dd
        echo    Loading Linux ...
        linux  /vmlinuz root=/dev/sda3 ro single
}
### END /etc/grub.d/10_linux ###
</pre>
</pre>
}}
{{Root|mount /boot}}
{{Root|grub-install --recheck --no-floppy /dev/sda}}


==== cciss ====
== Generate grub.cfg ==
 
{{Warning|Running the following command will overwrite any changes in grub.cfg you manually made.}}
 
{{Root|grub-mkconfig -o /boot/grub/grub.cfg}}
 
== Configuration ==
 
{{Note|Manual grub2 configuration should always happen in {{Path|/etc/default/grub}} and/or {{Path|/etc/grub.d/40_custom}}.}}
 
=== Optional: Additional Kernel Parameters ===
 
{{File|/etc/default/grub|
<pre>
<pre>
### BEGIN /etc/grub.d/10_linux ###
GRUB_CMDLINE_LINUX="acpi=off"
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os {
        load_video
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root b3727853-ae78-4a00-b21c-7b974c233e1c
        echo    'Loading Linux ...'
        linux  /vmlinuzo root=/dev/cciss/c0d0p3 ro
}
menuentry 'Gentoo GNU/Linux (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os {
        load_video
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root b3727853-ae78-4a00-b21c-7b974c233e1c
        echo    'Loading Linux ...'
        linux  /vmlinuz root=/dev/cciss/c0d0p3 ro single
}
menuentry 'Gentoo GNU/Linux, previous kernel' --class gentoo --class gnu-linux --class gnu --class os {
        load_video
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root b3727853-ae78-4a00-b21c-7b974c233e1c
        echo    'Loading Linux ...'
        linux  /vmlinuz.old root=/dev/cciss/c0d0p3 ro
}
menuentry 'Gentoo GNU/Linux, previous kernel (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os {
        load_video
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set=root b3727853-ae78-4a00-b21c-7b974c233e1c
        echo    'Loading Linux ...'
        linux  /vmlinuz.old root=/dev/cciss/c0d0p3 ro single
}
### END /etc/grub.d/10_linux ###
</pre>
</pre>
}}


Regenerate your grub.cfg for the changes to take effect.


=== Updating Grub 2 ===
=== Optional: Theme ===


{{Root|mount /boot}}
{{File|/etc/default/grub|
<pre>
GRUB_THEME=/boot/efi/EFI/grub/themes/starfield/theme.txt
GRUB_TERMINAL_OUTPUT=gfxterm
</pre>
}}


{{Root|grub-install --recheck --no-floppy /dev/sda}}
If your display resolutions isn't automatically detected you can manually force a specific resolution.


{{Root|umount /boot}}
{{File|/etc/default/grub|
<pre>
GRUB_GFXMODE=1600x1200
</pre>
}}


=== Serial Console ===
Regenerate your grub.cfg for the changes to take effect.


{{Note|Manual grub2 configuration should always happen in {{Path|/etc/default/grub}}}}
=== Optional: Serial Console ===


{{File|/etc/default/grub|
{{File|/etc/default/grub|
Line 138: Line 114:
}}
}}


 
Regenerate your grub.cfg for the changes to take effect.
{{Warning|Running the following command will overwrite any changes in grub.cfg you manually made}}
 
{{Root|mount /boot && grub-mkconfig -o /boot/grub/grub.cfg}}
 


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}}.


{{File|/etc/default/grub|
{{File|/etc/inittab|
Uncomment the s0 entry and change the speed to your needs.
Uncomment the s0 entry and change the speed to your needs.
<pre>
<pre>

Latest revision as of 12:16, 11 May 2017

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