1

I have a Sony VAIO PC (specifically, model SVS1511T9ES), with original Windows 7 Pro installed. I tried to install Ubuntu 16.04 for dual-boot setup, but every time I reboot, I'm only getting Windows; no GRUB menu. (With one non-Windows non-GRUB exception, see p. 14. below)

Notably:

  • my BIOS has boot mode set as "UEFI",
  • apparently no "Safe boot" settings in BIOS (didn't see anything like that anywhere),
  • I'm booting Ubuntu 16.04 installer from a live USB (I don't use 18.04 because it failed to start from USB for me),
  • I didn't try upgrading BIOS because I'm scared I could brick the PC. In the top line of the screen, my current BIOS configurator claims to be InsydeH2O Setup Utility, top-right corner shows Rev. 3.7

Specifically, what I tried till now, to the extent I still remember:

  1. Free up some space on Windows, run defragmentation, then downloaded & run "Free AOMEI Partition Assistant" to shrink the partition (pure Windows tools weren't good enough because pagefile.sys was blocking the shrinking). Notably, this created some "WinPE" stuff and required a reboot to finish its work.
  2. After this, Windows booted successfully and seems to be working, with extra space freed.
  3. I run Ubuntu 16.04 LiveUSB ISO from a pendrive. Chosen "Install". Picked "Custom" partitioning, because I don't want a swap partition (I'm hoping to use a swap file if necessary and possible). Finished installing Ubuntu, looked OK.
  4. After reboot, no GRUB, just "Windows is starting up..." and normal Windows boot.
  5. Hrmh, ok, booted back to the LiveUSB and tried running boot-repair. Clicked the "backup" first and saved to some dir in the new Ubuntu partition on the disk. Then reviewed settings, did not change anything I believe, clicked OK or whatever; didn't upload the log to pastebin (but seems to be saved on the EFI partition anyway); got some long report, generally stuff seemed ok; reboot.
  6. After reboot, no GRUB, just Windows again.
  7. Hrmrh; ok, now tried bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi (on Windows). Reboot.
  8. After reboot... you know the drill. Just Windows. (By the way, I must say I'm genuinely very happy that this part with preserving Windows is working so well. I recall this being much, much worse in ye olden Slackware days. So big thanks for all good people for this :D)
  9. Notably, running bcdedit on Windows seems to show that the path was indeed changed to \EFI\ubuntu\..., it still shows as such. Anyway, I tried bcdedit ......\grubx64.efi now. Reboot.
  10. After reboot... Windows. And bcdedit still shows grubx64.efi.
  11. Uhmh. Ok; I'm not sure what more I can do, so I'm starting to write the Askubuntu question. A related question shows up. Ok, let's see what efibootmgr will show.
  12. Boot back to LiveUSB;

    ubuntu@ubuntu:~$ sudo efibootmgr -v
    BootCurrent: 0000
    Timeout: 2 seconds
    BootOrder: 0000,0002
    Boot0000* EFI USB Device    PciRoot(0x0)/Pci(0x14,0x0)/USB(4,0)/HD(1,MBR,0x4294967285,0x800,0x1ce7800)RC
    Boot0002* Windows Boot Manager  HD(2,GPT,a6098758-cdae-433d-87ce-ab327609a343,0x2b7d000,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
    

    Ok, here things seem to start getting somewhat weird. This command seems to show a different path than bcdedit on Windows, namely \EFI\Microsoft\Boot\bootmgfw.efi, i.e. what was originally set in bcdedit before I changed it. But bcdedit seems to still show grubx64.efi.

  13. I tried boot-repair again. I thought I'm just clicking and unclicking "Advanced", but apparently I may have accidentally clicked the "rename Windows ..." option. This time I have a pastebin log. Out of curiosity, I run the efibootmgr -v again and got:

    ubuntu@ubuntu:~$ sudo efibootmgr -v
    BootCurrent: 0000
    Timeout: 2 seconds
    BootOrder: 0001,0000,0002
    Boot0000* EFI USB Device    PciRoot(0x0)/Pci(0x14,0x0)/USB(4,0)/HD(1,MBR,0x4294967285,0x800,0x1ce7800)RC
    Boot0002* Windows Boot Manager  HD(2,GPT,a6098758-cdae-433d-87ce-ab327609a343,0x2b7d000,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
    

    Note that BootOrder is different here: it has a 0001 first, but there's no such entry on the list below (no Boot0001). Notably, the boot-repair log seems to have ~3 efibootmgr calls, and the last one of them does seem to show a Boot0001 entry. Why does it disappear later? Does the subsequent grub call erase it, or what???

  14. Reboot and... weird stuff! I cannot recall well, but instead of "Windows is starting up...", I got some 4 text lines describing some boot error; notably, it was complaining about a missing file at a weird path more or less like: \EFI\Microsoft\Boot\grubx64.efi (note there's both Microsoft and grub there).

  15. Hm. Wierd. Hmhm. Maybe this nudged things in some way? — I thought to myself. Reboot again to LiveUSB. efibootmgr seems to show 0000,0002 now. Run boot-repair again, now just clicking the initial "Recommended recovery" button, and this time again saving the log. The efibootmgr -v again shows 0001,0000,0002. Reboot.
  16. After reboot, "Windows is starting up..."....................
  17. Hilfe! :( Ok, sit down, finish writing this Askubuntu call for help.

Some things I observed on the way, which may or may not be related: - I seem to have 2 partitions with an "EFI" directory. One of them has the ubuntu dir (I think this is /dev/sda2); the other one seems to be a "Windows recovery partition", and it seems to have no ubuntu dir. Weirdly, it has both an "EFI" and "efi" dirs in root path (don't remember which sda is this). - If I write bcdedit /enum all on Windows, I get a lot of stuff, and notably one of them seems to be related to the AOMEI tool I used, with a ramdisksdipath \Aomei\AomeiBoot.sdi. I suspect it is not relevant, but mentioning it just in case.

So — any ideas what can I try next, to get GRUB to show up?

akavel
  • 351
  • Jeez! Go into your BIOS/UEFI. What is exactly listed/being shown in the boot order?? – Paul Benson Jul 13 '18 at 18:24
  • @PaulBenson The lines below Boot Priority are exactly: Internal Optical Disc Drive / External Device / Internal Hard Disk Drive / Network – akavel Jul 13 '18 at 19:09

1 Answers1

0

Woohoo, finally got it to work in another try!

So, generally, I booted again to the LiveUSB and run boot-repair, but this time I crossed my fingers and deliberately clicked the "Rename something something Windows files something something" option. Then continued, and then did one extra step:

$ sudo mount /dev/sda2 /mnt/boot-sav/sda2
$ sudo cp /mnt/boot-sav/sda2/EFI/ubuntu/grub* /mnt/boot-sav/sda2/EFI/Microsoft/Boot/

to try and please the failure mode from p. 14. Reboot — lo and behold, got GRUB! It has a few too many options for me, but the first is Ubuntu, and some subsequent one mentions Windows, and the first one does boot to Ubuntu, while the other does boot to Windows. So, seems I'm a happy kid now! :) And hoping it will keep working alrite...

I'd like to hereby thank, in no particular order: askubuntu and stackexchange for recently being my favorite and most successful rubber-duck-debugging venue; authors and contributors of boot-repair; authors and contributors of Ubuntu and the Linux kernel; good people asking and answering questions on askubuntu, superuser, stackoverflow &c., who helped me get through the above 16 points in the original question.


EDIT: My current EFI partition looks like this (after filtering out noise):

/boot/efi$ for f in $(find -type f | egrep -v '/boot-repair/log/|\.mui$|\.ttf$'); do printf "% 10d %s\n" $(stat -c%s $f) "$(md5sum $f)"; done
    719808 76c1ab75037265cbe84a872c44ddcec2  ./EFI/Microsoft/Boot/bootmgr.efi
    674536 2fa828b3ba4fd8e25d8e510d56289fb5  ./EFI/Microsoft/Boot/memtest.efi
     65536 f43c0811ca251234dc4a2071ca6bcfa1  ./EFI/Microsoft/Boot/BOOTSTAT.DAT
     32768 9acb266f0ed4efdecbb408cd753f9b2e  ./EFI/Microsoft/Boot/BCD
     29696 dab9a8f88d73984dccb4a890efda05f6  ./EFI/Microsoft/Boot/BCD.LOG
         0 d41d8cd98f00b204e9800998ecf8427e  ./EFI/Microsoft/Boot/BCD.LOG1
         0 d41d8cd98f00b204e9800998ecf8427e  ./EFI/Microsoft/Boot/BCD.LOG2
    722880 b4041c77d7f10c36861203da493662ef  ./EFI/Microsoft/Boot/bkpbootmgfw.efi
   1196736 6e94c3d33194c89bd327bfaa5871e294  ./EFI/Microsoft/Boot/bootmgfw.efi
         0 d41d8cd98f00b204e9800998ecf8427e  ./EFI/Microsoft/Boot/bootx64.efi.grb
   1196736 6e94c3d33194c89bd327bfaa5871e294  ./EFI/Microsoft/Boot/bootx64.efi
       126 69c7bcf29f79cf74e8ac2f6c7f5d16ed  ./EFI/Microsoft/Boot/grub.cfg
   1133944 a0d970cee526c304209c20f0a1ec6452  ./EFI/Microsoft/Boot/grubx64.efi
    722880 b4041c77d7f10c36861203da493662ef  ./EFI/Boot/bkpbootx64.efi
   1196736 6e94c3d33194c89bd327bfaa5871e294  ./EFI/Boot/bootx64.efi
     67536 82894bcbe4f010664226ba7591372538  ./EFI/ubuntu/fwupx64.efi
   1133944 a0d970cee526c304209c20f0a1ec6452  ./EFI/ubuntu/grubx64.efi
       126 69c7bcf29f79cf74e8ac2f6c7f5d16ed  ./EFI/ubuntu/grub.cfg
   1196736 6e94c3d33194c89bd327bfaa5871e294  ./EFI/ubuntu/shimx64.efi
   1153336 d5a2dfd48441834f97d7ab8e3c26ba0f  ./EFI/ubuntu/mmx64.efi

Notably, all of the below seem to be the same file, the shimx64.efi:

  • EFI/Microsoft/Boot/bootmgfw.efi
  • EFI/Microsoft/Boot/bootx64.efi
  • EFI/Boot/bootx64.efi
  • EFI/ubuntu/shimx64.efi
akavel
  • 351
  • From UEFI are you still booting a Windows entry? But that now boots Ubuntu? If so that was what we suggested years ago, but found Windows updates overwrite the grub boot and you cannot easily directly boot Windows from UEFI. Grub only boots working Windows and when it turns fast start up back on with updates or needs chkdsk, you have to directly boot Windows to make repairs. Other alternatives. Sony, HP & others workarounds: http://askubuntu.com/questions/486752/dual-boot-win-8-ubuntu-loads-only-win/486789#486789 Make sure you have Windows repair flash drive. – oldfred Jul 13 '18 at 19:47
  • @oldfred Yes, apparently. The answer with options that you linked at https://askubuntu.com/a/486789/111779 is not really clear to me: how do I-IV differ from what I did above with boot-repair? They all seem to also replace some existing EFI files, no? – akavel Jul 13 '18 at 20:37
  • It is which efi boot files. Not exactly sure which you changed. Usually we do not copy anything into /EFI/Microsoft folder. But most systems will boot a fallback or hard drive entry at /EFI/Boot/bootx64.efi. So now Boot-Repair even copies shimx64.efi to /EFI/Boot and renames it to bootx64.efi to allow hard drive boot to work. Many UEFI violate UEFI standard that says NOT to use description as part of UEFI boot. And of course only valid description is "Windows Boot Manager". – oldfred Jul 13 '18 at 20:43
  • @oldfred Hmmm; in such case how can I force the UEFI to go straight to the "fallback", skipping the "Windows" one? By tweaking the BootOrder in efibootmgr? I'm willing to try (though in 1h I must go to sleep, back late tomorrow). Alternatively, it's also not clear to me where rEFInd fits in this whole thingamaboo either...? edit: would you be willing to discuss more on AU/SO chat or via email? – akavel Jul 13 '18 at 20:50
  • Grub is both a boot manager (menu) and boot loader. Now UEFI is also a boot manager. Some like rEFInd as a boot manager as it is graphical, used a lot with Mac, but also some systems that do not like ubuntu. It is a third party boot manager, not part of Ubuntu. Some systems also do not keep an efibootmgr change to boot order, but using UEFI it may stay changed. – oldfred Jul 13 '18 at 22:10