Skip to content

Instantly share code, notes, and snippets.

@oscarkraemer
Created November 19, 2017 20:15
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarkraemer/c8747fbc85e7f908dcc00b4357fb04b2 to your computer and use it in GitHub Desktop.
Save oscarkraemer/c8747fbc85e7f908dcc00b4357fb04b2 to your computer and use it in GitHub Desktop.
Linux UEFI boot on Lenovo m91p
# http://www.rodsbooks.com/linux-uefi/
# 1. Install Linux normally
# 2. Boot from Linux live usb drive
# 3. Most likely /dev/sda1 but it can be something else:
mount /dev/sda1 /mnt
mkdir -p /mnt/EFI/Microsoft/Boot
# 5. Depending on if it is ubuntu, centos or any other distro:
cp /mnt/EFI/centos/grubx64.efi /mnt/EFI/Microsoft/Boot/bootmgfw.efi
# I don't remember but I think it was like this.
7 efibootmgr --create --label "Windows Boot Manager" --loader "\EFI\Microsoft\Boot\bootmgfw.efi"
@kenske
Copy link

kenske commented Aug 19, 2022

This saved me today, thanks!

@HyRaxAus
Copy link

This also worked for me for getting a Clonezilla'ed UEFI 64-bit Linux image onto an old ThinkCentre that had UEFI support but no Secure Boot, no CSM and no way to specify the boot loader - oddly enough, you can edit the list and boot order via efibootmgr but it's completely ignored by BIOS. The BIOS appears to be literally hard-coded to look for the UEFI Windows Boot Manager only!

@eribertomota
Copy link

eribertomota commented Jun 9, 2023

Today, I posted the following instructions at https://gist.github.com/vees/b3fb1e5b62da155a006831c16eaac8e8#gistcomment-4594603

Note that is not needed to create a Microsoft directory.

I hope this help.


I am doing some tests around a Lenovo ThinkCentre M91p with Windows 10 / Debian 12 (Bookworm) to write a specific technical document about EFI boot.

Considering a dual boot, I installed Windows and, after this, Debian. The machine stopped to start, showing the error "1962: No operating system found". Thus, I did the boot using a flash drive with "Ventoy"[1] and rEFInd[2] on Ventoy (is needed to write the Ventoy ISO to the flash drive using dd or dcfldd and the ISO image of rEFind inside of Ventoy partition). rEFInd is able to read the \EFI partition and to boot any system found there. I booted the Debian.

[1] https://www.ventoy.net/en/download.html
[2] https://sourceforge.net/projects/refind/

On Debian, I set a label for the Debian/GRUB as "Windows Boot Manager" (Lenovo M91p always searches for this label) and I set the boot order to Debian only. On Debian I also made an update-grub to add the Windows to GRUB. My Debian is set as Boot0001 (the command # efibootmgr will show this information), so Debian = 0001. The following commands were used:

  • To remove the current Debian entry (see # efibootmgr -v):

# efibootmgr -b 0001 -B

  • To rewrite the Debian entry:

# efibootmgr -c -d /dev/sda -p 1 -l '\EFI\debian\grubx64.efi' -L "Windows Boot Manager"

  • To set 0001 as the main system in the BootOrder field.

# efibootmgr -o 0001

  • To test:

# reboot

A simple command reference: https://www.linuxbabe.com/command-line/how-to-use-linux-efibootmgr-examples

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment