Switching Legacy Leap 15.2 install to UEFI on dual boot with Windows 10

Hello,
I have installed Leap 15.2 on a machine with Windows 10 and it appears that it’s a Legacy install instead of UEFI because I cannot find a way to boot into Windows 10. When I run the “efibootmgr -v” command in Konsole I get “EFI variables are not supported on this system”. Also, boot loader in Yast states GRUB2 under Boot Code Options, “Boot from Master Boot Record” is marked, “Set active Flag in Partition Table for Boot Partition” is marked and “do not change” appears under Protective MBR flag. Is switching to UEFI as simple as changing “GRUB2” to “GRUB2 for EFI” under Boot Loader drop down and clicking OK? I want to proceed with caution here as I don’t want to freeze the machine and not be able to log into anything. Any help with fixing this so I can have access to both systems would be greatly appreciated.

Cheers,

Kris

Unfortunately, that will fail, with about the same error message that you got running “efibootmgr”.

To fix this, you first need to be able to boot to UEFI mode.

Start with the install media. See if you can manage to boot that in UEFI mode. If you can boot it in UEFI mode to the rescue system, then it is fairly easy to switch your system.

If you no longer have the install media, then try downloading the live Leap 15.2 media. Again, see if you can manage to boot it to UEFI mode. It might require BIOS configuration changes.

When you are able to boot something (original install media or live media) to UEFI mode, tell us how you did that. And I can give you the next steps to complete your switchover.

I still have the install media so I will check if booting in UEFI mode works and I’ll report back.
Thanks so much!

Switched all linux systems from legacy bios to uefi some time ago: Frühjahrsputz | Karl Mistelberger

nrickert](https://forums.opensuse.org/member.php/49759-nrickert)
I started up the computer with the USB installation media inserted, selected Rescue System from the options and I’m now looking at “openSUSE Leap 15.2 Rescue System” and “rescue login:” on the screen. I’m not sure if there is a way to verify if it’s booting in UEFI mode at this stage. What are the next steps from here?
Thank you.

At the login prompt, you can login as root (password not required).

Then run the command:

efibootmgr -v

If you booted with UEFI, you will get a list of boot choices. Otherwise you will get that error message about “efivars”.

Maybe this will make it easier. I did a blog post on installing Leap 15.2. There are images of the installer boot screen, both for legacy booting and for UEFI booting. If you get used to the difference between those, it will be easier to tell how you are booting. Note that you can click on those images to enlarge them, as needed.

[QUOTE=nrickert;2951728]At the login prompt, you can login as root (password not required).

Then run the command:

efibootmgr -v

If you booted with UEFI, you will get a list of boot choices. Otherwise you will get that error message about “efivars”.

It looks like I booted with UEFI. Picture of the screen with options is attached. https://photos.app.goo.gl/qdUGJWFoeqptpLCg6

What do you advise from here?

1: Mount your root partition at “/mnt”. It will be something like:

mount /dev/sda3 /mnt

except that it probably isn’t “sda3”. I’m assuming that you know which partition is which.

2: Mount your EFI partition at “/mnt/boot/efi”. You might need to first

mkdir /mnt/boot/efi

if that directory does not exist.

3: Some bind mounts:


mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc

Next we go to “chroot” mode. I’ll give the commands needed. Any line that starts with “###” is just my comment, and you need to type that in.


chroot /mnt
### this starts a session that see "/mnt" as the root file system
mount -a
### that mounts anything missing.  In particular, it mounts "btrfs" subvolumes.
yast
### this should start a command line "yast" session.  You want to go to the boot loader section

The command line session is a little awkward to use, but I think you can get it to work.

Make the changes that you mentioned in your first post in this thread:
“GRUB2” is changed to “GRUB2 for EFI”

If there is a box about the protective MBR flag, set that to remove flag.

Select OK. And you should be done.


exit
### exit the chroot session
shutdown -r now
### reboot, and see what happens


@nrickert](https://forums.opensuse.org/member.php/49759-nrickert)

Thanks so much for all the instructions above! Below is the plan that I’m going to follow and we’ll see if it works. If you are able to take a look at it and see if I missed anything or if anything looks wrong that would be great and feedback is really appreciated.

My storage devices from Yast partitioner (screenshot): https://photos.app.goo.gl/x4UrvSaxEdv77jM87
My Current System Device Graph from Yast partitioner (screenshot): https://photos.app.goo.gl/mhzuwtTEjh2ii3CB8

  1. Start system with installation media in UEFI mode
  2. Go to Rescue System
  3. Mount root partition:
mount /dev/sda6 /mnt
mkdir /mnt/boot/efi
sda6 /mnt/boot/efi
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind proc /mnt/proc
chroot /mnt
mount -a
yast
  1. In Yast Command Line session change GRUB2 to GRUB2 with EFI and clear protective MBR flag box if checked.
  2. Select OK
exit
shutdown -r now

If the above process does not look right to anyone please let me know what changes you recommend.

Step 5 looks wrong.

You need to actually mount your EFI partition to “/mnt/boot/efi”

I don’t know which partition that is. It might be “/dev/sda1”, in which case you would use

mount /dev/sda1 /mnt/boot/efi

To identify the EFI partition, you can try

parted -l

That should list all partitions and the output should tell you which is an EFI partition.


@nrickert](https://forums.opensuse.org/member.php/49759-nrickert)

“parted -l” returns this data:

Model: ATA ST3500413AS (scsi)Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number Start End Size File system Name Flags
1 1049kB 368MB 367MB fat32 boot, legacy_boot, esp
2 368MB 366GB 365GB ntfs msftdata
5 366GB 366GB 5243kB bios_grub
6 366GB 403GB 37.6GB btrfs
7 403GB 405GB 2147MB linux-swap(v1) swap
3 405GB 489GB 83.9GB Basic data partition msftdata
4 489GB 500GB 10.7GB ntfs msftdata

According to how I understand this, Step 5 should be exactly how you stated it:

mount /dev/sda1 /mnt/boot/efi



Would you agree?

I agree! :slight_smile:

Yes, I also agree. Your EFI partition is “/dev/sda1”.

The challenge I’m facing is at the end of Yast setup. Apparently Yast needs to install two packages (grub2-x86_64-efi and mokutil) but it cannot access the website with files. I’m hardwired to the router and the internet connection worked great while running OpenSUSE Leap 15.2 OS so I don’t think that’s the problem here. Is there maybe a way to download these files on another machine, put on a USB drive and then point Yast to the USB instead of the web after the drive with the files is plugged into the machine that’s going through the system rescue? Are there maybe other options you can recommend?

Packages that need to be installed: https://photos.app.goo.gl/gjNYo3UKw36hWBoe9
Can’t access installation media: https://photos.app.goo.gl/tgrhENSyD5XNNHUV6
Can’t access installation media details: https://photos.app.goo.gl/bGJ287vi4nibSpcN7

It might be easiest to boot the system the old way (BIOS/MBR) and install those package first before you go to rescue mode.

Or:

When I use rescue mode, in addition to the bind mounts that I mentioned, I also use:


mount --bind /run /mnt/run
mount --bind /tmp /mnt/tmp

The first of those makes “resolv.conf” available to the system being rescued, and for me that’s enough to allow downloading packages.

The second is because I use “tmpfs” for “/tmp” so binding “/tmp” means that temp files don’t go in the bare “/tmp” directory of the system being rescued.

@nrickert](https://forums.opensuse.org/member.php/49759-nrickert)

After finishing all the steps we discussed the current situation is as follows:

  1. With BIOS set to Boot Manager first and Hard Drive second the computer boots directly into Windows without presenting any options at startup. Windows works fine.
  2. With BIOS set to Boot Manager second and Hard Drive first the GRUB menu loads. (https://photos.app.goo.gl/pitiu7nr8yrJdQy48)
    2a. When openSUSE Leap 15.2 is selected from the GRUB menu two errors are returned: "can’t find command ‘linuxefi’ and can’t find command ‘initrdefi’. Pressing any key to continue cycles back to the GRUB menu. (https://photos.app.goo.gl/5YWyVUqvaJKN5sWH6)
    2b. When Windows Boot Manager is selected from the GRUB menu “error: invalid signature” is returned. Pressing any key to continue cycles back to the GRUB menu. (https://photos.app.goo.gl/vYZA9oTrQbA9BPzQ9)

Could this situation have something to do with Window Fast Boot setup (shot in the dark here) or does it seem like it’s related to openSUSE?

Any ideas? I feel like we’re close to solving this whole Legacy to UEFI situation.

Thank you.

Just an update on this post. I booted the system the old way and installed the two needed packages. Then I restarted in UEFI mode from the installation media and completed all the steps in rescue mode including:


mount --bind /run /mnt/run
mount --bind /tmp /mnt/tmp

After restart with BIOS set to Hard Drive first and Boot Manager second I’m not able to log into openSUSE or Windows from the GRUB menu. Details are outlined in my previous post.

When running windows, try holding the shift key while clicking “Restart”.

That should give you a choice to boot from a device. When you select that choice, is there an option to boot opensuse (or opensuse-secureboot)? If there is, try that option.

Hi, there is no opensuse option after holding the Shift key and clicking Restart in Windows. Options available are shown here https://photos.app.goo.gl/ZXrZzTer6uT2Y84A8 and here https://photos.app.goo.gl/2UxT73TAcpyAMbDV7

After selecting “use a device” on the first screen and “Hard Drive” on the second screen the machine goes to the GRUB menu but it’s impossible to get into opensuse or windows from there. Same errors as before.

Any other ideas?

It looks as if it still wants to use legacy booting. It recognizes that USB device for UEFI booting, but apparently it doesn’t recognize anything else except perhaps Windows.

It might be one of those computers with a broken implementation of UEFI that only works properly for Windows.

Can you boot linux with UEFI (could be from USB or DVD), and give us the output from

efibootmgr -v

There’s no need to mount any disks for that. It is just giving information about what the firmware knows.