Dual boot: one legacy, the other uefi

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Dual boot: one legacy, the other uefi

Beco

Hi guys,

I have this laptop problem to solve: the original windows 10 is kept, shrunk partition to 1TB, originally cryptographied (but now normal). The rest was given to Linux, Debian 10: 800GB root and 8.2GB swap.

Now the system can boot both systems ok. But to choose which one you want, you need to enter the BIOS, change legacy to UEFI, and vice-versa, then you can boot.

Not a good way to keep.

Lets give the devices some names.

/dev/sda4 is windows 10
/dev/sda5 is debian buster 10
/dev/sda6 is swap

Other partitions are the usual that comes with a Windows Dell laptop (boot, backup, etc.)

Grub is installed at sda5 with Debian, but when updated it doesn't recognize A Windows partition.

Can you point me to a possible howto, blog, set of instructions or even abstract ideas that are in the right direction?

My best,



--
Dr Beco
A.I. researcher

"I know you think you understand what you thought I said but I'm not sure you realize that what you heard is not what I meant" -- Alan Greenspan

Creation date: pgp.mit.edu ID as of 2014-11-09
Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

Joe Rowan
On Sun, 6 Oct 2019 17:45:37 -0300
Beco <[hidden email]> wrote:

> Hi guys,
>
> I have this laptop problem to solve: the original windows 10 is kept,
> shrunk partition to 1TB, originally cryptographied (but now normal).
> The rest was given to Linux, Debian 10: 800GB root and 8.2GB swap.
>
> Now the system can boot both systems ok. But to choose which one you
> want, you need to enter the BIOS, change legacy to UEFI, and
> vice-versa, then you can boot.
>
> Not a good way to keep.
>
> Lets give the devices some names.
>
> /dev/sda4 is windows 10
> /dev/sda5 is debian buster 10
> /dev/sda6 is swap
>
> Other partitions are the usual that comes with a Windows Dell laptop
> (boot, backup, etc.)
>
> Grub is installed at sda5 with Debian, but when updated it doesn't
> recognize A Windows partition.
>
> Can you point me to a possible howto, blog, set of instructions or
> even abstract ideas that are in the right direction?
>

Installation notes for Debian 10, on the Debian website.

I installed stretch (stable at the time) on a Win10 netbook without
problems. There is no legacy BIOS in that machine, so Debian had to be
installed UEFI and it Just Worked. The grub menu lists the Windows boot
manager underneath the Debian entry.

There will be a UEFI partition apart from those you named, Windows
requires it and Debian can use it. Certainly stretch was UEFI-enabled,
so I assume buster is also.

--
Joe

Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

Pascal Hambourg-2
In reply to this post by Beco
Le 06/10/2019 à 22:45, Beco a écrit :
>
> Now the system can boot both systems ok. But to choose which one you want,
> you need to enter the BIOS, change legacy to UEFI, and vice-versa, then you
> can boot.

Would you mind telling which systems boots in EFI mode and which one
boots in legacy mode ?

> Not a good way to keep.

Some people think otherwise. It is not the most convenient, but it
prevents Windows to interfere with GRUB's operation.

> Lets give the devices some names.
>
> /dev/sda4 is windows 10
> /dev/sda5 is debian buster 10
> /dev/sda6 is swap

> Grub is installed at sda5 with Debian, but when updated it doesn't
> recognize A Windows partition.

Of course not. Both systems must be set up to boot in the same mode.

> Can you point me to a possible howto, blog, set of instructions or even
> abstract ideas that are in the right direction?

If Windows boots in EFI mode :
Mount the EFI partition on /boot/efi.
Install grub-efi-amd64.
Boot some Linux media in EFI mode.
Chroot into the Debian system, mount the usual pseudo-filesystems
(/proc, /dev...) and the EFI partition.
Run grub-install.
Run update-grub.
Done.

If Windows boots in legacy mode :
Create a partition with "BIOS boot" type. 100 ko is more than enough.
Install grub-pc.
Done.

Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

Joe Rowan
On Sun, 6 Oct 2019 23:26:32 +0200
Pascal Hambourg <[hidden email]> wrote:

> Le 06/10/2019 à 22:45, Beco a écrit :
> >
> > Now the system can boot both systems ok. But to choose which one
> > you want, you need to enter the BIOS, change legacy to UEFI, and
> > vice-versa, then you can boot.  
>
> Would you mind telling which systems boots in EFI mode and which one
> boots in legacy mode ?
>
Windows 8/8a/10 boot only in EFI.

--
Joe

Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

sp007@caiway.net
In reply to this post by Beco
On Sun, 6 Oct 2019 17:45:37 -0300
Beco <[hidden email]> wrote:

> Hi guys,
>
> I have this laptop problem to solve: the original windows 10 is kept,
> shrunk partition to 1TB, originally cryptographied (but now normal).
> The rest was given to Linux, Debian 10: 800GB root and 8.2GB swap.
>
> Now the system can boot both systems ok. But to choose which one you
> want, you need to enter the BIOS, change legacy to UEFI, and
> vice-versa, then you can boot.
>
> Not a good way to keep.

When I needed windows I had once succes with rEFInd boot manager,
apt install refind

Always have a rescue USB stick at hand though, windows 10 has
nasty suprises.

Wish you good luck.

Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

Pascal Hambourg-2
In reply to this post by Joe Rowan
Le 07/10/2019 à 09:42, Joe a écrit :

> On Sun, 6 Oct 2019 23:26:32 +0200
> Pascal Hambourg <[hidden email]> wrote:
>
>> Le 06/10/2019 à 22:45, Beco a écrit :
>>>
>>> Now the system can boot both systems ok. But to choose which one
>>> you want, you need to enter the BIOS, change legacy to UEFI, and
>>> vice-versa, then you can boot.
>>
>> Would you mind telling which systems boots in EFI mode and which one
>> boots in legacy mode ?
>>
> Windows 8/8a/10 boot only in EFI.

I don't think so. Source ?

Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

Joe Rowan
On Mon, 7 Oct 2019 23:29:09 +0200
Pascal Hambourg <[hidden email]> wrote:

> Le 07/10/2019 à 09:42, Joe a écrit :
> > On Sun, 6 Oct 2019 23:26:32 +0200
> > Pascal Hambourg <[hidden email]> wrote:
> >  
> >> Le 06/10/2019 à 22:45, Beco a écrit :  
> >>>
> >>> Now the system can boot both systems ok. But to choose which one
> >>> you want, you need to enter the BIOS, change legacy to UEFI, and
> >>> vice-versa, then you can boot.  
> >>
> >> Would you mind telling which systems boots in EFI mode and which
> >> one boots in legacy mode ?
> >>  
> > Windows 8/8a/10 boot only in EFI.  
>
> I don't think so. Source ?
>

As I Understood It. Definitely, computers certified for these versions
must have EFI mode available, which is not, of course, the same thing.

Yes, even Win10 appears to be able to be installed to boot in legacy
mode. Shows how many Windows installations I've done recently....

But I'm pretty sure that any pre-installed Windows, and very few people
now install it themselves, will be a UEFI installation, which cannot be
changed to boot in legacy mode, nor vice-versa.

--
Joe

Reply | Threaded
Open this post in threaded view
|

Re: Dual boot: one legacy, the other uefi

Curt
On 2019-10-08, Joe <[hidden email]> wrote:
>
> But I'm pretty sure that any pre-installed Windows, and very few people
> now install it themselves, will be a UEFI installation, which cannot be
> changed to boot in legacy mode, nor vice-versa.
>

>From what I'm understanding you're batting a thousand here, Joe.

https://docs.microsoft.com/en-us/windows/deployment/mbr-to-gpt

https://www.asus.com/us/support/FAQ/1013017/


--
"There are no foreign lands. It is the traveler only who is foreign."
-- Robert Louis Stevenson

Reply | Threaded
Open this post in threaded view
|

(solved) Re: Dual boot: one legacy, the other uefi

Beco
In reply to this post by Pascal Hambourg-2

Hello all,

Thank you very much for all this thread and discussion.

Let me get back to you.

On Sun, 6 Oct 2019 at 18:26, Pascal Hambourg <[hidden email]> wrote:
 

Dear Pascal,




If Windows boots in EFI mode :
Mount the EFI partition on /boot/efi.
Install grub-efi-amd64.
Boot some Linux media in EFI mode.
Chroot into the Debian system, mount the usual pseudo-filesystems
(/proc, /dev...) and the EFI partition.
Run grub-install.
Run update-grub.
Done.




Your simplified solution nailed it! Thank you.

I mark this thread as solved basically because of this small paragraph. So if you are reading this in the near future trying to find a solution, this step-by-step and some duckduckgo will get you into business.


There are more details for a complete response, and some commands needs to be in a different order, that I'll reply later in this thread, just to make sure the procedure that I made and worked flawlessly, is registered for posterity.

 For now, if you are in a hurry, this answer above will get you in the right path.

My best,

Beco



--
Dr Beco
A.I. researcher

"I know you think you understand what you thought I said but I'm not sure you realize that what you heard is not what I meant" -- Alan Greenspan

Creation date: pgp.mit.edu ID as of 2014-11-09
Reply | Threaded
Open this post in threaded view
|

Re: (solved) Re: Dual boot: one legacy, the other uefi

Beco
Hello guys,

As I promised, here a more detailed solution, with the steps I really used:


The problem:

* You have a Windows 10 UEFI and a Linux Legacy boot. They both work, but to choose what to boot you need to change the BIOS option each time.

Possible solutions discussed in the thread:
1. Let it be. Don't try to fix what ain't broke.
2. Try to make grub legacy find and boot windows
3. Move Linux boot to UEFI as well.

Solution I chose was 3: lets move Linux Legacy to Linux UEFI under these conditions.

Step-by-step solution to "MY" case. Be careful as your system might have small differences that would make a huge difference in the end.
Special attention to /dev/sdXN partition names and the respective UUID used in FSTAB.

First step: with a UEFI setup on BIOS, bring up the Linux Legacy.

To do this, you need to boot from a USB stick, as your Linux won't boot. Then you need to give control to the Linux on the harddrive (chroot).

The steps are:

# boot do debian live of your choice, preferred the same version you have on HD.
You will need the internet.
Check if apt-get is working on your live system. Maybe install some innocuous/small package like "ascii"

Create a point for the new root (in my example it is in sda8):
# mkdir /mnt/root
# mount -t ext4 /dev/sda8 /mnt/root

Now we need to setup the EFI boot

# mkdir /mnt/rooot/boot/efi

Find your current UEFI partition (maybe fdisk -l will help you), then mount it:
# mount /dev/sda1 /mnt/rooot/boot/efi

Now prep to change root. Mount all essencial filesystems:

# mount --bind /sys /mnt/rooot/sys/
# mount --bind /proc /mnt/rooot/proc/
# mount --bind /dev /mnt/rooot/dev/
# mount --bind /dev/pts /mnt/rooot/dev/pts/
# mount --bind /run /mnt/rooot/run/

Be sure the internet will work after chroot with:
# cp /etc/resolv.conf /mnt/root/etc/resolv.conf

Find the correct UUID of the UEFI partition. You will need this information to add to fstab file.
(Use commands like blkid or fdisk -l -o +UUID or ls /dev/disk/by-uuid)

Add it to your FSTAB

echo "UUID=A2YOUR14-9UUID22  /boot/efi  vfat  defaults    0   2" >> /mnt/rooot/etc/fstab

Now finally, do the magic:

chroot /mnt/root

You should now "be" on the main Linux on your HD.

Test apt-get to be sure with some small/useless package. You really don't want to mess up the following commands!
# apt-get install figlet

This is the "almost" irreversible part. Until now you were playing with kid's commands.
Remove the old legacy grub.
Add the new UEFI grub
Re-install the grub menu and hopefully it will recognize your windows.

# apt-get remove grub-pc
# apt-get install grub-efi
# grub-install /dev/sda


Check if this file exists, to be sure you are on a UEFI partition now:
# file /boot/efi/EFI/debian/grubx64.efi

Chek also the output of this command and find DEBIAN there:
# efibootmgr

Go back to your old root
# exit

Remove your USB-stick and...
# reboot



Check this website for some other insights:
https://blog.getreu.net/projects/legacy-to-uefi-boot/

On my machine I needed also to remove this options in the BIOS:
BIOS - removed secure boot


That is all.
Have a good hacking.

My best,
Dr. Béco


PS. These instructions come WITHOUT ANY WARRANTY.  Always have your backup ready to reinstall everything.




On Thu, 10 Oct 2019 at 18:15, Beco <[hidden email]> wrote:

Hello all,

Thank you very much for all this thread and discussion.

Let me get back to you.

On Sun, 6 Oct 2019 at 18:26, Pascal Hambourg <[hidden email]> wrote:
 

Dear Pascal,




If Windows boots in EFI mode :
Mount the EFI partition on /boot/efi.
Install grub-efi-amd64.
Boot some Linux media in EFI mode.
Chroot into the Debian system, mount the usual pseudo-filesystems
(/proc, /dev...) and the EFI partition.
Run grub-install.
Run update-grub.
Done.




Your simplified solution nailed it! Thank you.

I mark this thread as solved basically because of this small paragraph. So if you are reading this in the near future trying to find a solution, this step-by-step and some duckduckgo will get you into business.


There are more details for a complete response, and some commands needs to be in a different order, that I'll reply later in this thread, just to make sure the procedure that I made and worked flawlessly, is registered for posterity.

 For now, if you are in a hurry, this answer above will get you in the right path.

My best,

Beco



--
Dr Beco
A.I. researcher

"I know you think you understand what you thought I said but I'm not sure you realize that what you heard is not what I meant" -- Alan Greenspan

Creation date: pgp.mit.edu ID as of 2014-11-09


--
Dr Beco
A.I. researcher

"I know you think you understand what you thought I said but I'm not sure you realize that what you heard is not what I meant" -- Alan Greenspan

Creation date: pgp.mit.edu ID as of 2014-11-09