Вы находитесь на странице: 1из 4

11/27/2015

HowtoRepairGRUB2WhenUbuntuWontBoot

How to Repair GRUB2 When Ubuntu Wont Boot

Ubuntu and many other Linux distributions use the GRUB2 boot loader. If GRUB2 breaks for example, if you install
Windows after installing Ubuntu or overwrite your MBR you wont be able to boot into Ubuntu.
You can easily restore GRUB2 from a Ubuntu live CD or USB drive. This process is different from restoring the legacy GRUB
boot loader on older Linux distributions.

Graphical Method Boot Repair


Boot Repair is a graphical tool that can repair GRUB2 with a single click. This is the ideal solution to boot problems for most
users.
If you have the media you installed Ubuntu from, insert it into your computer and restart. If you dont, download a Ubuntu
live CD and burn it to a disc or install it on a USB flash drive. You can also download a dedicated Boot Repair live CD.
After booting into the live Ubuntu environment, open a terminal from the Dash and run the following commands to install
Boot Repair:
sudoaddaptrepositoryppa:yannubuntu/bootrepair
sudoaptgetupdate
sudoaptgetinstallybootrepair
bootrepair

The Boot Repair window will appear after you run the boot-repair command. After it scans your system, click the
Recommended repair button to repair GRUB2 with a single click.

http://www.howtogeek.com/114884/howtorepairgrub2whenubuntuwontboot/

1/4

11/27/2015

HowtoRepairGRUB2WhenUbuntuWontBoot

You can also click the Advanced options header to customize GRUB2s options without learning its command-line syntax.

Restart your computer after using the Boot Repair tool. Ubuntu should boot up normally.

Terminal Method
If youd rather get your hands dirty, you can do this yourself from a terminal. Youll need to boot from a live CD or USB
drive, as in the graphical method above. Ensure the version of Ubuntu on the CD is the same as the version of Ubuntu
installed on your computer for example, if you have Ubuntu 12.04 installed, ensure you use a Ubuntu 12.04 live CD.
Open a terminal after booting into the live environment. Identify the partition Ubuntu is installed on using one of the
following commands:
sudofdiskl
sudoblkid

Heres the output of both commands. In the fdisk -l command, the Ubuntu partition is identified by the word Linux in the
System column. In the blkid command, the partition is identified by its ext4 file system.

http://www.howtogeek.com/114884/howtorepairgrub2whenubuntuwontboot/

2/4

11/27/2015

HowtoRepairGRUB2WhenUbuntuWontBoot

Run the following command to mount the Ubuntu partition at /mnt, replacing /dev/sdX# with the device name of your
Ubuntu partition from the above commands:
sudomount/dev/sdX#/mnt

For example, use /dev/sda1 for the first partition of the first hard disk device.

Important: If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/boot. If
you dont know whether you have a separate boot partition, you probably dont.
Run the following command to reinstall grub from the live CD, replacing /dev/sdX with the device name of the hard disk
above. Omit the number. For example, if you used /dev/sda1 above, use /dev/sda here.
sudogrubinstallbootdirectory=/mnt/boot/dev/sdX

http://www.howtogeek.com/114884/howtorepairgrub2whenubuntuwontboot/

3/4

11/27/2015

HowtoRepairGRUB2WhenUbuntuWontBoot

Restart your computer and Ubuntu should boot properly.

For more detailed technical information, including how to use the chroot command to gain access to a broken Ubuntu
systems files and restore GRUB2, consult the Ubuntu wiki.

JOIN THE DISCUSSION

Chris Hoffman is a technology writer and all-around computer geek. He's as at


home using the Linux terminal as he is digging into the Windows registry.
Connect with him on Google+.

Published 05/26/12

SHOW ARCHIVED READER COMMENTS (9)

http://www.howtogeek.com/114884/howtorepairgrub2whenubuntuwontboot/

4/4

Вам также может понравиться