Install grub2 on Debian Linux

Grub2 supports high res background, e.g. 1024×768, 1280×800, supports more picture format, e.g. JPEG, PNG, TGA, and 24bit color. This tutorial will guide to install grub2 to replace grub.

Note: I am running Debian Lenny. The commands should be similar if you are running Ubuntu or Debian etch.

I. Installtion

  • i. sudo aptitude install grub2 grub-pc grub-common
    • The following message will be propmpted:
            GRUB upgrade scripts have detected a GRUB Legacy setup in /boot/grub.
            In order to replace the Legacy version of GRUB in your system, it is
            recommended that /boot/grub/menu.lst is adjusted to chainload GRUB 2
            from your existing GRUB Legacy setup. This step may be automaticaly
            performed now.
      
            It’s recommended that you accept chainloading GRUB 2 from menu.lst, and
            verify that your new GRUB 2 setup is functional for you, before you
            install it directly to your MBR (Master Boot Record).
      
            In either case, whenever you want GRUB 2 to be loaded directly from MBR,
            you can do so by issuing (as root) the following command:
            upgrade-from-grub-legacy
      
    • Question: Chainload from menu.lst?
      • Yes
    • The following Linux command line was extracted from the `kopt’ parameter in GRUB Legacy’s menu.lst. Please verify that it is correct, and modify it if necessary.
      • Linux command line:
      • Dont need to input anything, Press Enter.
  • ii. Restart the system. You will see the grub menu has been changed. Grub2 item is added to the list. (The original grub is still in the MBR it chains to new grub2 as an menu item). To remove the grub completely and use grub2 instead, you need to:
    • sudo upgrade-from-grub-legacy

II. Configuration

  • grub2's configuration file is /boot/grub/grub.cfg.

i. Add Entry for Windows Partition

  1. sudo vi /etc/grub.d/11_windows
    • #!/bin/sh -e
    • echo “Adding Windows” >&2
    • cat « EOF
    • menuentry “Windows XP” {
    • # Adjust the partition number as needed
    • chainloader (hd0,1)+1
    • }
    • EOF
  2. sudo chmod +x /etc/grub.d/11_windows
  3. sudo update-grub
  4. reboot
  • Alternatively use os-prober
    • aptitude install os-prober

ii. Change grub2 Screen Resolution

  1. sudo vi /etc/grub.d/00_header
    • set gfxmode=1280×800
  2. sudo update-grub

iii. Change default boot partition

  1. sudo vi /etc/default/grub
    • GRUB_DEFAULT=2
  2. sudo update-grub

III. See Also

admin/grub2-installation.txt · Last modified: 2009/01/18 10:35 by wilson

www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0