LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-22-2018, 03:05 PM   #1
demerson3
Member
 
Registered: Sep 2004
Location: Seattle area
Distribution: debian stable
Posts: 51

Rep: Reputation: 15
understanding grub2, mbr, primary/secondary drives, and dual booting


I previously thought I had a good grasp of the old grub1 system, but I haven't done much sysadmin kinda stuff since the move to grub2, and grub2 perplexes me.

I have a laptop with two hard drives, I'll call them internal and external (the "external" one is in a laptop drive bay and is ejectable.) Right now both have Debian on them: internal has an older version that I've cleaned out and am ready to get rid of; and external is my primary OS, debian stable, I guess it's stretch. It has an encrypted root, which somewhat complicates things.

I'm getting ready to install Windows 10 on internal drive, which is going to put itself on the MBR and not provide a boot menu.

My question: What should I put on a USB flash drive, so that I can boot from that USB drive and access grub2 on external drive?

I'm not sure whether grub2 is installed on the MBR area of external drive or not; I could probably discover this by removing internal drive and trying to boot; but short of that is there a way to find out?

Basically I want to know, how can I set myself up for success in booting debian on external, while going through this kind of scary process of clearing the MBR that I believe I have been relying on for years, with a new grub that I don't understand?

Thanks!
David
 
Old 06-22-2018, 04:23 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,508

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
Is your system UEFI or Legacy? If you install windows, it may try to install UEFI but you can use the Custom install option and install in Legacy mode. If your current Debian (on the External) is UEFI, then you should install windows UEFI for compatibility. You can boot into Debian and open a terminal as root user and run the command:

Quote:
parted -l

If you see a partition labellef EFI in vfat format, you have UEFI.

If you have Debian on the external and plan to keep that, you need to check the parted command to see on which drive you have Debian. With the info you have posted, you should have sda and sdb but you need to verify that. If Debian is on sdb and a Legacy install, you would simply install Grub to the MBR of that drive running this command as root:

Quote:
grub-install /dev/sdb
Verify your drive first, if you aren't sure post the output of parted here.
 
1 members found this post helpful.
Old 06-22-2018, 06:12 PM   #3
demerson3
Member
 
Registered: Sep 2004
Location: Seattle area
Distribution: debian stable
Posts: 51

Original Poster
Rep: Reputation: 15
Thank you very much for helping!

I've looked at parted and it does not appear to be UEFI. I don't presently have any vfat partitions, and there is nothing marked efi.

I also looked in the bios setup utility, and could not find anything there about UEFI. Perhaps that means it is not supported, and I have nothing to worry about as that goes.

Thanks for the tip about the custom install option, I would not have thought of that. I am not sure if I will get the option to do that, as I am installing a corporate image; but I will look out for it.

I performed a grub-install per your advice, and tested booting from a USB stick with SystemRescueCD which gave me a prompt to boot from my HDD2, and that worked, so it looks like I have a good fallback.
Will update after my installation!

Thanks again for the great advice.

David
 
Old 06-22-2018, 06:50 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,508

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
You're welcome.
 
Old 06-25-2018, 05:18 PM   #5
demerson3
Member
 
Registered: Sep 2004
Location: Seattle area
Distribution: debian stable
Posts: 51

Original Poster
Rep: Reputation: 15
installation went well! Notes...

I did not see any option for custom install; as I mentioned, it was a corporate image not a standard install.

I'm not sure whether UEFI is supported by my computer (Lenovo W500), however it does not seem to be enabled, which is fine.

Conveniently, in the BIOS I am able to select the default boot device, so I've simply set the second/external drive to be the default boot device. I can remove it and boot windows, or I can insert it and it gives me a boot menu where I can select to boot linux or windows. (I had to update grub to get the boot menu updated).

A simple run of update-grub2 found the new Windows installation and made an entry for it in the boot menu.

Before running update-grub2, I added a line to the end of /etc/grub.d/40_custom:
Code:
set timeout=-1
This ensures I will always be forced to choose which OS to boot; it won't time out and choose a default. The timeout could have been set somewhere else, however a (possibly fixed by now) bug in /etc/grub.d/30_os-prober was overwriting the timeout value, so 40_custom was the best way to go.

I had no need for the SystemRescueCD bootable USB stick, but I was glad to have it as a backup plan.

Last edited by demerson3; 06-26-2018 at 07:52 PM.
 
Old 08-18-2018, 10:51 AM   #6
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
You can set the GRUB_TIMEOUT value in the /etc/default/grub file and then run update-grub.
 
Old 09-23-2018, 02:06 PM   #7
demerson3
Member
 
Registered: Sep 2004
Location: Seattle area
Distribution: debian stable
Posts: 51

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by luvr View Post
You can set the GRUB_TIMEOUT value in the /etc/default/grub file and then run update-grub.
This is not recommended, as /etc/default/grub is now auto-generated and will be overwritten by certain update commands. And this is grub2 as well.
 
Old 09-23-2018, 03:06 PM   #8
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by demerson3 View Post
/etc/default/grub is now auto-generated and will be overwritten by certain update commands
Really? That's news to me.
As far as I know, /etc/default/grub is an input file to the config generation process, to ensure that your modifications won't get overwritten, because the config generator will pick up your selected settings from the file and modify the auto-generated config file according to what it finds there.

I certainly have never seen the file getting overwritten by any update command so far.
 
  


Reply

Tags
dual boot, grub2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Grub2 automatically boot from a secondary partition if the primary fails? sharkman Linux - Desktop 8 12-06-2014 03:09 PM
Problem of dual booting WinXP & Fedora core5 in two primary hard drives biswajit12 Fedora - Installation 5 11-07-2006 09:06 AM
Changing drives from primary to secondary controller robintw SUSE / openSUSE 7 04-04-2005 02:05 PM
dual boot for win2000 as primary and linux as secondary Carmela Linux - Newbie 4 10-26-2004 12:22 PM
Mandrake on primary HD, Win on secondary, dual boot? XDude Linux - Newbie 12 07-15-2003 12:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration