Ubuntu – GRUB menu does not show after shutting down and restarting from Ubuntu on a Sony Vaio with pre-installed Windows 8 dual-booted with Ubuntu

bootdual-bootgrub2uefivaio

I have installed Ubuntu 15.04 with Windows 8 on my Vaio. When I shut down from Windows and start the laptop, I get the GRUB menu and can select between booting with Windows and Ubuntu. However, after I shut down from Ubuntu and start, directly Windows opens.

How can I fix this?

Here’s how I installed Ubuntu:

  1. I used a 64-bit iso.
  2. I disabled Fast Startup and hibernation in Windows.
  3. I left SecureBoot enabled while installing Ubuntu in UEFI mode. I
    set Secure Boot Mode to ‘Custom’ in the BIOS Settings.
  4. I created free space for Ubuntu from within Windows.
  5. While installing from a LiveUSB, I manually created partitions for
    /, /home and swap. I did not create a /boot partition.
  6. I selected the ‘Device for bootloader information’ as the only hard
    disk on my laptop. I did not select a specific partition. Also, I
    did not create an EFI System partition as described in Ubuntu UEFI
    Guide because it recommends having only one ESP per disk.

Dual Boot did not work. Then, I disabled SecureBoot and ran the following command on Windows:

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

And the GRUB menu started showing every time after I had shut down from windows. But whenever I shut down from Ubuntu and start, it directly boots Windows.

I did consult the following threads and pages:

How to fix dual-booting Windows 8 and Ubuntu 14.04 on a Sony Vaio?,

Ubuntu UEFI Guide,

Installing Ubuntu Alongside a Pre-Installed Windows with UEFI

Here are some of the possible solutions I found and need advice on which of them to try:

  1. Reinstall Ubuntu and this time create a /boot partition. Then run Boot Repair.

  2. manually copy the ubuntu Boot directory in place of the \EFI\Boot Directory, and rename shimx64.efi to \EFI\Boot\bootx64.efi (not \EFI\Microsoft\Boot\bootmgfw.efi ), like in this guide: http://www.slideshare.net/Tinydile/vaio-pro13-win8ubuntu1310uefi.
    (I’ve never used xTerm or rEFInd. So I do not understand what the commands in this guide are exactly for and whether this guide solves the problem.)

Can somebody please explain what is causing this problem and how I should fix it? I'm confused because dual-boot does work, just not straight after shutting down from Ubuntu.
Thank you in advance.

Best Answer

  • Sony VAIOs are pretty notorious for having flaky firmware. I recommend you first check Sony's site for an update and, if one is available, install it.

    If that doesn't help, start investigating your firmware boot order options using efibootmgr in Ubuntu. You'll see something roughly like this:

    $ sudo efibootmgr
    BootCurrent: 0000
    Timeout: 0 seconds
    BootOrder: 0000,0003,0007,2003,0001,2001,2002
    Boot0000* rEFInd (direct)
    Boot0001* Lenovo Recovery System
    Boot0003* ubuntu
    Boot0007* Windows Boot Manager
    Boot2001* EFI USB Device
    Boot2002* EFI DVD/CDROM
    Boot2003* EFI Network
    

    The details will differ, of course. Look at the BootCurrent and BootOrder lines; the numbers refer to the various Boot#### entries. In this example, the BootOrder is set to rEFInd (direct) first, followed by ubuntu, and so on; and the system actually booted (BootCurrent) via rEFInd. Note that the numbers are actually hexadecimal, although this example doesn't show any over-9 digits.

    Compare the output of this command when you reboot from Windows vs. when you reboot from Ubuntu. Does the BootOrder change depending on how you boot? Also, does rebooting from Windows automatically change the BootOrder back (and fix the boot-time behavior)?

    If the BootOrder is changing, you might try setting it back to the way it should be in Ubuntu. Use the -o option to efibootmgr, as in:

    sudo efibootmgr -o 0,3,7
    

    Change the numbers to match your Boot#### options, of course. If this works on a one-time basis, you can create a shutdown script to do it automatically every time you shut down, as described here:

    Execute a script upon logout/reboot/shutdown in Ubuntu

    If that doesn't help, then there are possible solutions that involve renaming and moving boot loader files. Boot Repair can do this semi-automatically via an option on its Advanced menu (I don't recall the exact name, though; it's something to do with backing up and renaming files). I'd use this option only as a last resort, though; it's an ugly hack that doesn't always work and that can create confusion down the road if/when you need to re-install an OS or otherwise manipulate the boot loaders.

    I do not recommend re-installing Ubuntu as a solution. It didn't work the first time and it's unlikely to do any better the second time. The presence or absence of a /boot partition is almost certainly irrelevant to your problem.

  • Related Question