Grub2

Differences between revisions 35 and 36
Revision 35 as of 2009-06-23 20:24:50
Size: 9190
Editor: S0106001a70f95b99
Comment:
Revision 36 as of 2009-06-23 20:36:16
Size: 9174
Editor: S0106001a70f95b99
Comment:
Deletions are marked like this. Additions are marked like this.
Line 174: Line 174:
 * Type in '''insmod linux''' and press '''ENTER'''
 * Escape back to boot menu and you should have no errors when trying to boot.
 * Type in ''' insmod linux ''' and press ''' ENTER '''
 * Press ''' ESC ''' to go back
 * ''' CTRL-X '''
to boot

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*

grub.cfg

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.

Please note that partition numbering has been changed to start from 1 (in grub legacy it started from 0).

Here is an simple example:

# Timeout for menu
set timeout=10

# Set default boot entry as Entry 0
set default=0

# Entry 0 - Load Linux kernel
menuentry "My Linux Kernel on (hd0,1)" {
    set root=(hd0,1)
    linux /vmlinuz root=/dev/hda1
    initrd /initrd
}

# Entry 1 - Chainload another bootloader
menuentry "Chainload my OS" {
    set root=(hd0,3)
    chainloader +1
}

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

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

sleep 'invalid number 0.1'

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)