Linux Lite Forums

Software - Support => Installing Linux Lite => Topic started by: lintek on August 16, 2019, 01:07:49 AM

Title: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: lintek on August 16, 2019, 01:07:49 AM
I installed a dual boot system with Windows 7 on one HD and Linux Lite on another.  Grub allowed me to choose which OS I wanted at bootup.  Since then I installed a Hard Drive switch so I can turn off the drives I am not currently using. 

And now I can't boot up to windows if I have the Linux drive off because the boot order points to Grub first (I assume).

How can I deal with this?  (Sorry - newb)

Thanks
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: DeepThought on August 16, 2019, 03:20:26 AM
It sounds like grub was installed to the mbr of your linux hdd and controls all boot functions.
You will need to recover the windows bootloader on the windows hdd.
Hope this website helps in that:

Code: [Select]
https://www.nextofwindows.com/how-to-manually-troubleshoot-and-repair-windows-7-bootloader
Don't forget to switch off your linux hdd before following the instructions to repair the mbr on the windows hdd :)
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: m654321 on August 16, 2019, 04:21:00 AM
To repair windows bootloader ...
- remove the HDD which has LL installed on it
- insert Win7 installation DVD & then boot from it
- choose option "repair your computer"  (it searches for Windows installation)
- select OS to repair
- next go to the Windows command prompt, you should then see the prompt: 
Code: [Select]
X:\sources>after the prompt type:
Code: [Select]
bootrec /fixbootthen the prompt will appear again, this time type:
Code: [Select]
bootrec /fixmbr
- press shutdown
- then boot up Windows (make sure you don't boot into the Win7 DVD)

You will now no longer have the grubscreen (as grub partition gone), but your windows bootloader is fixed & restored.

- turn off computer & put your LL HDD back in the machine.

You will now need to reinstall GRUB 2, deleting any old or  corrupted files in the process:

- insert your LL installation DVD & boot into LL from it (i.e. LL in the live environment)

For arguments sake, lets assume LL's root is installed on the partition /dev/sdb1, and Windows OS installed on the HDD designated /dev/sda (if you don't know or are unsure of the /dev/sdx designation of either Windows or LL, check it using gparted from your LL DVD to check - just type gparted into LL's menu search box):

So using terminal from your Live DVD, type:
Code: [Select]
sudo mount /dev/sdb1 /mnt
sudo grub-install --boot-directory=/mnt/boot /dev/sda
 
Reboot, select LL boot option from your PC's Settings.
When in LL update the grub (so it finds Windows OS), by typing following in terminal:
Code: [Select]
sudo update-grub
When you reboot you should then see both Windows & LL listed on the grubscreen.

Hope this helps - this has happened to me before with LL/Win7 dual-boots!

Have a good day
Mike




 
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: trinidad on August 16, 2019, 08:08:39 AM
i/e ... When you use a hardware switch you can't install a grub bootloader with both disks running because that would make one disk sda1 and the next one sdb1. When using such switches with MBR both disks would be sda1, or if your board allows you must combine the disks but I have not had much success with Windows/Linux dual boot doing that, only Linux/Linux.

TC
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: lintek on August 16, 2019, 11:01:21 AM
Just to clarify - nothing was damaged as far as Grub.  If I Switch both HDs ON then it boots to Grub, I choose an OS, and it boots fine.

My goal is to: (before the computer is turned on)  Choose the current OS by switching that HD ON and leaving the other off.  Then have the computer boot to the OS that is turned ON.

Are there settings in "Grub Customizer" that might allow this?  Or maybe a fresh install of Linux with the other HD turned off?
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: m654321 on August 16, 2019, 12:52:12 PM
Just to clarify - nothing was damaged as far as Grub.  If I Switch both HDs ON then it boots to Grub, I choose an OS, and it boots fine.
Okay, sorry I misunderstood - I thought your Window's bootloader & Grub needed repairing, following on from DeepThought's comment.

Quote
My goal is to: (before the computer is turned on)  Choose the current OS by switching that HD ON and leaving the other off.  Then have the computer boot to the OS that is turned ON.
I'm not familiar at all with a hard drive switcher - I assumed you meant choosing the HDD drive from the PC's boot settings. What advantage does it confer, over the usual method of choosing your OS from the onscreen grublist when booting. TC mentions that a hard drive switcher & Grub are incompatible & gives reasons, so maybe better to drop the HDD-switcher as it just seems to over-complicate things ...

Quote
Are there settings in "Grub Customizer" that might allow this?  Or maybe a fresh install of Linux with the other HD turned off?
I would stay away from that app - my experience of it in the past is that it's pretty buggy and can really mess up things - I don't use it anymore.
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: lintek on August 16, 2019, 01:22:10 PM
This is the HD switcher I was talking about.  Basically it is an on/off switch for each of the internal Hard Drives.  I use it to keep my backup disconnected when not in use, and was hoping to do the same with the unused OS.

https://www.amazon.com/gp/product/B00TZR3E70/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1

Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: m654321 on August 16, 2019, 03:08:13 PM
This is the HD switcher I was talking about.  Basically it is an on/off switch for each of the internal Hard Drives.  I use it to keep my backup disconnected when not in use, and was hoping to do the same with the unused OS.
https://www.amazon.com/gp/product/B00TZR3E70/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1 (https://www.amazon.com/gp/product/B00TZR3E70/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1)

Many thanks for clarifying with this link. 
So, why don't you keep your dual-boot system on a single drive (keep it as /dev/sda) instead of the two OS on two different drives? That way I think your back-up drive will always be /dev/sdb whether it's switched on or not.  Even better, why not have your backup drive as an external USB drive (instead of an internal drive), that way you can simply unmount and eject it when not needed and this wont affect the /dev/sdx designation of your dual-boot drive ...

See what TC thinks - I'm pretty sure he'll know
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: lintek on August 16, 2019, 04:01:31 PM
...So, why don't you keep your dual-boot system on a single drive (keep it as /dev/sda) instead of the two OS on two different drives? That way I think your back-up drive will always be /dev/sdb whether it's switched on or not...

Kinda funny you mentioned that.  Actually I just broke my external drive OUT of its' box so that I could mount it internally and run it off the switch (LOL)!  (Wanted to clear away some of the stuff around my PC and had already ordered the switch, so I decided internal was the way to go.

I'm not sure if I tried it yet, but in my mind, if I set the Boot order to:
1) Windows HD
2) Grub
3)Linux HD

Then if the Windows HD is not present (turned OFF) it should move on to the next HD which would be the Grub partition.  I will test it this evening.
Title: Re: Dual boot Win/Lin on separate HDs with a switch - bypass Grub?
Post by: firenice03 on August 16, 2019, 08:35:23 PM
...So, why don't you keep your dual-boot system on a single drive (keep it as /dev/sda) instead of the two OS on two different drives? That way I think your back-up drive will always be /dev/sdb whether it's switched on or not...

Kinda funny you mentioned that.  Actually I just broke my external drive OUT of its' box so that I could mount it internally and run it off the switch (LOL)!  (Wanted to clear away some of the stuff around my PC and had already ordered the switch, so I decided internal was the way to go.

I'm not sure if I tried it yet, but in my mind, if I set the Boot order to:
1) Windows HD
2) Grub
3)Linux HD

Then if the Windows HD is not present (turned OFF) it should move on to the next HD which would be the Grub partition.  I will test it this evening.

Going to throw out a MAYBE...
Is this UEFI??  - Probably not and may not work in same fashion..
But on my kangaroo - I have Windows on the internal and LL running from a SDcard.
If I have "ubuntu" selected in uefi bios - I get normal grub...
If I set windows boot manager I will only get windows normal boot process....

Might be kinda what you'd want but system may not be....