Sony VAIO Pro and UEFI booting

To follow up up on the previous post concerning my new Sony VAIO Pro 13 laptop (initial installation and setup, wifi), where I mentioned problems with booting due to UEFI strangeties, here now a more detailed analysis. Unfortunately, there is no real solution on the horizont.

Vaio Pro 13

Preliminaries

As mentioned here, one has to copy the file /boot/efi/EFI/debian/grubx64.efi to /boot/efi/EFI/Boot/bootx64.efi. Failure to do this will result in Windows remaining stubbornly the OS to be booted.

Ideal working of the EFI boot loader …

Using the efibootmgr command one can inspect the (supposed) setup of the UEFI boot system. Doing this after an upgrade or installation of grub-efi-* package results in something looking like:

BootCurrent: 0007
Timeout: 3 seconds
BootOrder: 0001,0005,0007,0008,0000,0009,000B,000A,0002
Boot0000* Windows Boot Manager
Boot0001* debian
Boot0002* grub
Boot0005* Sony Original
Boot0007* Windows Boot Manager
Boot0008* Windows Boot Manager
Boot0009* Windows Boot Manager
Boot000A* Windows Boot Manager
Boot000B* Windows Boot Manager

The output of this program shows the following information:

  • the currently booted stub, nr. 7 in this case
  • the timeout the efi boot manager should be shown (3sec)
  • the list of stub indices which will be tried in turn to boot the machine
  • the actual stubs ordered by index

In our case this would indicate that from next boot on the Debian bootloader (number 0001) is used. That would be perfect, no complication needed.

… and dire reality

Unfortunately, rebooting once – and here I mean rebooting directly back into linux, not booting Windows in between – results in a change of the boot loader setup. We end up with the following output of efibootmgr:

BootCurrent: 0007
Timeout: 3 seconds
BootOrder: 0005,0007,0008,0000,0009,000B,000A,0002,0001
Boot0000* Windows Boot Manager
Boot0001* debian
Boot0002* grub
Boot0005* Sony Original
Boot0007* Windows Boot Manager
Boot0008* Windows Boot Manager
Boot0009* Windows Boot Manager
Boot000A* Windows Boot Manager
Boot000B* Windows Boot Manager

Huu, what has happened? The original Sony boot loader (nr. 5) was put in front of the boot order, followed by the Windows boot loaders, and only at the end there are the other boot loaders (from debian and my own trial named grub).

Consequence for linux booting

Looking at the verbose output of efibootmgr by adding the -v option, one can see the actual paths used to locate the EFI stubs (output slightly shortened and unique ids removed):
BootCurrent: 0007
Timeout: 3 seconds
BootOrder: 0005,0007,0008,0000,0009,000B,000A,0002,0001
Boot0000* Windows Boot Manager HD(3,...)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS..
Boot0001* debian HD(3,...)File(\EFI\debian\grubx64.efi)
Boot0002* grub HD(3,...)File(\EFI\grub\grubx64.efi)
Boot0005* Sony Original HD(1,...)File(\EFI\Microsoft\Boot\bootmgfw.efi)
Boot0007* Windows Boot Manager HD(3,...)File(\EFI\Boot\bootx64.efi)
Boot0008* Windows Boot Manager HD(5,...)File(\EFI\Boot\bootx64.efi)
Boot0009* Windows Boot Manager HD(5,...)File(\EFI\Boot\bootx64.efi)
Boot000A* Windows Boot Manager HD(5,...)File(\EFI\Boot\bootx64.efi)
Boot000B* Windows Boot Manager HD(5,...)File(\EFI\Boot\bootx64.efi)

My guess is that the HD(3,...) identifies the partition of the hard drive. Looking at the boot order I would guess that first the file /EFI/Microsoft/Boot/bootmgfw.efi (index 5, Sony Original) from /dev/sda1 is loaded. The file is actually there, but it seems to chain load to the boot stup on partition 3, file /EFI/Boot/bootx64.efi in some way (otherwise we couldn’t get grub to take over!).

An additonal observation is that the Timeout seems not to be honored. All this suggests that the UEFI implementation from Sony is not honoring the EFI standard in the following respects:

  • boot timeout not honored, no UEFI boot manager menu shown
  • whatever is set up as first boot, it is reset so that the Sony Original followed by all the Windows boot entries are used first

And as a consequence:

Never forget to update the file /boot/efi/EFI/Boot/bootx64.efi immediately after the grub-efi-amd64 package has been updated.

What else can we do?

I am researching some grub hooks and crooks to automate this update, but haven’t found anything that might help, but I am not a grub master. In case anyone has some good suggestions, please let me know!

Another idea I found on this Microsoft Technet entry is using BCDedit on Windows to adjust the boot parameters and path. But I haven’t tried that yet.

Useful information concerning booting Debian with grub-efi I found here: http://tanguy.ortolo.eu/blog/article51/debian-efi.

5 Responses

  1. Simon Shine says:

    Hi there

    Thanks a lot for all the groundwork on this otherwise nice-looking laptop. I’ve had the same experience as you and have not come up with a way to get persistent dual booting (or even the ability to persistently boot Linux). I’ll keep looking.

    Simon

    • Hi Simon,

      thanks for your comment. I at least got reliable booting, but I have to remember to update the boot loader file any time grub is updated.

      See my most recent post in tag VAIO for an explanation.

      Let me know if I can help anything more!

      Norbert

  2. Jay Philips says:

    Thanks for the information but unfortunately it didnt work for me on my Sony Vaio Series S 13 (svs13125cab). For me the only thing that worked was step 7 from this zdnet guide ( http://www.zdnet.com/article/seven-ways-to-set-up-multi-booting-with-windows-8-and-linux/ ) of copying /boot/efi/EFI/ubuntu/grubx64.efi to /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi (i renamed the original bootmgfw.efi to bootmgfw-.efi, so that i could still boot into windows 8 from grub). After booking in, attempting to change the efi booting order with efibootmgr wouldnt fix the issue.

    • Hi Jay,
      thanks for the feedback. I agree that the whole procedure is fragile, and I can easily guess that Sony changes there firmware in ways that breaks everything again.

      I think what you need to do is the following:

      • reboot into Windows
      • boot into Linux, best into single-user mode without and program playing around with the boot manager
      • run efibootmgr -v to see which paths are actually searched

      what I have described in the last part of the document. Hope that helps.

      • Jay Philips says:

        Hi Norbert,

        Thanks for the quick reply. Didnt quite get what you meant by step 1 and 2. With my current setup of replacing bootmgfw.efi, i can boot into windows from grub, but there isnt anyway to boot into linux from within the windows bootloader. How does one boot windows into single-user mode?

        Regarding BCDEdit mentioned in the blog post, i tried using the GUI tools EasyBCD, EasyEUFI and Visual BCD to create or modify the necessary BCD entry to boot into linux from the windows bootloader, but all failed with the “Windows Failed to Boot” error screen. Sony doesnt have a uefi bootloader which would allow to boot a separate OS. This person is having the same problem ( http://superuser.com/questions/777634/error-0xc000007b-when-trying-to-start-efi-ubuntu-shimx64-efi-ubuntu-through-w ), but luckily he does have a uefi bootloader.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>