Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Unsaturated
Level 1
Level 1
Posts: 33
Joined: Wed May 31, 2017 7:59 pm

Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by Unsaturated » Wed May 31, 2017 8:05 pm

I have 3 hard drives with a total of 6 partitions. The last O/S I installed (last year) was Linux Mint, and it installed the Grub boot loader and I was able dual-boot / choose between Win7 and LM. Today I made a small 60 Gbyte partition on my Win7 System Drive ("C:") and installed Win8 as an experiment via USB. Now the boot loader looks like Win8 (not Grub, not Win7 either) and it only gives me the choice of Win7 or Win8. Meaning Linux Mint is lost completely. (It's on another physical hard drive, different from HD that has both Win7 and Win8 on it.)

TBH I never liked the Grub boot loader. I've used Easy BCD and prefer it, but that's secondary. What I mostly want to to regain access to the Linux Mint O/S. How that happens is secondary, but I'd prefer a configurable Window (vs. command line options and editing, etc...)

What are my options?

all41
Level 15
Level 15
Posts: 5709
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by all41 » Wed May 31, 2017 10:13 pm

and installed Win8 as an experiment via USB
Yes Win will overwrite your boot partition
Meaning Linux Mint is lost completely. (It's on another physical hard drive, different
It seems like all you need to do is go into bios and select the hd containing Mint as the first device in the boot order.
When you are booted to Mint open a terminal and enter:

Code: Select all

sudo os-prober
Assuming that shows your installed operating systems all you will need to do is update grub.

Code: Select all

sudo update-grub
fwiw--If Mint is installed on it's own hd, and win on another, you do not need grub.
You can use bios to select the bootable drive--especially if you mainly boot to Mint

User avatar
Pierre
Level 19
Level 19
Posts: 9256
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by Pierre » Wed May 31, 2017 10:55 pm

and if that doesn't work, then just install Easy BCD into the win-8x,
- since that is now controlling the Boot Loader.
:(
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

Unsaturated
Level 1
Level 1
Posts: 33
Joined: Wed May 31, 2017 7:59 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by Unsaturated » Wed May 31, 2017 11:42 pm

all41 wrote:
and installed Win8 as an experiment via USB
Yes Win will overwrite your boot partition
Meaning Linux Mint is lost completely. (It's on another physical hard drive, different
It seems like all you need to do is go into bios and select the hd containing Mint as the first device in the boot order.
When you are booted to Mint open a terminal and enter:

Code: Select all

sudo os-prober
Assuming that shows your installed operating systems all you will need to do is update grub.

Code: Select all

sudo update-grub
fwiw--If Mint is installed on it's own hd, and win on another, you do not need grub.
You can use bios to select the bootable drive--especially if you mainly boot to Mint
Mint is on the 2nd partition of the 2nd hard drive and if I tried to boot to that hard drive, I'm pretty sure an unused, now gutted version of Win7 would try to boot and fail. I can try and see, but I don't think that drive will boot. Grub was written to my 1st hard drive, which has a 2nd partition with Win8 controlling the boot manager.

FYI I "sort of" understand this stuff, but I'm real weak on it so please be patient.

Unsaturated
Level 1
Level 1
Posts: 33
Joined: Wed May 31, 2017 7:59 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by Unsaturated » Wed May 31, 2017 11:45 pm

Pierre wrote:and if that doesn't work, then just install Easy BCD into the win-8x,
- since that is now controlling the Boot Loader.
I'd really prefer to use something Linux, but I don't understand why after all these years Grub is still a black and white text command line environment. A few weeks ago, I wanted to change the default booting order so that Win7 booted first and LM was the option you'd have to select "manually" and after about a minute or two I gave up. And I think there's a lot of people that simply give up, when a "windowed" environment would guide them into accomplishing what they want to do and maintain their willingness to use Linux.

Is there a way to use Grub with a "GUI"?

all41
Level 15
Level 15
Posts: 5709
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by all41 » Thu Jun 01, 2017 12:01 am

Here is the thing. There are gui apps for grub--but you don't need them.
They are buggy and can cause many headaches.
As I said--you don't really need grub--the way you are using your system.
I use workstations that have W7pro certificates contained on original hard drive.
I installed Mint on second hd and use bios to choose which os (drive) that I will boot into.
Since I keep the Win drive only for resale purposes I have selected the Mint hd as the first drive in the bios boot order.
I can boot Win--if I intervene in the normal boot order.

User avatar
kukamuumuka
Level 15
Level 15
Posts: 5953
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by kukamuumuka » Thu Jun 01, 2017 12:55 am

Boot using Super Grub 2 and re-install grub from your Mint.
http://www.supergrubdisk.org/category/d ... sk-stable/

Unsaturated
Level 1
Level 1
Posts: 33
Joined: Wed May 31, 2017 7:59 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by Unsaturated » Thu Jun 01, 2017 3:59 am

all41 wrote:Here is the thing. There are gui apps for grub--but you don't need them.
They are buggy and can cause many headaches.
As I said--you don't really need grub--the way you are using your system.
I use workstations that have W7pro certificates contained on original hard drive.
I installed Mint on second hd and use bios to choose which os (drive) that I will boot into.
Since I keep the Win drive only for resale purposes I have selected the Mint hd as the first drive in the bios boot order.
I can boot Win--if I intervene in the normal boot order.
I installed EasyBCD from Win7 and it found both the Win7 and Win8 installations automatically, and then I "manually" aimed it at the Linux Mint partition and it seemed to find that one also, but just now I tried to boot to LM to test it. The Boot Loader gave me the option to boot to "NeoLinux" but when I selected it, it hung on a black screen and never booted to (Linux) desktop. I saw none of the usual text that is displayed during the LM boot process.

So what do I do now? Thanks in advance.

sgtor
Level 4
Level 4
Posts: 333
Joined: Sat May 13, 2017 9:39 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by sgtor » Thu Jun 01, 2017 6:40 am

Whats happened here is windows has over written the mbr(Master Boot Record)

It can be fixed but it's a complicated set of commands, however it is an easy step by step process as long as you have a guide to follow. There's a webpage out there that guides you step by step. I used it once but it would take a bit of googleing to find it again. If you think you'll actually use it then tell me and I'll find it for you. Once you're finished with that you can back up the mbr using the dd command.

That too is a bit complex but it's just one or two commands. I would have to check the syntax on that one to make sure I have it right but I'll help you with that too if you want.

rene
Level 12
Level 12
Posts: 4432
Joined: Sun Mar 27, 2016 6:58 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by rene » Thu Jun 01, 2017 8:23 am

Recycled/adjusted from a similar post day before yesterday: booted into (for example) the Linux Mint Live DVD/USB, with /dev/sdx the drive onto which to install grub (/dev/sda, no doubt) and /dev/sdyN the Mint / partition (/dev/sdb2 maybe), from a terminal:

Code: Select all

$ sudo -s
# mount /dev/sdyN /mnt
# mount --bind /dev /mnt/dev
# mount --bind /sys /mnt/sys
# mount --bind /proc /mnt/proc
# chroot /mnt
# grub-install /dev/sdx
# exit
# exit
$
If you have the Mint system's /boot split off to /dev/sdyM add mount /dev/sdyM /mnt/boot after the first mount. All this is N/A if you employed disk encryption for the Mint system.

sgtor
Level 4
Level 4
Posts: 333
Joined: Sat May 13, 2017 9:39 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by sgtor » Thu Jun 01, 2017 10:57 am

I went ahead and looked for that website anyway and found it.
http://howtoubuntu.org/how-to-repair-re ... tu-live-cd

If you look at that you'll see it's very straightforward, just copy and paste the commands. You could put these into a script too I suppose but doing that I would put a

Code: Select all

read
after each command so you can pause to read whats happening to make sure it's all going well. Just hit enter after each pause. If something goes wrong you can just Ctrl-C out of the script. Nothing should go wrong though. It works with a mint live cd/dvd.

You could stop here since your grub menu should be restored and working as it was before.
I would backup the mbr though. You can backup your mbr with dd.

dd is pretty simple once you understand it but it's one of the most dangerous commands in linux. I can't assume any responsibility for what happens to your system running this. I suggest you read the man page to get an understanding of what's going on with this. Using it wrong you can pretty much overwrite you entire HD.

Code: Select all

dd if=/dev/sda of=/mbr.bin bs=512 count=1  
That being said here's what it's doing.
if = input file
of = output file
bs = bytes
count = block numbers

So it's reading 512 bytes from the start of sda 1 time. The mbr is the first 512 bytes on sda. And it's writing it to / and naming it mbr.bin(of=/mbr.bin)

If you ever need to restore the mbr you would run this.

Code: Select all

dd if=/mbr.bin of=/dev/sda bs=512 count=1
Edit: This is assuming your linux system is on sda, make sure you set the right drive.

sgtor
Level 4
Level 4
Posts: 333
Joined: Sat May 13, 2017 9:39 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by sgtor » Thu Jun 01, 2017 11:07 am

rene wrote:Recycled/adjusted from a similar post day before yesterday: booted into (for example) the Linux Mint Live DVD/USB, with /dev/sdx the drive onto which to install grub (/dev/sda, no doubt) and /dev/sdyN the Mint / partition (/dev/sdb2 maybe), from a terminal:

Code: Select all

$ sudo -s
# mount /dev/sdyN /mnt
# mount --bind /dev /mnt/dev
# mount --bind /sys /mnt/sys
# mount --bind /proc /mnt/proc
# chroot /mnt
# grub-install /dev/sdx
# exit
# exit
$
If you have the Mint system's /boot split off to /dev/sdyM add mount /dev/sdyM /mnt/boot after the first mount. All this is N/A if you employed disk encryption for the Mint system.
That's almost the same as what I'm suggesting but a few things are missing.

Code: Select all

update-grub 
needs to be run as well at the end or it won't work and then all those mounts need to be unmounted.

User avatar
JerryF
Level 11
Level 11
Posts: 3940
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by JerryF » Thu Jun 01, 2017 11:10 am

First quote:
Unsaturated wrote:TBH I never liked the Grub boot loader. I've used Easy BCD and prefer it...
Second quote:
Unsaturated wrote:I'd really prefer to use something Linux, but I don't understand why after all these years Grub is still a black and white...
Which do you want to use?
IF your problem has been solved, please edit your ORIGINAL post and add [SOLVED] to the beginning of the Subject Line. It helps other members when browsing posts.

rene
Level 12
Level 12
Posts: 4432
Joined: Sun Mar 27, 2016 6:58 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by rene » Thu Jun 01, 2017 11:55 am

sgtor wrote:That's almost the same as what I'm suggesting but a few things are missing.

Code: Select all

update-grub
needs to be run as well at the end or it won't work and then all those mounts need to be unmounted.
No it won't and no they won't. update-grub only rebuilds /boot/grub/grub.cfg on the Mint system: he still has his copy. Admittedly that one won't contain an entry for the newly installed Windows 8 which is to say that indeed he might as well update at that point, but the thing here is only about getting grub reinstalled with grub-install; he might as well update after rebooting into his Mint system. The manual unmounts are also not necessary; said subsequent reboot out of the Live system is perfectly capable of unmounting (all) mounted file systems for him.

sgtor
Level 4
Level 4
Posts: 333
Joined: Sat May 13, 2017 9:39 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by sgtor » Thu Jun 01, 2017 1:29 pm

rene wrote:
sgtor wrote:That's almost the same as what I'm suggesting but a few things are missing.

Code: Select all

update-grub
needs to be run as well at the end or it won't work and then all those mounts need to be unmounted.
No it won't and no they won't. update-grub only rebuilds /boot/grub/grub.cfg on the Mint system: he still has his copy. Admittedly that one won't contain an entry for the newly installed Windows 8 which is to say that indeed he might as well update at that point, but the thing here is only about getting grub reinstalled with grub-install; he might as well update after rebooting into his Mint system. The manual unmounts are also not necessary; said subsequent reboot out of the Live system is perfectly capable of unmounting (all) mounted file systems for him.
My understanding of the problem was windows overwrote the mbr in which case the update-grub command will also need to be issued.
I'm certainly not an expert on grub but does grub-install read the installed OS's and then rewrite them back to the mbr?

I agree with you about the unmounts on rebooting though, I wondered why they are even on that example on that website but there must be a good reason and until I know why they are there I would just go ahead and do it.

Unsaturated
Level 1
Level 1
Posts: 33
Joined: Wed May 31, 2017 7:59 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by Unsaturated » Thu Jun 01, 2017 2:04 pm

JerryF wrote:First quote:
Unsaturated wrote:TBH I never liked the Grub boot loader. I've used Easy BCD and prefer it...
Second quote:
Unsaturated wrote:I'd really prefer to use something Linux, but I don't understand why after all these years Grub is still a black and white...
Which do you want to use?
I want to use whichever is easiest and fastest and gets me past this problem with the least amount of time & effort.

I've read the whole thread quickly, and get the idea that there is a complex Linux solution available. Thanks for the time and effort to post it. I'll wait a while to see if there isn't some sort of "magic bullet" solution that gets posted as an easier alternative. If not, I'll try the long & complicated Linux solution.

Some explanation as to why EasyBCD could "see" the Linux installation and offer to allow me to boot to it, but yet it still fails would be appreciated.

Also I'm going to try to remove all HD's from the BIOS boot order, leaving only the Linux HD and see if that doesn't at least get me back into Linux. From there I suppose I can access this post online, read & follow the directions re: grub and see if that solves the problems. I'm impressed by all the high-level help here. WAY more than I expected to get, so thanks.

rene
Level 12
Level 12
Posts: 4432
Joined: Sun Mar 27, 2016 6:58 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by rene » Thu Jun 01, 2017 2:10 pm

sgtor wrote:My understanding of the problem was windows overwrote the mbr in which case the update-grub command will also need to be issued.
I'm certainly not an expert on grub but does grub-install read the installed OS's and then rewrite them back to the mbr?
Indeed the problem is/was the Windows installation having overwritten the MBR (the first 512-byte sector of the disk) but "the installed OS's" are not stored in said MBR.

Noting for unsuspecting users this stuff to have been obsoleted by UEFI, the MBR in this (regular) case contains the main legacy partition table with the remaining 400 or so bytes used for grub's stage 1 loader, the only purpose of which is loading the stage 1.5 loader, core.img, which is embedded in the so-called post-MBR gap, the space between MBR and the start of the first partition. That first partition is these days aligned to 1 MiB (2048 sectors) and was historically cylinder-aligned, leaving all but that very first sector of the first cylinder available. In either case enough room is available for core.img to in fact contain filesystem-drivers, and it loads stage 2 and grub.cfg directly from /boot/grub. Only in /boot/grub/grub.cfg we find an enumeration of "installed OS's". It is as mentioned created by update-grub but was in this case already present: only the stage1 loader in the actual MBR was wiped out after all. The grub-install reinstalled stage1 to the MBR (and in fact stage 1.5 to the gap, but that isn't important here.)

As said, the poster's pre-existing /boot/grub/grub.cfg wouldn't have contained his new Windows 8 install so it makes sense to run update-grub before rebooting anyway, but it is not the case that it is needed.
I agree with you about the unmounts on rebooting though, I wondered why they are even on that example on that website but there must be a good reason and until I know why they are there I would just go ahead and do it.
While not really wanting to sound overly pedantic -- if you currently believe information in random corners of the internet by random authors to necessarily be good or even correct, you have some disappointments still ahead of you :wink:

Of course, there is in this case nothing wrong with manuals unmounts either so do feel perfectly free.

User avatar
kukamuumuka
Level 15
Level 15
Posts: 5953
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by kukamuumuka » Thu Jun 01, 2017 2:12 pm

Unsaturated wrote: I want to use whichever is easiest and fastest and gets me past this problem with the least amount of time & effort.
The problem is that you are trying to solve the dual-boot problem via windows-applications, which is the difficult way.

sgtor
Level 4
Level 4
Posts: 333
Joined: Sat May 13, 2017 9:39 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by sgtor » Thu Jun 01, 2017 2:19 pm

Unsaturated wrote:
I'll wait a while to see if there isn't some sort of "magic bullet" solution that gets posted as an easier alternative. If not, I'll try the long & complicated Linux solution.
FWIW Rene actually posted the magic bullet. That's pretty much what the website link I posted says to do except I think you should add update-grub as the last command as well. Rene and I disagree on that but it's no big deal :) Also make sure you change sdx to whatever drive your linux is on.

rene
Level 12
Level 12
Posts: 4432
Joined: Sun Mar 27, 2016 6:58 pm

Re: Grr. Windows 8 overwrote my Grub Boot Loader. GRRRRR...

Post by rene » Thu Jun 01, 2017 2:25 pm

Note, if you do, insert that update-grub inside of the chroot, that is, just before the first exit.

Post Reply

Return to “Installation & Boot”