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
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.