GrubHowto

Differences between revisions 9 and 11 (spanning 2 versions)
Revision 9 as of 2006-01-27 04:33:03
Size: 5159
Editor: S0106000000cc07fc
Comment: tweaks
Revision 11 as of 2006-06-13 16:08:56
Size: 5759
Editor: ochin-fw
Comment: added a new subsection to Bootsplash called "Splash Image with update-grub"
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
GRUB is a bootloader, it is the first thing that loads when the computer starts. It allows you to have different operating systems, and versions of them, on the same hard drive. For example you may have Windows and Linux on a computer, GRUB would load before either of these and give you a choice. You can also create a boot floppy with GRUB to use in case of emergency.  GRUB is a bootloader, it is the first thing that loads when the computer starts. It allows you to have different operating systems, and versions of them, on the same hard drive. For example you may have Windows and Linux on a computer, GRUB would load before either of these and give you a choice. You can also create a boot floppy with GRUB to use in case of emergency.
Line 13: Line 13:
If you need to get into the grub menu you need to press ESC just after it starts. By default you have to press ESC very quickly. To increase this time edit /boot/grub/menu.lst, increasing the seconds in the TIMEOUT part. Alternatively you could have the menu always come up at boot time. To do this, comment out 'hiddenmenu' by inserting a # at the beginning of the line. Once you have changed menu.lst you must run:
{{{
$ sudo update-grub
}}}
  If you need to get into the grub menu you need to press ESC just after it starts. By default you have to press ESC very quickly. To increase this time edit /boot/grub/menu.lst, increasing the seconds in the TIMEOUT part. Alternatively you could have the menu always come up at boot time. To do this, comment out 'hiddenmenu' by inserting a # at the beginning of the line. Once you have changed menu.lst you must run:
  {{{
  sudo update-grub
  }}}
Line 18: Line 18:
Note that if the Ubuntu installer detected other operating systems on the disk during the installation, then the grub menu will be displayed by default and the timeout will be increased, so the step above will be unnecessary. attachment:IconsPage/IconNote.png
  I
f the Ubuntu installer detected other operating systems on the disk during the installation, then the grub menu will be displayed by default and the timeout will be increased, so the step above will be unnecessary.
Line 22: Line 23:
In `/boot/grub/menu.lst`, you will find a line like this: {{{
# kopt=root=/dev/sda1 ro
}}}
  In `/boot/grub/menu.lst`, you will find a line like this:
  
{{{
  # kopt=root=/dev/sda1 ro
  }}}
Line 26: Line 28:
It is a comment, but do not remove the '# ' at the beginning. THIS IS IMPORTANT.   It is a comment, but do not remove the '# ' at the beginning. /!\ THIS IS IMPORTANT.
Line 28: Line 30:
If you require additional kernel parameters (for example, if someone has asked you to test booting with certain parameters in order to troubleshoot a problem), add them to the end of the line, for example to add `noapic`: {{{
# kopt=root=/dev/sda1 ro noapic
}}}
  If you require additional kernel parameters (for example, if someone has asked you to test booting with certain parameters in order to troubleshoot a problem), add them to the end of the line, for example to add `noapic`:    {{{
  # kopt=root=/dev/sda1 ro noapic
  }}}
Line 32: Line 35:
After editing the file, run: {{{
$ sudo update-grub
}}}
  After editing the file, run:
  
{{{
  sudo update-grub
  }}}
Line 36: Line 40:
at the command line.
Line 40: Line 44:
If {{{/boot}}} is mounted on another partition and you use {{{update-grub}}}, then you may run into problems. One fix is to use {{{grub-install}}}, which is a distribution-agnostic way to install {{{grub}}}.
{{{
sudo grub-install --root-directory=/boot /dev/sda
}}}
This is probably less desirable because {{{update-grub}}} is very good at setting things up properly, therefore it should be used instead.
  If {{{/boot}}} is mounted on another partition and you use {{{update-grub}}}, then you may run into problems. One fix is to use {{{grub-install}}}, which is a distribution-agnostic way to install {{{grub}}}.
  {{{
  sudo grub-install --root-directory=/boot /dev/sda
  }}}
  This is probably less desirable because {{{update-grub}}} is very good at setting things up properly, therefore it should be used instead.
Line 46: Line 50:
Another fix is to create a symlink in {{{/boot}}} to itself:
{{{
cd /boot
sudo ln -s . boot
}}}
The reasoning behind this is when grub boots, it looks at whatever partition it is installed on. {{{update-grub}}} (and {{{grub-install}}}) assumes that everything is in {{{/boot}}}. When {{{/boot}}} is on the same partition as {{{/}}}, then all is OK, as {{{menu.lst}}} will be in {{{/boot/grub}}}. If {{{/boot}}} is on a separate partition, then grub sees {{{/boot}}} as {{{/}}} (hence the '--root-directory' above). By adding a symlink, when it looks for {{{/boot/grub}}}, it will be there. By creating the symlink, you have put a loop in the file system, which may cause problems when using certain options of {{{cp}}}, {{{mv}}}, etc.
  Another fix is to create a symlink in {{{/boot}}} to itself:
  {{{
  cd /boot
  sudo ln -s . boot
  }}}
  The reasoning behind this is when grub boots, it looks at whatever partition it is installed on. {{{update-grub}}} (and {{{grub-install}}}) assumes that everything is in {{{/boot}}}. When {{{/boot}}} is on the same partition as {{{/}}}, then all is OK, as {{{menu.lst}}} will be in {{{/boot/grub}}}. If {{{/boot}}} is on a separate partition, then grub sees {{{/boot}}} as {{{/}}} (hence the '--root-directory' above). By adding a symlink, when it looks for {{{/boot/grub}}}, it will be there. By creating the symlink, you have put a loop in the file system, which may cause problems when using certain options of {{{cp}}}, {{{mv}}}, etc.
Line 55: Line 59:
Grub allows an image to be displayed behind the menu. You can obtain a set of images with the package "grub-splashimages", or you can make your own. The images must be 640x480 pixels, contain no more than 16 colors (but a smaller number like 12 works better to allow some different colors for the menu text), and be in gzipped xpm format. The GIMP can be used to resize (Image -> Scale Image...), reduce colors (Image -> Mode -> Indexed...), and can save to .xpm.gz files.   Grub allows an image to be displayed behind the menu. You can obtain a set of images with the package "grub-splashimages", or you can make your own. The images must be 640x480 pixels, contain no more than 16 colors (but a smaller number like 12 works better to allow some different colors for the menu text), and be in gzipped xpm format. The GIMP can be used to resize (Image -> Scale Image...), reduce colors (Image -> Mode -> Indexed...), and can save to .xpm.gz files.
Line 57: Line 61:
After creating a splash image, add a line like
{{{
splashimage=(hd0,4)/grub/splash.xpm.gz
}}}
to your menu.lst file. A useful trick is to make a symlink to the actual image named splash.xpm.gz.
{{{
cd /boot/grub
sudo ln -s my_image.xpm.gz splash.xpm.gz
}}}
Grub loads the image from the disk upon boot; it is not stored in the MBR. If you use a symlink, you will not have to edit menu.lst and reinstall grub to change the image, you just have to change the symlink.
  After creating a splash image, add a line like
  {{{
  
splashimage=(hd0,4)/grub/splash.xpm.gz
  }}}
  
to your menu.lst file. A useful trick is to make a symlink to the actual image named splash.xpm.gz.
  {{{
  
cd /boot/grub
  sudo ln -s my_image.xpm.gz splash.xpm.gz
  }}}
  
Grub loads the image from the disk upon boot; it is not stored in the MBR. If you use a symlink, you will not have to edit menu.lst and reinstall grub to change the image, you just have to change the symlink.
Line 68: Line 72:
Here is an image of the GNU by Peter Gerwinski: attachment:gnu-head.xpm.gz   Here is an image of the GNU by Peter Gerwinski: attachment:gnu-head.xpm.gz

=== Splash Image with update-grub ===
  The command '''update-grub''' will automatically pick up /boot/grub/splash.xpm.gz and configure the ''menu.lst'' file for you. It will take care of the correct hdX and partition number [no need to type in (hd0,4)].
  {{{
  sudo apt-get install grub-splashimages
  sudo ln -s /boot/grub/splashimages/my_image.xpm.gz /boot/grub/splash.xpm.gz
  sudo update-grub
  }}}
  '''Note:''' replace the my_image.xpm.gz with the one that you want.
Line 72: Line 85:
You can use grub to create a boot floppy. See ["/BootFloppy"]   You can use grub to create a boot floppy. See ["/BootFloppy"]
Line 76: Line 89:
By default, Grub in Ubuntu boots Ubuntu by default. If you wish to change this to another operating system, see ["/ChangeDefaultOS"]   By default, Grub in Ubuntu boots Ubuntu by default. If you wish to change this to another operating system, see ["/ChangeDefaultOS"]
Line 80: Line 93:
If you use LTSP or Edubuntu, you may want to boot from your network card.   If you use LTSP or Edubuntu, you may want to boot from your network card.
Line 82: Line 95:
Specific network cards need a specifc rom to boot from. To find which one you need, run {{{lsmod}}} and then search for your floppy. Then go to www.rom-o-matic.com and get the appropriate rom.   Specific network cards need a specifc rom to boot from. To find which one you need, run {{{lsmod}}} and then search for your floppy. Then go to www.rom-o-matic.com and get the appropriate rom.
Line 84: Line 97:
Edit `/boot/grub/menu.lst` and add the following before {{{### BEGIN AUTOMAGIC KERNELS LIST}}} or after {{{### END DEBIAN AUTOMAGIC KERNELS LIST}}}, otherwise your changes will be wiped out by security updates, etc.
{{{
title LTSP
root (hd0,2)
kernel /boot/(rom you get from rom-o-matic)
}}}
  Edit `/boot/grub/menu.lst` and add the following before {{{### BEGIN AUTOMAGIC KERNELS LIST}}} or after {{{### END DEBIAN AUTOMAGIC KERNELS LIST}}}, otherwise your changes will be wiped out by security updates, etc.
  {{{
  
title LTSP
  root (hd0,2)
  kernel /boot/(rom you get from rom-o-matic)
  }}}

Other Languages: ComoGrub (Spanish)

What Is GRUB

  • GRUB is a bootloader, it is the first thing that loads when the computer starts. It allows you to have different operating systems, and versions of them, on the same hard drive. For example you may have Windows and Linux on a computer, GRUB would load before either of these and give you a choice. You can also create a boot floppy with GRUB to use in case of emergency.

Increasing the GRUB timeout

  • If you need to get into the grub menu you need to press ESC just after it starts. By default you have to press ESC very quickly. To increase this time edit /boot/grub/menu.lst, increasing the seconds in the TIMEOUT part. Alternatively you could have the menu always come up at boot time. To do this, comment out 'hiddenmenu' by inserting a # at the beginning of the line. Once you have changed menu.lst you must run:
      sudo update-grub

attachment:IconsPage/IconNote.png

  • If the Ubuntu installer detected other operating systems on the disk during the installation, then the grub menu will be displayed by default and the timeout will be increased, so the step above will be unnecessary.

Setting kernel parameters

  • In /boot/grub/menu.lst, you will find a line like this:

      # kopt=root=/dev/sda1 ro

    It is a comment, but do not remove the '# ' at the beginning. Warning /!\ THIS IS IMPORTANT.

    If you require additional kernel parameters (for example, if someone has asked you to test booting with certain parameters in order to troubleshoot a problem), add them to the end of the line, for example to add noapic:

      # kopt=root=/dev/sda1 ro noapic
    After editing the file, run:
      sudo update-grub

If /boot is on another partition

  • If /boot is mounted on another partition and you use update-grub, then you may run into problems. One fix is to use grub-install, which is a distribution-agnostic way to install grub.

      sudo grub-install --root-directory=/boot /dev/sda

    This is probably less desirable because update-grub is very good at setting things up properly, therefore it should be used instead.

    Another fix is to create a symlink in /boot to itself:

      cd /boot
      sudo ln -s . boot

    The reasoning behind this is when grub boots, it looks at whatever partition it is installed on. update-grub (and grub-install) assumes that everything is in /boot. When /boot is on the same partition as /, then all is OK, as menu.lst will be in /boot/grub. If /boot is on a separate partition, then grub sees /boot as / (hence the '--root-directory' above). By adding a symlink, when it looks for /boot/grub, it will be there. By creating the symlink, you have put a loop in the file system, which may cause problems when using certain options of cp, mv, etc.

Bootsplash

  • Grub allows an image to be displayed behind the menu. You can obtain a set of images with the package "grub-splashimages", or you can make your own. The images must be 640x480 pixels, contain no more than 16 colors (but a smaller number like 12 works better to allow some different colors for the menu text), and be in gzipped xpm format. The GIMP can be used to resize (Image -> Scale Image...), reduce colors (Image -> Mode -> Indexed...), and can save to .xpm.gz files. After creating a splash image, add a line like

      splashimage=(hd0,4)/grub/splash.xpm.gz
    to your menu.lst file. A useful trick is to make a symlink to the actual image named splash.xpm.gz.
      cd /boot/grub
      sudo ln -s my_image.xpm.gz splash.xpm.gz 
    Grub loads the image from the disk upon boot; it is not stored in the MBR. If you use a symlink, you will not have to edit menu.lst and reinstall grub to change the image, you just have to change the symlink. Here is an image of the GNU by Peter Gerwinski: attachment:gnu-head.xpm.gz

Splash Image with update-grub

  • The command update-grub will automatically pick up /boot/grub/splash.xpm.gz and configure the menu.lst file for you. It will take care of the correct hdX and partition number [no need to type in (hd0,4)].

      sudo apt-get install grub-splashimages
      sudo ln -s /boot/grub/splashimages/my_image.xpm.gz /boot/grub/splash.xpm.gz
      sudo update-grub

    Note: replace the my_image.xpm.gz with the one that you want.

Creating a boot floppy

  • You can use grub to create a boot floppy. See ["/BootFloppy"]

Change the default operating system

  • By default, Grub in Ubuntu boots Ubuntu by default. If you wish to change this to another operating system, see ["/ChangeDefaultOS"]

Network booting

  • If you use LTSP or Edubuntu, you may want to boot from your network card.

    Specific network cards need a specifc rom to boot from. To find which one you need, run lsmod and then search for your floppy. Then go to www.rom-o-matic.com and get the appropriate rom.

    Edit /boot/grub/menu.lst and add the following before ### BEGIN AUTOMAGIC KERNELS LIST or after ### END DEBIAN AUTOMAGIC KERNELS LIST, otherwise your changes will be wiped out by security updates, etc.

      title LTSP
      root (hd0,2)
      kernel /boot/(rom you get from rom-o-matic)


CategoryDocumentation CategoryCleanup

GrubHowto (last edited 2008-08-06 16:19:46 by localhost)