(U)EFI Issues

(U)EFI is a neat idea, but the implementations are buggy, to say the least, and when the manufacturer's EFI implementation is not trying to wreck your nervous system, Window$ surely will.

Dual-booting with Windows 10 on an EFI system

Whatever their newest PR campaign is trying to make you believe, Window$ does not really like Linux. in fact Windows does not like any other operating system to be installed. Dual, or multi-booting is not something Window$ would allow for, not out of the box anyway.

When you install Window$, after you've installed Linux (which you should not do anyway, as the other way around always works better), or even after a Window$ update, you might find that you're no longer able to access your Linux installation. This might happen after simply booting into Window$, and restarting the computer. Don't worry, Linux is still there, only "invisible" to you.

A number of things could have happened:

  • Windows 10 has "fastboot" enabled. This prevents the system to go through the proper startup process, and will instead boot into Windows immediately.
  • GRUB was overwritten by Windows boot-loader on a non-EFI system.
  • The boot manager was reset to Windows boot-loader on an EFI system.

Depending on the issue, one of the following solutions might help:

Disable fastboot

Fastboot is a neat feature when you only use Window$. It can really speed up booting the computer considerably. This is because it does not really boot the system, but uses a sort of hibernation state to save a lot of runtime information. Unfortunately, if you want to dual-boot, fastboot is no longer an option.

This being a Linux website, there will be no detailed instructions as to how to do it on Window$, but this detailed tenforums.com tutorial has every possible scenario covered.

(U)EFI: Set the right boot manager from within Windows

Window$ will not respect Debian's boot manager, but fortunately, you can do something about this. Open the application menu and search for cmd.exe, right-click on it, choose Run as Administrator, and type the following command into the command line window that appears:

If you have installed the 64-bit version of Debian:

bcdedit /set {bootmgr} path \EFI\debian\grubx64.efi

or if you have installed the 32-bit verison:

bcdedit /set {bootmgr} path \EFI\debian\grubia32.efi

then press Enter.

You can reboot your computer now, your boot-loader should be restored, and both operating systems should be recognised upon reboot.

Finding the right command

If you are unsure about which command to use, you can use the following simple script to do it for you.

Click here to download the script to construct Winow$ UEFI boot restore command

To run this script, after downloading, just open a terminal, enter the Downloads folder (or your specific download location) by typing

cd ~/Downloads

and pressing Enter.

Once there, you need to unpack the tarball containing the script:

tar -xvf findefi.tar.gz

then to run the script:

  • either become root with either su and type
    bash findefi.bash

    then Enter

  • or as your normal user, type
    sudo sh findefi.sh

    press Enter, give your user password, and press Enter.

Instead of using this standalone script, you can also just download the Way of Linux Admin console app, which provides a convenient collection of scripts, accessible through an easy-to-use menu in your terminal. You can get WLAdmin from the Downloads page

If you're interested how this script operates, you can find the whole code below. You can copy and paste it into an empty text file. Call it anything you like, only make sure you give it the extension .bash or .sh. Name it e.g. findefi.bash

To run it, you would need to open a terminal, and

  • either become root with either su and type
    bash findefi.bash

    then Enter

  • or as your normal user, type
    sudo sh findefi.sh

    press Enter, give your user password, and press Enter.

The code:

if [[ "$(whoami)" != "root" ]]; then

    echo
    echo "You have to run this script as root."
    echo

else

    if [[ -f /boot/efi/EFI/debian/grubx64.efi ]]; then

        echo
        echo "The Windows command to fix the bootloader is:"
        echo
        echo "bcdedit /set {bootmgr} path \EFI\debian\grubx64.efi"
        echo
        echo "Write it down, and type it into a CMD window running as administrator on your Windows installation."
        echo

    elif [[ -f /boot/efi/EFI/debian/grubia32.efi ]]; then

        echo
        echo "The Windows command to fix the bootloader is:"
        echo
        echo "bcdedit /set {bootmgr} path \EFI\debian\grubai32.efi"
        echo
        echo "Write it down, and type it into a CMD window running as administrator on your Windows installation."
        echo

    else 

        echo
        echo "Could not find an efi file I recognise. You should probably run the command"
        echo 
        echo "bcdedit /set {bootmgr} path \EFI\debian\{efifile}"
        echo
        echo "replacing '{efifile}' with one of the following:"
        echo
        ls /boot/efi/EFI/debian/
        echo
    fi

fi