GRUB: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
No edit summary
Tgurr (talk | contribs)
mNo edit summary
Line 178: Line 178:
{{Root|umount /boot}}
{{Root|umount /boot}}


=== Optional: Additional Kernel Parameters ==
=== Optional: Additional Kernel Parameters ===


{{File|/etc/default/grub|
{{File|/etc/default/grub|

Revision as of 17:44, 13 March 2012

GRUB 2

Packages

Exherbo: sys-boot/grub

Gentoo: sys-boot/grub

Installation

# mount /boot

Standard, single drive (SATA/IDE/SCSI)

# grub-install --recheck --no-floppy /dev/sda

Special, hardware RAID (HP Smart Array CCISS)

# grub-install --recheck --no-floppy /dev/cciss/c0d0

/sbin/grub-setup: warn: Your embedding area is unusually small. core.img won't fit in it.. /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.

# grub-install --recheck --no-floppy /dev/cciss/c0d0 --force

/sbin/grub-setup: warn: Your embedding area is unusually small. core.img won't fit in it.. /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.

Configuration

Note: Manual grub2 configuration should always happen in /etc/default/grub and /etc/grub.d/40_custom.
File: /etc/default/grub
GRUB_DISTRIBUTOR="Exherbo"
GRUB_DEFAULT="Exherbo GNU/Linux, current kernel"

Standard, single drive (SATA/IDE/SCSI)

File: /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 '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-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 single
	}
	menuentry 'Exherbo GNU/Linux, previous 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.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-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.old root=/dev/sda3 ro single
	}
}

Special, hardware RAID (HP Smart Array CCISS)

File: /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 'GNU/Linux, current kernel' --class gnu-linux --class gnu --class os {
        load_video
        insmod gzio
        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 'GNU/Linux, current kernel (recovery mode)' --class gnu-linux --class gnu --class os {
        load_video
        insmod gzio
        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 'GNU/Linux, previous kernel' --class gnu-linux --class gnu --class os {
        load_video
        insmod gzio
        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 'GNU/Linux, previous kernel (recovery mode)' --class gnu-linux --class gnu --class os {
        load_video
        insmod gzio
        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
}

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
# umount /boot

Updating Grub 2

# mount /boot
# grub-install --recheck --no-floppy /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
# umount /boot

Optional: Additional Kernel Parameters

File: /etc/default/grub
GRUB_CMDLINE_LINUX="acpi=off"

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

# mount /boot
# grub-mkconfig -o /boot/grub/grub.cfg
# umount /boot

Optional: Theme

File: /etc/default/grub
GRUB_TERMINAL_OUTPUT=gfxterm
GRUB_THEME=/boot/grub2/themes/starfield/theme.txt

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

# mount /boot
# grub-mkconfig -o /boot/grub/grub.cfg
# umount /boot

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.

# mount /boot
# grub-mkconfig -o /boot/grub/grub.cfg
# umount /boot

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