Did you SCREW your Grub? Now stuck in Grub Rescue?
I recently totally jacked up my boot loader while doing some formatting on some other drives. I don't know how, but it took me FOREVER to find a solution that worked.
If you are using Ubuntu 9.1 and or 9.04 and need to update or restore GRUB, follow these directions. It worked for me and everything is back to normal.
https://help.ubuntu.com/community/Grub2#Resolving an "Unrecognized Device String" (Error 11)
You will want to use the LIVE CD portion of instructions. It is easy and it works.
BIG NOTE: The instructions have 2 variables listed; X and Y. The reference your hard drive such as sda1 or sdb1, etc.. X being a and Y being 1. They do not reference what you see in grub rescue. (hd0, hd0,1, etc...)
SIMPLEST - Copy GRUB 2 Files from the LiveCD
This is a quick and simple method of restoring a broken system's GRUB 2 files. The terminal is used for entering commands and the user must know the device name/partition of the installed system (sda1, sdb5, etc). The problem partition is located and mounted from the LiveCD. The files are then copied from the LiveCD libraries to the proper locations and MBR. It requires the least steps and fewer command line entries than the following methods.
1. Boot to the LiveCD Desktop (Ubuntu 9.10 or later).
2.
Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.
3.
Determine the partition with the Ubuntu installation. The fdisk option "-l" is a lowercase "L".
1.
sudo fdisk -l
If the user isn't sure of the partition, look for one of the appropriate size or formatting.
Running sudo blkid may provide more information to help locate the proper partition, especially if the partitions are labeled. The device/drive is designated by sdX, with X being the device designation. sda is the first device, sdb is the second, etc. For most users the MBR will be installed to sda, the first drive on their system. The partition is designated by the Y. The first partition is 1, the second is 2. Note the devices and partitions are counted differently.
4. Mount the partition containing the Ubuntu installation.
sudo mount /dev/sdXY /mnt
Example: sudo mount /dev/sda1 Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot
5.
Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.
sudo grub-install --root-directory=/mnt/ /dev/sdX
Example: sudo grub-install --root-directory=/mnt/ /dev/sda
6. Reboot
7.
Refresh the GRUB 2 menu with sudo update-grub
Comments
-
In my experiences the only one that worked every time for Grub2 was option 3, for chrooting into your existing system to re-post the grub2 image to your mbr.
As a note, the directions work for Grub2 was was included in ubuntu 9.10 and not previous releases, for previous releases that are using Grub, not grub2, refer to https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows0 -
I think my Grub was not Grub2. I did a upgrade from 9.04 to 9.1. Thanks for the follow up.
-Josh0 -
Actually, the Live CD I used was 9.04.0
-
What was driving me crazy about upgrading via the update manager from 9.04 to 9.10 was that it was trying to force grub2 to install, because I have so many systems on my dual boot I am using a custom grub conf from Slackware and I did not want Ubuntu to overwrite it with the auto-detected options.0
-
One thing I am beginning to really start to notice is, Ubuntu kind of assumes you want things a certain way. As I get deeper into linux, I'm sure I will try some more advanced distros.0
-
I really like that you have said that because it is showing that you are learning to look deeper into the system and ask how things work.
I have been using Slackware since 2002 because of the lack of assumptions, there are too many distros that I am seeing that are making the assumptions which are adding too many additional points of potential failure and complexity. I give these distros credit for their goals and accomplishments, but I hope that they quickly learn their lessons before they compromise the integrity of their systems and loose the functionality that Linux based distros have always had.
As for the current state of Ubuntu, I think they rushed too much in trying to incorporate new features like adding pulse audio, removing hal and updating their package manager without fully testing them which is why in my opinion ubuntu 9.10 is the only bad release of ubuntu.0 -
Actually you can do something much more simple especially recommended for users who have dual-booted their PCs and use their windows(or other OS) much more than they use their Linux or other Linux distribution. While i was trying with the live CD all these instructions on fixing Grub, which took me nearly hours until i reach this helpful page and after desperately managed to fix it,(i am no computer expert, i just love open-source software like Linux) i thought a much more simpler solution... Why i just can install the Linux OS from the live CD and then log on my windows AND IT WORKED!
But Read this, it is very important!
-If you do this u will no longer be able to use your Linux OS.
-You have to have installed your Operating Systems on different partitions of your hard drive.
-After I did it all the files i had on the Linux OS where gone, so i deleted the whole partition.(One good solution of not losing your important files is to backup them in a USB while u are installing your Linux OS again.(Don't worry, usually when you log with your live CD you will be able to see,use and backup all the files you want from your hard drive)
This solution takes approximately 10 minutes and it is so easy that even someone who hasn't even heard of Linux can do it
You don't have to use a live CD! I didn't have a CD to use so a used a program named Unetbootin which writes ISO files on USBs! (So I wrote my Linux Distribution ISO file on my USB )
Fixing Grub included finding a way to fix it took me nearly 14 hours and it requires basic programming skills! But this solution takes 10 minutes and can be done even from a 5 year old kid...You choose which is best for you
(But still thanks to the creator of this post, really inspired me of thinking this solution0 -
This is exactly my problem. I did an unattended install using WUBI on a modern machine that has two drives, one Vista, and one Win7. There was room on the Win7 drive to shorten the partition and create an empty new partition using standard Microsoft Console Tools. I created a new NTSC partition for Ubuntu desktop and launched the installer.
It was late, and I went to bed, and the installer did its thing. In the morning Ubuntu ran perfectly!
Then a pop up appeared advising of over 200 updates. I clicked, and off it went. It stopped for input once, on the grub screen. The window had three partitions listed. The pop up text had three paragraphs appeared to say in the first paragraph to "select all of them" and in the last paragraph not to. I went with the first paragraph and clicked them all. Now Ubuntu does not work. Nothing does. In the middle of my computer's start sequence, while "Verifying DMI Pool data" an error pops up " Error: No such device.." followed by some hex code. On the next line is the grub rescue> prompt. But it does not recognize any command I give it, even the ones from various grub 2 docs.
I was delighted to see how easy the install went, but sad to see how easy it broke. Most of the instructions for making this better involve burning an ISO image of a Live CD and accessing that portion of the bootloader. But this machine has no optical drives. I do have a Terabyte USB drive, but none of the instructions cover that.
So I feel that victory was in my grasp, and after i did an upgrade, it went south. Any way to unravel that upgrade? If this were Windows, I could just go to a restore point. But of course, I can't even boot the machine now.
Help?0 -
Update--
Based on one of the other comments in this thread (Kode followed by Google), I looked at WUBI again, and the Wikipedia articles say it is pretty heavily integrated with Windows, and my not have used my new partition at all, but rather written the install to a file within Windows 7. I told the WUBI installer to put it there, but I did not verify it. If I read correctly, this may make it impossible to remove the Ubuntu with either a LiveCD or with Unetbootin. And of course, my machine won't start.
Help?0 -
Yet Another Update
1) The DMI sequence stops at ACPI controller. Some literature (Tom's hardware ACPI section) suggests that certain boot loaders overwrite a part of the MBR that is really critical to getting the machine running. May have to look at using a superboot disk to get the machine running so I can undo what the Grub update did.
2) The Grub Rescue prompt does in fact respond to valid commands. I will head back in with a list of commands on the chance that there is a fix. Any advice?0 -
If you are getting the grub prompt on startup that means that the wubi installation was not processed, it instead attempted a physical installation to the partition you created. I don't know what an NTSC partition is, so instead I will assume that you meant that you setup an NTFS partition that it then installed ubuntu into. If in fact it attempted to install ubuntu in an ntfs partition then that could be your problem since the bootloader is made to read unix type filesystems to get the configuration file.
To correct your problems you can use the windows recovery tool from boot to get into the recovery terminal and run fixmbr which will reinstall the windows bootloader, once in windows you can attempt a wubi installation inside your primary hard drive. If that is successful then ubuntu will use the windows bootloader to choose the operating system and grub will be chainloaded from within the filesystem file.0 -
Marco Braida answers a lot of questions on this matter at launchpad.net. --Question 120822. He seems to suggest the issue is related to Wubi, and urges installing on an actual partition. I am not sure where the problem lays, but somewhere in the combination of easy-to-use tools, I ran into some big trouble. If I was a Windows user "giving Linux a go", this would have been a poor beginning. :unsure:
Thanks to all who helped.
PS: NTSC is a television broadcast standard. I spent many years as a broadcast engineer. NTFS is a file system, and that is what I meant to have typed. And the Wubi install was pointed into a partition I created using the Windows Disk Manager MFC in empty space on the drive.
----snip---
This is an excellent summary. I ran into just this issue, and on researching it here and elsewhere I found the things you say about Wubi to be the case. The Wubi install is very easy. It is silent. For the most part everything autocompletes. But yes, it, or something it contributes to, can cause a problem with booting the computer, in my case, after Ubuntu offered auto updates. This was un-recoverable, so I eventually just did an install from the iso image, as you suggest above, and told it to delete and use the entire disk.
My problems focused around booting. After powerup, when the computer was running through its list of PCI connections, this process terminated early, and it changed to "Boot From CD ROM:" If the CD was in the drive, it rolled the CD. If not, it returned a "No Device Found error, and terminated the boot. The last thing in the PCI device report was ACPI, and this line was not displayed completely. Many sources recommend adding "noapci" in the bootloader file. This may help, but as my computer would not boot, I found it hard to edit that line. Some skill with using a live CD to edit files in the install will be valuable, and I intend to learn them. On the other hand, Wubi may have modified the MBR of my Win7 install, and in that case some of my helpers have suggested that the answer is to run FIXMBR using the Windows rescue disk.
There seem to be a number of people who fall into this problem, and the traffic I have found focuses on ACPI, Wubi, Ubuntu 10.4, and, again, the upgrades that are offered after you are running, which was the beginning of my problem. If Cannonical intends 10.4 to exploit the gap caused by the release of Windows Vista, then it must not be this easy to blow up a working machine.
Thank you, All.0
Categories
- All Categories
- 167 LFX Mentorship
- 219 LFX Mentorship: Linux Kernel
- 801 Linux Foundation IT Professional Programs
- 357 Cloud Engineer IT Professional Program
- 181 Advanced Cloud Engineer IT Professional Program
- 83 DevOps Engineer IT Professional Program
- 149 Cloud Native Developer IT Professional Program
- 112 Express Training Courses
- 138 Express Courses - Discussion Forum
- 6.2K Training Courses
- 48 LFC110 Class Forum - Discontinued
- 17 LFC131 Class Forum
- 35 LFD102 Class Forum
- 227 LFD103 Class Forum
- 19 LFD110 Class Forum
- 39 LFD121 Class Forum
- 15 LFD133 Class Forum
- 7 LFD134 Class Forum
- 17 LFD137 Class Forum
- 63 LFD201 Class Forum
- 3 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 1 LFD233 Class Forum
- 2 LFD237 Class Forum
- 23 LFD254 Class Forum
- 697 LFD259 Class Forum
- 109 LFD272 Class Forum
- 3 LFD272-JP クラス フォーラム
- 10 LFD273 Class Forum
- 154 LFS101 Class Forum
- 1 LFS111 Class Forum
- 1 LFS112 Class Forum
- 1 LFS116 Class Forum
- 1 LFS118 Class Forum
- LFS120 Class Forum
- 7 LFS142 Class Forum
- 7 LFS144 Class Forum
- 3 LFS145 Class Forum
- 1 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 1 LFS157 Class Forum
- 34 LFS158 Class Forum
- 8 LFS162 Class Forum
- 1 LFS166 Class Forum
- 1 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 1 LFS178 Class Forum
- 1 LFS180 Class Forum
- 1 LFS182 Class Forum
- 1 LFS183 Class Forum
- 29 LFS200 Class Forum
- 736 LFS201 Class Forum - Discontinued
- 2 LFS201-JP クラス フォーラム
- 14 LFS203 Class Forum
- 102 LFS207 Class Forum
- 1 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 301 LFS211 Class Forum
- 55 LFS216 Class Forum
- 48 LFS241 Class Forum
- 48 LFS242 Class Forum
- 37 LFS243 Class Forum
- 15 LFS244 Class Forum
- LFS245 Class Forum
- LFS246 Class Forum
- 50 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 155 LFS253 Class Forum
- LFS254 Class Forum
- LFS255 Class Forum
- 5 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.3K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 121 LFS260 Class Forum
- 159 LFS261 Class Forum
- 41 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 20 LFS267 Class Forum
- 25 LFS268 Class Forum
- 31 LFS269 Class Forum
- 1 LFS270 Class Forum
- 199 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- 3 LFS281 Class Forum
- 10 LFW111 Class Forum
- 261 LFW211 Class Forum
- 182 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 782 Hardware
- 198 Drivers
- 68 I/O Devices
- 37 Monitors
- 96 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 83 Storage
- 758 Linux Distributions
- 80 Debian
- 67 Fedora
- 15 Linux Mint
- 13 Mageia
- 23 openSUSE
- 143 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 348 Ubuntu
- 461 Linux System Administration
- 39 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 90 Linux Security
- 77 Network Management
- 101 System Management
- 46 Web Management
- 64 Mobile Computing
- 17 Android
- 34 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 19 Study Material
- 806 Programming and Development
- 304 Kernel Development
- 204 Software Development
- 1.8K Software
- 211 Applications
- 180 Command Line
- 3 Compiling/Installing
- 405 Games
- 309 Installation
- 97 All In Program
- 97 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)