Difference between revisions of "Grub"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
GRUB is the '''gr'''ant '''u'''nified '''b'''ootloader, in use by most Linux distributions, e.g. Ubuntu and SUSE. You may probably want to print this page because if the bootloader is broken, there is no chance to get into the system for repair instructions, you will need to have a printout.
 +
 +
= configure grub =
 +
To configure grub [[find out your distribution]] and proceed accordingly
 +
 +
== SUSE ==
 +
Configure the grub boot menu via /boot/grub/menu.lst or /boot/grub2/grub.cfg.
 +
 +
== Ubuntu ==
 +
First edit /etc/default/grub, then run sudo update-grub
 +
 +
= grub's command line =
 +
grub> kernel /boot/vmlinuz
 +
grub> initrd /boot/initrd
 +
grub> boot
 +
 +
= repair grub =
 +
Boot from Knoppix,
 +
$ mount /dev/hda3 /media/hda3
 +
$ mount --bind /dev /media/hda3/dev
 +
$ mount --bind /proc /media/hda3/proc
 +
$ chroot /media/hda3
 +
$ grub-install /dev/hda
 +
 
= reinstall grub =
 
= reinstall grub =
 
  grub-install --recheck --no-floppy --root-directory=/path/to/root /dev/hda
 
  grub-install --recheck --no-floppy --root-directory=/path/to/root /dev/hda
Line 5: Line 29:
 
  grub-reboot ''entry-number''
 
  grub-reboot ''entry-number''
  
= grub's command line =
+
= backup partition table =
  grub> kernel /boot/vmlinuz
+
To backup your partition table:
  grub> initrd /boot/initrd
+
  sfdisk -d /dev/hda > hda.pt
grub> boot
+
To restore it:
 +
  sfdisk /dev/hda < hda.pt
 +
 
 +
= See also =
 +
* [[booting from USB]]
 +
* https://help.ubuntu.com/community/Grub2

Latest revision as of 06:03, 15 January 2014

GRUB is the grant unified bootloader, in use by most Linux distributions, e.g. Ubuntu and SUSE. You may probably want to print this page because if the bootloader is broken, there is no chance to get into the system for repair instructions, you will need to have a printout.

configure grub

To configure grub find out your distribution and proceed accordingly

SUSE

Configure the grub boot menu via /boot/grub/menu.lst or /boot/grub2/grub.cfg.

Ubuntu

First edit /etc/default/grub, then run sudo update-grub

grub's command line

grub> kernel /boot/vmlinuz
grub> initrd /boot/initrd
grub> boot

repair grub

Boot from Knoppix,

$ mount /dev/hda3 /media/hda3
$ mount --bind /dev /media/hda3/dev
$ mount --bind /proc /media/hda3/proc
$ chroot /media/hda3
$ grub-install /dev/hda

reinstall grub

grub-install --recheck --no-floppy --root-directory=/path/to/root /dev/hda

determine entry to be booted next time

grub-reboot entry-number

backup partition table

To backup your partition table:

sfdisk -d /dev/hda > hda.pt

To restore it:

sfdisk /dev/hda < hda.pt

See also