Grub2
Size: 12430
Comment:
|
Size: 12392
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 42: | Line 42: |
== grub.cfg == This is the main Grub 2 file. It "replaces" Grub Legacy's /boot/grub/menu.lst This file contains the Grub menu information but unlike Grub Legacy's menu.lst file, grub.cfg is not meant to be edited. * grub.cfg is automatcially generated when "update-grub" is executed: /etc/default/grub and the files contained in /etc/grub.d * Each section (### BEGIN) is clearly delineated and references the file in the /etc/grub.d folder from which the information was generated. * grub.cfg is updated by running the "update-grub2" or "update-grub" command as root. * By default, and whenever the "update-grub2" command is executed, this file is made "read-only". This is in keeping with the intent that the file should not be edited manually. NOTE: you can use the update-grub (or grub-mkconfig in SVN trunk) utility to generate a grub.cfg file for you GRUB 2 uses new bashish scripting language that is used to build menus. At startup file grub.cfg will be read and executed. |
== /boot/grub/grub.cfg == This is the main Grub 2 file. It "replaces" Grub Legacy's '''/boot/grub/menu.lst''' This file contains the Grub menu information but unlike Grub Legacy's '''menu.lst''' file, '''grub.cfg''' is '''NOT MEANT TO BE EDITED.''' * '''grub.cfg''' is automatcially generated when `"update-grub"` is executed: '''/etc/default/grub''' and the files contained in '''/etc/grub.d''' * Each section (### BEGIN) is clearly delineated and references the file in the '''/etc/grub.d''' folder from which the information was generated. * '''grub.cfg''' is updated by running the `"update-grub2"` or `"update-grub"` command as root. * By default, and whenever the `"update-grub2"` command is executed, this file is made "read-only". This is in keeping with the intent that the file should not be edited manually. GRUB 2 uses new bashish scripting language that is used to build menus. At startup file '''grub.cfg''' will be read and executed. |
GRand Unified Bootloader, version 2 (Grub 2) is the second version of GNU GRUB. It is a data-processing program making it possible to charge an operating system. It can start by itself of the systems compatible with standard POSIX (GNU/Linux, *BSD, Mac OS, etc) and has the capacity to connect towards another charger of starting for the systems noncompatible with standard POSIX.
More than one continuity of the project GRUB Legacy precedent, GRUB 2 is a complete rewriting. Based on the research project PUPA, the purpose of GRUB 2 is to be a more modular charger of starting and portable that its predecessor. Some of the aims had by GRUB 2 are as follows:
- a graphic interface;
- the loading of modules at the object time rather than to compilation;
- portability towards various material architectures (BIOS, EFI, Coreboot…) ;
- a mode of help takes again the hand in the event of error of loading. stage1.5 were eliminated;
- correction in the management of the classification of the partitions, thing which could not be brought back in GRUB.
GRUB 2 Testing
Please follow this link and please help out with GRUB 2 Testing.
Installing / Upgrading
Installing (Ubuntu 9.10)
GRUB 2 will be installed by default on NEW installations of Karmic. If you have upgraded from Jaunty 9.04 to Karmic 9.10 you can follow the install instructions for Jaunty 9.04 below.
Installing (Ubuntu 9.04+)
- open terminal
$ sudo apt-get install grub2
- select OK from grub-pc configuration
- chainload from menu.lst, YES
- linux command line, ENTER
note this is only temporary, you must make changes permanent
- Open up a terminal
$ sudo upgrade-from-grub-legacy GRUB 2 will then show you where it's booting from. On my test system it displayed (hd0) /dev/sda but this might differ on your system. If this is incorrect, you must edit /boot/grub/device.map to match your system and then run `$ sudo grub-install'
GRUB 2 should be fully installed, with GRUB legacy removed, and it's configuration files backed up. GRUB legacy configuration files are located in /boot/grub and are named menu.lst*
/boot/grub/grub.cfg
This is the main Grub 2 file. It "replaces" Grub Legacy's /boot/grub/menu.lst This file contains the Grub menu information but unlike Grub Legacy's menu.lst file, grub.cfg is NOT MEANT TO BE EDITED.
grub.cfg is automatcially generated when "update-grub" is executed:
/etc/default/grub and the files contained in /etc/grub.d
Each section (### BEGIN) is clearly delineated and references the file in the /etc/grub.d folder from which the information was generated.
grub.cfg is updated by running the "update-grub2" or "update-grub" command as root.
By default, and whenever the "update-grub2" command is executed, this file is made "read-only". This is in keeping with the intent that the file should not be edited manually.
GRUB 2 uses new bashish scripting language that is used to build menus. At startup file grub.cfg will be read and executed.
Please note that partition numbering has been changed to start from 1 (in grub legacy it started from 0).
Sample boot.cfg including Windows and one manual entry (41_srcd):
# # DO NOT EDIT THIS FILE # # It is automatically generated by /usr/sbin/update-grub using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### set default=0 set timeout=5 set root=(hd0,5) search --fs-uuid --set b02e1934-12dd-418a-be3a-9ff7d3e7e7ea if font /usr/share/grub/ascii.pff ; then set gfxmode=640x480 insmod gfxterm insmod vbe terminal gfxterm fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ### set menu_color_normal=cyan/blue set menu_color_highlight=white/blue ### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_hurd ### ### END /etc/grub.d/10_hurd ### ### BEGIN /etc/grub.d/10_linux ### set root=(hd0,5) search --fs-uuid --set b02e1934-12dd-418a-be3a-9ff7d3e7e7ea menuentry "Ubuntu, linux 2.6.28-13-generic" { linux /boot/vmlinuz-2.6.28-13-generic root=UUID=b02e1934-12dd-418a-be3a-9ff7d3e7e7ea ro quiet splash vga800 initrd /boot/initrd.img-2.6.28-13-generic } menuentry "Ubuntu, linux 2.6.28-13-generic (single-user mode)" { linux /boot/vmlinuz-2.6.28-13-generic root=UUID=b02e1934-12dd-418a-be3a-9ff7d3e7e7ea ro single initrd /boot/initrd.img-2.6.28-13-generic } menuentry "Ubuntu, linux 2.6.28-11-generic" { linux /boot/vmlinuz-2.6.28-11-generic root=UUID=b02e1934-12dd-418a-be3a-9ff7d3e7e7ea ro quiet splash vga800 initrd /boot/initrd.img-2.6.28-11-generic } menuentry "Ubuntu, linux 2.6.28-11-generic (single-user mode)" { linux /boot/vmlinuz-2.6.28-11-generic root=UUID=b02e1934-12dd-418a-be3a-9ff7d3e7e7ea ro single initrd /boot/initrd.img-2.6.28-11-generic } ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/20_memtest86+ ### menuentry "Memory test (memtest86+)" { linux /boot/memtest86+.bin } menuentry "Memory test (memtest86+, serial console 115200)" { linux /boot/memtest86+.bin console=ttyS0,115200n8 } ### END /etc/grub.d/20_memtest86+ ### ### BEGIN /etc/grub.d/30_os-prober ### menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" { set root=(hd0,1) chainloader +1 } ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/40_custom ### # This file is an example on how to add custom entries ### END /etc/grub.d/40_custom ### ### BEGIN /etc/grub.d/41_srcd ### menuentry "System Rescue CD on hard drive" { set root=(hd0,10) linux /sysrcd/rescuecd subdir=sysrcd setkmap=us initrd /sysrcd/initram.igz } ### END /etc/grub.d/41_srcd ###
Default Boot Entry
- Changing the default boot entry in GRUB 2 is simple
$ sudo nano /etc/default/grub
Find GRUB_DEFAULT=0 and change 0 to what ever menu entry you want, they are ordered as 0 1 2 3 4, from top to bottom.
Themeing
As of version 1.96 of GRUB 2, theme support is not enabled
The GRUB graphical menu supports themes that can customize the layout and appearance of the GRUB boot menu. The theme is configured through a plain text file that specifies the layout of the various GUI components (including the boot menu, timeout progress bar, and text messages) as well as the appearance using colors, fonts, and images.
Take a look at this thread on Grub 2 Themeing
Splash Images
Great link here.
Background Colors/Image
Background colors and images are configured in a script located in /etc/grub.d/ if you look in there you will find a file called 05_debian_theme which is the default color scheme for GRUB 2. Now to create your own color scheme you have a few options, you can copy and edit the default 05_debian_theme or create your own script.
All the files in /etc/grub.d/ are run in order, so if you have 2 theme files, 05_debian_theme and 06_mytheme, the latter (06_mytheme) will be run last, which will be the background you see.
Copy/Edit Default Colors
- Copy the default color theme
$ sudo cp /etc/grub.d/05_debian_theme /etc/grub.d/05_debian_theme.BACKUP $ sudo nano /etc/grub.d/05_debian_theme
- Now you can edit the file to your hearts content.
Create a new theme file
- Create the new theme file
$ sudo nano /etc/grub.d/06_mytheme
- Now you can put whatever you want in here
Commands
As GRUB 2 has been totally re-written, there are now some commands you might be used to in GRUB legacy that don't exist in GRUB 2. Take a look at the Grub 2 Command's List here.
Recover Grub 2 via LiveCD
First, grab a copy of the latest Ubuntu LiveCD and boot it.
- Open a terminal and type
$ sudo fdisk -l
- Now, you need to remember which device listed is your linux distribution, for reference, /dev/sda1 will be used. Now we need to mount the filesystem to /mnt
$ sudo mount /dev/sda1 /mnt
- If you have /boot on a separate partition, that need's to be mounted aswell. For reference, /dev/sda2 will be used.
$ sudo mount /dev/sda2 /mnt/boot Make sure you don't mix these up, pay attention to the output of FDISK
- Now mount the rest of your devices
$ sudo mount --bind /dev /mnt
- Now chroot into your system
$ sudo chroot /mnt
You should be chroot'd into your system as root, you can now run commands as root, without the need for sudo.
Now you need to edit the /etc/default/grub file to fit your system
$ nano /etc/default/grub
When that is done you need to run grub-update to create the configuration file.
$ grub-update
To install GRUB 2 to the MBR, next you need to run grub-install /dev/sda
$ grub-install /dev/sda
If you encounter any errors, try grub-install --recheck /dev/sda
$ grub-install --recheck /dev/sda
- Press Ctrl+D to exit out of the chroot.
- Once you exit back to your regular console, undo all the mounting, first the /dev
$ sudo umount /mnt/dev
- Now you can unmount the root system
$ sudo umount /mnt
- And you should be free to restart your system right into GRUB 2 and then into your system installation.
Errors
Dual-booting
Following this thread on the forums, users have seemed to come up with a Karmic work around for fixing your dual-boot problems...
$ sudo apt-get install --reinstall libdebian-installer4 $ sudo os-prober $ sudo update-grub
--no-floppy
It seems after an update yesterday Monday June 22, 2009 that some users are experiencing a --no-floppy error. There is a simple workaround to this. Check out this thread
Edit your boot command with E
Remove all entries of --no-floppy
- Boot into Ubuntu and backup your GRUB 2 configuration
$ sudo cp /etc/grub/grub.cfg /etc/grub/grub.cfg.backup
- Then edit your configuration
$ sudo nano /etc/grub/grub.cfg
Delete all entries of --no-floppy
unkown command 'initrd'
This error came after upgrading from Jaunty 9.04 to Karmic 9.10 on June 23, 2009. The work around was to remove the search line from the boot line. Take a look here and notice the search --fs-uuid line and remove it.
Press E to edit your boot line
Remove the search --fs-uuid line completely
Press Ctrl-C to enter the GRUB command line
Type in insmod linux and press ENTER
Press ESC to go back
CTRL-X to boot
Once you get into your system you need to re-install grub to your device, mine was sda
sudo grub-install /dev/sda
This fixed the problem and now booting is back to normal.
sleep 'invalid number 0.1'
***Fix released June 24, 2009***
Floating sleeps was built in, but not configured in the newest version of busybox, here's the fix.
Add dupondje's PPA
deb http://ppa.launchpad.net/dupondje/ppa/ubuntu karmic main deb-src http://ppa.launchpad.net/dupondje/ppa/ubuntu karmic main
Update & Upgrade
$ sudo apt-get update && sudo apt-get upgrade
- Update initramfs
$ sudo update-initramfs -uk all
Error 11
After upgrading from GRUB Legacy
Error 11: Unrecognized device string...
- press any key to continue
- highlight "Chainload into GRUB 2"
- press e
- highlight "root xxxxxxxxxxxxxxxxxxxx"
- press e
- change "root xxxxxxxxxxxxxxxx" to "uuid xxxxxxxxxxxxxxxxxx"
- press b to boot "uuid xxxxxxxxxxxxxxxxxxx"
- load your kernel and press enter
Grub2 (last edited 2010-10-26 04:54:02 by c-67-169-130-5)