Grub

From TheBeard Science Project Wiki
Jump to: navigation, search
packages:
	grub

config:
	/boot/grub/grub.conf
		hard drive notation: (hd<drive#>,<partition#>) starting at 0
		global config:
			hiddenmenu - no additional menus
			password --md5 <hash> - set grub password (use grub-md5-crypt to generate hash)
			default=<#> - default OS to load. # starts with 0.
			timeout=<#> - prompt timeout in seconds.
			splashimage=(hd0,1)/path - path to background image. usually compressed, ie file.xpm.gz

		kernel config (must be tabbed like this):
			title <name>
				root (hd0,1)
				kernel /path <parameters>
				initrd /path

			title <windows OS>
				rootnoverify (hd0,0)
				chainloader +1

		kernel parameters:
			rhgb (red hat graphical boot) - use splash
			nosmp - disables symmetrical multi-processing support
			mem=<#>M - forces detection of physical memory


other:
	stage 1 - resides on MBR/GPT and points to stage 1.
	stage 1.5 - reside in /boot/grub. loads filesystem support and loads stage 2.
	stage 2 - reside in /boot/grub. displays the actual screen and boots kernels and stuff.
	grub does NOT need to be reinstalled after changing the config.
	grub refers to the partition which contains stage 2 as the "grub root partition". if on separate partition, usually the config is /grub/grub.conf instead

commands:
	at grub menu:
		e - edit
		c - cli

	grub cli:
		help
		can type 	"kernel <options>" [enter]
					"initrd <options>" [enter]
					"boot"

	grub-install - command available in restore mode. reinstalls damaged grub
	grub-install /dev/sda - installs grub stage 1 into MBR. also do grub-install /dev/sda1 to install onto first partition.
	
grub password:

	grub-crypt --md5 - use to generate hash

	paste [hash] into grub.conf under global config as:
		password --md5 [hash]
	
	Example:
		gfxmenu (hd0,4)/message
		color white/blue black/light-gray
		default 0
		timeout 8
		password --md5 $1$lS2dv/$JOYcdxIn7CJk9xShzzJVw/

	lockalternative=true - global config, locks the grub menu.
	lock - add this arg on new line under each OS section which should be password protected

new grub method:
	grub-mkpasswd-pbkdf2 - generate password hash
	add to /etc/grub.d/40_custom:
		set superusers="grubroot"
		password_pbkdf2 grubroot [hash]
	
	update-grub

	add to /etc/init.d/10_linux after 'printf "menuentry':
		--users grubroot

	...so that it looks like: printf "menuentry --users grubroot ...

	update-grub

USING WINDOWS BOOT LOADER TO DUAL BOOT LINUX:
	if windows overwrites MBR, use System Rescue to modify /boot/grub/grub.conf and reinstall grub.
	alternatively, you can use windows boot loader to load linux. to do this, you must add additional components to the windows boot loader.
	EasyBCD can be downloaded from neosmart.net.

	using EasyBCD:
		copy grub.conf to removable media
		install windows
		install EasyBCD on windows
		open EasyBCD and click Add New Entry
		click the NeoGrub tab
		click install in the NeoGrub tab
		click Configure. this opens C:\NST\menu.lst in notepad
		copy the contents of grub.conf into menu.lst