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 <r...@beco.cc> 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 <pas...@plouf.fr.eu.org>
> 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
>
> GPG Key:
> https://pgp.mit.edu/pks/lookup?op=vindex&search=0x5A107A425102382A
> 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

GPG Key: https://pgp.mit.edu/pks/lookup?op=vindex&search=0x5A107A425102382A
Creation date: pgp.mit.edu ID as of 2014-11-09

Reply via email to