Sei sulla pagina 1di 14

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: sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install -y boot-repair boot-repair

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.

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: sudo fdisk -l sudo blkid 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.

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: sudo mount /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/sda1above, use /dev/sda here. sudo grub-install boot-directory=/mnt/boot /dev/sdX

Restart your computer and Ubuntu should boot properly.

Reinstall / Recover GRUB from Ubuntu live CD / USB Posted by Manivannan on May 3, 2012 in Linux | 27 comments

40

EmailShare Updated on May 3, 2012. This is the common problem which is faced, when you try for dual boot. Recently I have posted the article on How to Recover / Re-Install Grub in Ubuntu using BootRepair from live cd / usb. Boot Repair is the simple graphical tool used to repair, restore or reinstall the grub bootloader on Ubuntu. Now this tools has been updated with some new features in advanced option, using boot- repair you can also restore the MBR on Windows.

On dual boot once you update your Ubuntu OS, your Windows / Fedora will not be listed on your grub. After installing Windows / Fedora your Ubuntu will not boot anymore and its grub may be wiped out. To restore it follow the steps below To Reinstall Grub You need to have Ubuntu Live CD or Live USB. Normal session can be used to repair the grub. Boot using your Ubuntu Live CD or Live USB, while booting choose Try Ubuntu.

Once booted then open a terminal, and run the following command one by one toinstall the boot repair. To add boot-repair to the repository $ sudo add-apt-repository ppa:yannubuntu/boot-repair To Update your repository $ sudo apt-get update To install boot-repair $ sudo apt-get install -y boot-repair Once Installation complete run boot-repair on terminal by typing the following command or select it by System->Aministration->Boot Repair. $ boot-repair NOTE: Update the Boot Repair if its newer version is available. It will scan the System for few seconds and will show you the options Recommended repair and Create a BootInfo summary. By clicking the Recommended Repair it will start repair the grub. Check the screen shots below.

Once done click ok and restart your system, your grub should work now. If not run the boot-repair again using live cd / usb. Then follow the steps below. Select the Advanced options, In Main options tab check whether the following options are selected or not. If not select it, the options are Reinstall Grub and unhide boot menu for 10 seconds. Check the screen shot below

Then select the GRUB locations tab and check the following options are selected or not. The options are OS to boot by default and place grub into, In OS to boot by default option choose the OS which you want to be default on boot. Then select the drive where you need to reinstall the grub in place grub into option and click apply. Check the screen shots below

Click ok and restart your System. To restore MBR Click Here. Hope this will be helpful for you!!!

Restore MBR from Ubuntu live CD / USB Posted by Manivannan on Aug 17, 2011 in Linux | 8 comments

EmailShare On dual boot Ubuntu and Windows, If you like to uninstall / remove Ubuntu from your machine and like to have windows alone. Then you need to restore your original MBR and it can be done easily with Boot Repair using Ubuntu Live CD / USB. To install the Boot Repair You need to have Ubuntu Live CD or Live USB. Boot using your Ubuntu Live CD or Live USB, while booting choose Try Ubuntu. Once booted then open a terminal, and run the following command one by one toinstall the boot repair. To add boot-repair to the repository $ sudo add-apt-repository ppa:yannubuntu/boot-repair To Update your repository $ sudo apt-get update To install boot-repair $ sudo apt-get install -y boot-repair Once installation complete follow the steps below.

To Restore MBR Run boot-repair on terminal by typing the following command or select it by System->Aministration->Boot Repair. $ boot-repair

It will scan the System for few seconds and will pop-up a small window. Select Advanced options and in Main options tab select Restore MBR. Check the screen shot below.

Then select the MBR options tab, check the drive for MBR and Windows OS. By default all the options are selected correctly if not select the drive where your MBR is to be and the correct OS. Click apply now, check the screen shots below.

Once done click ok and restart your system and it should work. Then after logging in into your windows, go to Disk Management in Computer Management then select the Storage. Now you will see the list of all available partitions, there

you select the linux partitions and delete it. Make a new partition from the deleted one and format it with ntfs. Thats it your done. Hope this will be helpful for you!!! Thay i v tr boot mc nh trong GRUB 2 Posted 02/05/2012 by tnlug in Ubuntu + Debian. li phn hi

1 Vote GRUB 2 ra i vi hng lot thay i so vi GRUB legacy (phin bn Grub trc). D mun hay khng, bn buc phi lm quen vi GRUB 2 v n c tch hp vo Ubuntu 9.10. Bi vit ny ch cp n mt vn rt nh nhng hay thng gp trong vic cu hnh GRUB ni chung v GRUB 2 ni ring, l chnh sa v tr boot mc nh. t vn : Ti c ci sn mt h iu hnh (v d windows), khi ci thm Ubuntu 9.10 vo th chng trnh GRUB 2 lun mc nh tr n dng Ubuntu 9.10. By gi ti mun n mc nh tr n h iu hnh quen thuc ca ti (windows) khi khi ng th phi lm th no? Nu GRUB legacy th bn s ngh ngay n tp tin menu.lst trong /boot/grub/, nhng qua n GRUB 2 th khi nim ny khng cn na. C ngi bo rng menu.lst nm xa gi l grub.cfg nn ch vic chnh sa grub.cfg l xong thi. iu cng ng nhng cng c phn sai! ng l bn c th tm thy trong nhng thng tin ging ging vi GRUB c, cn sai l v tp tin sinh ra khng chnh sa. Bi v n l mt tp tin do my tnh to ra n c th b thay i ch vi mt cu lnh. Do ng c c chnh sa tp tin grub.cfg nh!

Vy th ta s chnh sa u? Hi lng nhng mt cht, nhng cng khng qu phc tp u! Ta s tm n tp tin tn l grub trong /etc/default/ . y mi chnh l tp tin ta cn thay i (d nhin l vi quyn root ri nh! ) # If you change this file, run update-grub afterwards to update # /boot/grub/grub.cfg. GRUB_DEFAULT=0 #GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT=quiet splash GRUB_CMDLINE_LINUX=" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo #GRUB_GFXMODE=640480

# Uncomment if you dont want GRUB to pass root=UUID=xxx parameter to Linux #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entrys #GRUB_DISABLE_LINUX_RECOVERY=true Nhng dng u tin chc s quen thuc nu bn c vc vi GRUB mt hai ln. Hy ch n dng u tin: GRUB_DEFAULT=0 y l th cn chnh nu mun thay i v tr boot mc nh trong menu GRUB 2. Hy thay 0 bng cc con s tng trng cho v tr ca cc mc trong menu (0 l mc u tin) hay bng t saved nt mi trong GRUB 2. Khi GRUB_DEFAULT=saved th GRUB s nh v tr ca mc c boot ln khi ng trc, ln khi ng sau s tr n ng v tr . Cn nu thay bng con s th ta phi bn tm n mc la chn m ta mun chn lm mc nh nm v tr th my trong mc in vo cho thch hp. Trong trng hp thay bng s th sau y l cch bit v tr ca mc cn chn. Thng thng, cc h iu hnh khc c ci sn s c Ubuntu nhn din v di cng ca bng la chn. Vi phin bn 9.10, Ubuntu cho ta ti 4 mc la chn, vy cc h iu hnh khc s nm t v tr th 5 tr i, v v v tr u tin bt u t s 0, cho nn v tr th nm phi l s 4. bit c bao nhiu mc trong menu th chy lnh sau: grep menuentry /boot/grub/grub.cfg Sau khi xem xt k lng ta thay 0 bng 4: GRUB_DEFAULT=4 Lu li tp tin v ng c restart vi, vn cn mt bc cui cng na: Chy lnh ny trong terminal: sudo update-grub Lnh ny s cp nht thng tin t cc tp tin ring l trong /etc/grub.d v tp tin va mi chnh /etc/default/grub vo trong tp tin /boot/grub/grub.cfg. Do , khng c thay i tp tin grub.cfg mt cch th cng cng l v l ny. Vy l xong ri . Rm r phc tp qu phi khng? Ci g mi cng cn c thi gian lm quen tm hiu, ri u s vo thi. B sung: ngoi vic thay bng cc con s th t v t saved ra ta cn c th dng chnh xc tn ca mc la chn. u im l khng cn phi quan tm n v tr ca mc trong bng la chn na. Cch thay nh sau: GRUB_DEFAULT=xxxx Vi xxxx l tn chnh xc ca mc, nh phi kp gia 2 du ngoc kp. bit tn mc ta cng chy lnh: grep menuentry /boot/grub/grub.cfg