Welcome to Inkbunny...
Allowed ratings
To view member-only content, create an account. ( Hide )
KichigaiKitsune

I'm putting this here for anyone who ever has the same problem...

Grrr-yaaaay! Grraaay! Yaaarrr! ... Wait.

OK, seriously, before I get into the good stuff, I'm going to put this here in the hopes of making things easier for people who have this issue in the future. It's a techy thing, and given that it took me so long to figure out this DISGUSTINGLY simple fix due to the horridness of support forums, I'm going to do the right thing and explain it here:

---------------------------------------------

HOW TO RESTORE DAMAGED BOOT-LOADER/BOOT-RECORD
PARTICULARLY FOR LINUX USERS/DUAL-BOOTERS  AND USERS OF GRUB2


If you have recently damaged, removed or lost a partition that contained your boot-loader/record (e.g., you wiped a partition containing an unused OS) and you're receiving an error message while booting, such as GRUB ERROR, GRUB RESCUE> or anything like this, you're probably going to be frustrated by the astoundingly confusing and useless information you'll receive on forums, whether by posting or by Googling your issue.

Note that it took me an hour to find HOW to do this, but a minute to rectify the problem. So there's hope, relax. Especially if you're a Linux user, but correcting the issue on Windows isn't difficult either.

GRUB (and other boot-loaders for multi-booting) replaces the default MBR on your machine, so by destroying it, your machine is clueless about how to boot any operating system you have on there. To fix this issue, you need a second computer that works and has an internet connection (bug a friend).
You also need a small capacity USB drive that you may end up losing or a CD, or floppy - whatever is available for your broken machine. In my case, my netbook does not have a CD reader, so I was forced to make a bootable USB. Don't worry, I'll cover this too.

NOTE: this guide assumes you can't just simply pull out your original OS's installation disk, boot from that, and select repair/reinstall (perhaps you weren't given one, lost it, or doing so would destroy your data). This is about recovering the boot record. If you can/are willing to just use, say, the Windows 7 repair disk or the equivalent, then do that.
Furthermore, you can always download the ISOs or whatnot and create other boot CDs, such as Ultimate Boot CD 4 Windows, or live-media Linux CD/USB/Floppy and do the final step from there.

In my case, I was not given a Windows 7 repair disk and my Linux Mint liveCD was not working (no clue why). So if those options are unavailable/unattractive, here's how to fix your boot record.


First, go to: http://www.supergrubdisk.org/super-grub2-disk/ and look around. Download the "Super Grub2" ISO by following the links. This is a very powerful version of GRUB2, which was probably what you used to boot Linux and/or multiboot other operating systems.

Burn this to a disk, or to a floppy.

If you need a bootable USB, and your second machine is using Windows, then go to: https://launchpad.net/win32-image-writer/+download - you will need this to make a bootable USB containing Super GRUB.
Annoyingly, you'll need to rename the ISO from ".ISO" to ".IMG". I hope you know how to get the GUI to display extensions or know how to find and rename things in the command prompt. This guide is already bloated.
Insert your sacrificial lamb drive, I mean, USB thumbdrive (choose a small, cheap one if you can, as you may lose it). Uncompress and open Win32DiskImager.exe. Select the ".img" file and point the program to your USB. Confirm, and wait while it turns your USB drive into an imitation CD.

If you need a bootable USB, and your second machine is running a Linux distro, it can be more complex.
That said, I initially neglected this for several reasons, but someone pointed out that it's not complex at all if you simply use Unetbootin or an image burner software like Ubuntu Image Writer. Google or use these if you can. Thanks again, [icon]BearPatrol[/icon]! :3

But if those aren't options, you want to use the terminal, or are a sadist:
Thanks to the Linux Mint community, though I might not have this right (I used a Windows machine). Either way, you're going to be doing something like this:
Place the ISO on the machine's desktop. Use the terminal to place the Super GRUB ISO on an USB by typing.
$ sudo dd if=~/desktop/name of the iso of=path to the destination USB oflag=direct bs=1048576
example: $ sudo dd if=~/desktop/super_grub2_hybrid_2.00s1-beta1.img of=/dev/sdb oflag=direct bs=1048576
"if" is your input file. "of" is your output. Don't point to your USB's mount point, point to the USB device itself (so /dev/sdb instead of /media/USB Disk)
Also, if you can't get it to cooperate using "sudo" then switch to the super-user account (su -) and modify the command line above to point to the ISO (so /home/user/desktop/ISO filename) instead of the relative ~.

Return to your buggered up computer without its bootloader. I hope you can access your BIOS, because you need to do this now, and reorder the boot priority so the system will try to boot from the media you burned the ISO to.
Most new machines think users are morons and are set to boot from the hard-drive first so it's likely you'll need to fix this. Usually you need to press TAB, F2, F7 or some other button in the first few seconds after startup - keep a look out for this if you don't know already, or mash random F# keys, or read the manual/ask the manufacturer if you can't see anything at all. Whatever, just get to your BIOS config screen, go to the boot-order and set what you need to be first.

Here's the easy part. Stick the media into the computer, turn it on, and hopefully it'll boot from it - leading you to the Super GRUB2 screen. Either look for operating systems or pre-existing GRUB1/2 configurations, and you should be able to boot to your operating systems from there - Super GRUB is your bootloader.

However it doesn't fix everything. Once you're logged into your OS, get admin/root privileges (and an internet connection too if you can) and prepare to fix this bullshit.

FINAL STEP
Linux: open the terminal, become root or use sudo if you can/need to.
$ grub-install /dev/sda (or whatever the path to your HDD is)
This should sort the entire affair out.

Windows: we're going to restore the Windows MBR.
Open command prompt.
>bootrec /fixmbr
>bootrec /fixboot

Hopefully this fixes it.

If it doesn't, but Super Grub 2 worked for you, and no other options work/seem attractive, consider just using your Super Grub boot-media as, say, a key to your machine! :D
At least until you can repair the problem fully.

Bear in mind I am NOT an expert or even really knowledgeable about Linux, or even Windows really, in this regard. This is just based on the things that worked for me, some of it gleaned from useful forum responses/websites, some of it worked out with the thing that passes for my brain (I can be pretty resourceful, sometimes! :D).

If my advice doesn't work, maybe some of the advice that didn't work for me will work for you. Google-Fu shall save you if this poorly written guide cannot, I'm sure. I have faith in the arcane power of search-engines.

---------------------------------------------


Why did I do this? Because I had to piece together bits and pieces from many different sources, discarding the chaff. I had problems (forum replies telling me to use commands that don't work in GRUB RESCUE/GRUB2, general lack of documentation/explanation, etc) discovering this piss-simple resolution: stick Super Grub2 on a boot-media, boot from that, type some commands. That's easy stuff, and as far as I'm concerned, every responder to every forum post I saw about this matter that did NOT mention Super Grub, passed on outdated information, or was shut down by an admin saying "make a new topic" then not presenting a link to the new topic... ugh, seriously, those people should have just shut their mouths.

It's the same problem I  have with the Steam support forums, or Indian callcenter dipshits (no, HP, I'm never calling your support center again, I'll just put up with the dodgy re-image, broken keys and fucked battery, thanks guys). Damn, I really don't want to get into this right now...

But to those people who DID put useful, current information on the net for dumbasses like me who somehow manage to erase the boot-loader when they try to tidy up a partition table, thank you very much. You guys rule. I am LOVING Linux for some reason right now.

PS: Don't judge me. I accidentally installed LinuxMint to my netbook twice. I didn't check where I'd put the boot-loader, so when I wiped out the first installation's partition, wanting to tidy it up... don't judge me!! :C
I also have some cool news, but I won't put it in this journal, which I hope will be available to people who Google this issue in the future.
Viewed: 58 times
Added: 6 years, 2 months ago
 
Alfador
6 years, 2 months ago
> Also, if you can't get it to cooperate using "sudo" then switch to the super-user account (su -) and modify the command line above to point to the ISO (so /home/user/desktop/ISO filename) instead of the relative ~.

From what I understand, sudo is supposed to run the command as if root were logged in, so it MIGHT point ~ to root's home, or it might point it to the current user's home, I'm not quite sure and it might vary from distro to distro (I use Ubuntu at work and I'd have to open it up and try something like ls ~ to be sure; I am by no means a Linux expert despite being the guy who wrote a beginner's guide for it for our workplace!! That's kinda part of what I was hired in the first place for: to learn things through research and then write guides so less research-capable coworkers could learn to use whatever-it-was too.)
KichigaiKitsune
6 years, 2 months ago
As far as I can tell, relative paths like that aren't affected when you sudo a command. Honestly, sudo has not been present/set up in several distros I've used (seriously), so I would personally just switch to root and work from there. I haven't personally got any experience with the behavior of the "sudo" command, but I modified that command line from something a genuine expert posted on the Mint community site, so I presume that it works as intended there.

Again, like I said, "sudo" doesn't actually work for me right now - on Mint. So, bah, whatever! >:3
KichigaiKitsune
6 years, 2 months ago
There we go. Got "sudo" working fine, and tested it using user-relative filepaths. It works as normal.

I really do recommend getting a Linux to play with at home. If nothing else, I'm enjoying the learning process, so you might too! :3

If you don't have any machines to play with, consider virtualizing one. You could also dual-boot it with Windows, but, eh, just make sure you don't make the same mistake I did that made me write this. Ugh.
Alfador
6 years, 2 months ago
I've been playing with it at work whenever I get a chance, as I'm kinda supposed to. :3 And I forgot to check, but I remembered something more that might explain the behavior: the ~ substitution I think happens at command-line time via the shell, so it would come before the sudo command switches users.
trashbunny
6 years, 2 months ago
The fact that your home path is being displayed as ~ is really more of a convenience offered by the shell of your choice.  Internally, it most likely uses an absolute path, so when you become root, your current working directory won't change.
Alfador
6 years, 2 months ago
Yup; as I noted above, if my memory of browsed-through man pages is correct, the ~ substitution is done by the shell before the command is executed, so sudo would see the absolute path before switching users.
starling
6 years, 2 months ago
I just keep an Ubuntu live CD around to rescue broken systems. Load the CD, tell it to execute a shell and then grub-install or any other rescue commands. :o
trashbunny
6 years, 2 months ago
It's neat to have something like that around. If things really went awry, live CDs still allow you to back up data really easily.
KichigaiKitsune
6 years, 2 months ago
I was a little miffed. For some reason, liveUSBs weren't working, so I had to go the Super Grub route. Worked out just great, though. Will be useful to have it lying around, in conjunction with all the live-media I have (or can make!).

Though definitely, from now on I'm keeping a Linux live CD around just in case. I never really thought about that avenue for data recovery before! :3
New Comment:
Move reply box to top
Log in or create an account to comment.