Ubuntu – Windows 8.1 upgrade destroyed the Ubuntu machine

dual-bootgrub2uefiwindows 8

I had Win 8 and Ubuntu 12.04 peacefully coexisting on a Toshiba Portege Z935. EFI mode, Grub2, secure boot off, had to use "recommended repair" on Boot-Repair tool to get the boot working after original Ubuntu install. All happy for about 10 months until….

I foolishly accepted MS's suggestion to update Windows to 8.1. After the upgrade, each boot brought me to a "grub rescue>" prompt. Was able to do a lengthy workaround to get back to grub menu on each boot, but wanted it fixed.

So, I started messing around with Boot-Repair, repeatedly, until the box wouldn't boot at all (just get blacks screen with "Insert disk with command files" or some such).

Tried reinstalling Win 8, upgrade to 8.1, then reinstalling Ubuntu. Same result – wouldn't boot at all. Tried reinstalling 8 without upgrade to 8.1, same result. Tried installing JUST Ubuntu. Same result.

Finally, set box from UEFI to CSM, installed Ubuntu again. Now it boots! So, I'm guessing the UEFI is somehow hosed in the "firmware" by one or more of the actions above.

How to fix? I'm out of ideas, and I want EFI back. THANKS!!!

Best Answer

  • Update: I've updated the script now

    I've created a script to help users boot Windows 8.1 and Linux. I'm afraid it's not a Linux script, but I'm sure you could do a similar thing in linux...

    This script will alter some things in your S:\ partition. You need to run it as administrator.

    Note in this example, I'm using SuSE 12.1 and I'm using two separate HDD with Windows 8.1 on the "Primary" HDD. This is also designed for HP machines, however the HP directory isn't that important, so you can just change 'HP' to whatever other directory you have in your S:\ partition. All I currently have in mine is

    S:\EFI S:\Boot.old

    You will need to download and extract REFind and make sure you've set REFINDSOURCEPATH with where it's located.

    Please do not do this unless you know what you're doing!

    ::Setup Refind script version 04/01
    echo off
    CHOICE /C YN /M "Have you already attempted copy of files since last losing the boot manager? Y/N"
    IF %ERRORLEVEL% EQU 1 SET _FIRSTRUN=Yes
    IF %ERRORLEVEL% EQU 2 SET _FIRSTRUN=No
    echo on
    ::Mount partition
    mountvol S: /S
    ::Set paths
    ::You might want to modify these for your system?
    set REFINDSOURCEPATH=C:\refind-bin-0.7.4\refind
    set REFINDSPATH=S:\EFI\refind
    set SBOOTPATH=S:\EFI\Boot
    set REFINDCONFIG=C:\refind.conf
    ::Rename refind directory if it's already present
    rename %REFINDSPATH% refind.old
    ::Copy to S:\ assuming refind is located at %REFINDSOURCEPATH%
    IF "%_FIRSTRUN%" == "Yes" (
    echo a | xcopy /E %REFINDSOURCEPATH% %REFINDSPATH%
    )
    IF "%_FIRSTRUN%" == "No" (
    echo d | xcopy /E %REFINDSOURCEPATH% %REFINDSPATH%
    )
    ::Rename old boot HP files - we don't need the HP directory!
    rename S:\EFI\HP HP.old
    ::Rename boot directory - we will recreate this ourselves below
    rename  %SBOOTPATH% Boot.old
    ::Stop this file from being detected/set as default boot - this can still be detected by Windows otherwise.
    rename S:\EFI\Boot.old\bootx64.efi bootx64.efi.old
    
    ::Recreate the boot directory
    mkdir %SBOOTPATH%
    ::Put refind into the boot directory
    IF "%_FIRSTRUN%" == "Yes" (
    echo a | xcopy /E %REFINDSOURCEPATH%  %SBOOTPATH%
    )
    IF "%_FIRSTRUN%" == "No" (
    echo d | xcopy /E %REFINDSOURCEPATH%  %SBOOTPATH%
    )
    
    ::Rename/overwrite the file so it will always boot refind
    rename %SBOOTPATH%\refind_x64.efi bootx64.efi
    ::This is a dirty hack to stop Microsoft finding their EFI file and setting as default boot
    IF "%_FIRSTRUN%" == "Yes" (
    copy S:\EFI\Microsoft\boot\bootmgfw.efi S:\EFI\Microsoft\boot\bootmgfw.efiold
    rename S:\EFI\Microsoft\boot\bootmgfw.efi bootmgfw_.efi
    )
    ::This is a dirty hack to stop Microsoft finding their EFI file and setting as default boot
    IF "%_FIRSTRUN%" == "No" (
    ::I'm assuming we don't have to do anything different at this point. Error may be thrown but should not cause issues.
    copy S:\EFI\Microsoft\boot\bootmgfw.efi S:\EFI\Microsoft\boot\bootmgfw.efiold
    rename S:\EFI\Microsoft\boot\bootmgfw.efi bootmgfw_.efi
    )
    
    ::Copy the config file.
    copy /Y %REFINDCONFIG%  %REFINDSPATH%\refind.conf
    ::Set the boot manager (doesn't always work)
    
    bcdedit /set {bootmgr} path \EFI\refind\refind_x64.efi
    echo off
    pause
    
    CHOICE /C YN /M "Press Y to destroy the S:\EFI\Boot.old directory"
    IF %ERRORLEVEL% EQU 1 SET _BOOT=Yes
    CHOICE /C YN /M "Press Y to destroy the S:\EFI\refind.old directory"
    IF %ERRORLEVEL% EQU 1 SET SET _REFIND=Yes
    CHOICE /C YN /M "Press Y to destroy the S:\EFI\HP.old directory"
    IF %ERRORLEVEL% EQU 1  SET _HP=Yes
    
    IF "%_BOOT%" == "Yes" (
    ::Remove the path below
    rmdir /s S:\EFI\Boot.old
    echo "Removing path"
    )
    
    IF "%_REFIND%" == "Yes" (
    ::Remove the path below
    rmdir /s S:\EFI\refind.old
    echo "Removing path"
    )
    
    IF "%_HP%" == "Yes" (
    ::Remove the path below
    rmdir /s S:\EFI\HP.old
    echo "Removing path"
    )
    
    pause
    echo "Pressing a key will restart immediately"
    pause
    
    ::Restart
    shutdown /r /t 0
    

    I get an warning message when EFI is enabled so all you need to do is remove the word "hdbios" out of the configuration file if you have EFI enabled.

    The other part which is important is your config file. As you can see mine is located at C:\refind.conf - that's probably not the most sensible place to put it, but at least you know it won't get erased if you trash anything else by mistake.

    Mine is as follows, but I would suggest that you follow the documentation above to configure yours properly. You can see I use the renamed EFI/Microsoft/boot/bootmgfw_.efi in the configuration file.

    timeout 20
    hideui singleuser
    #hideui all
    #icons_dir myicons
    use_graphics_for windows
    showtools reboot, exit
    scanfor internal,external,optical,hdbios,manual
    dont_scan_volumes ROOT BOOT
    dont_scan_dirs EFI/Boot, Boot
    #scan_all_linux_kernels
    #also_scan_dirs EFI/Microsoft/boot, Microsoft/boot
    
    menuentry Windows8 {
    
        loader EFI/Microsoft/boot/bootmgfw_.efi
        icon EFI/refind/icons/os_win.icns
    
    }
    
    
    menuentry SuSE {
        icon EFI/refind/icons/os_linux.icns
        volume BOOT
        loader \vmlinuz
        initrd \initrd
        options "video=1600x900 splash=silent quiet showopts vga=0x37f root=UUID=201bb438-10b4-49aa-ac1c-4c7d52ad66a0
        splash=silent quiet showopts"
    }
    
    menuentry SuSERoot {
        icon EFI/refind/icons/os_linux.icns
        volume ROOT
        loader /boot/vmlinuz-3.4.11-2.16-desktop
        initrd /boot/initrd-3.4.11-2.16-desktop 
        options "video=1600x900 splash=silent quiet showopts vga=0x37f root=UUID=201bb438-10b4-49aa-ac1c-4c7d52ad66a0
        splash=silent quiet showopts"
        disabled
    }