10

I am trying to set up Windows 8 and Arch Linux on a new Sony Vaio E14 with preinstalled windows 8.

So far:

  • installed W8 to my new SSD (switched for the original HDD) using Recovery Media
  • shrunk the W8 partition, deleted recovery partition, disabled swap
  • confirmed W8 booting just fine

On to Arch:

  • disabled Secure Boot in bios
  • confirmed W8 booting just fine
  • Booted Arch off the CD and installed everything to 4th and 5th partition
  • set up rEFInd for EFIstub kernel bootloader

After that it got worse. I was unable to boot anything else than Windows 8 (although I was glad that they at least kept working just fine).

Tried:

  • creating EFI\refind\ and putting the .efi there (as per Arch manual
  • overwriting EFI\boot\bootx64.efi
  • overwriting EFI\Microsoft\Boot\bootmgr.efi
  • overwriting EFI\Microsoft\Boot\bootmgfw.efi --- YAY rEFInd shown up!

So far, so good. I've kept the whole W8 Boot\ directory in EFI\windows8 and set up a boot menuentry for it; and it booted just fine.

But, upon restart, everything was wrong -- 'Operating system not found' instead of any bootloader (refind or w8).

Booted back into Arch using the live CD to find out that the EFI partition had erroneous FAT table. fsck.vfat fixed it, and I've found that EFI\Microsoft\Boot was back to it's original state (all refind files deleted and replaced with W8 bootloaders). I've overwritten them again and got back to rEFInd showing up correctly and Arch being perfectly bootable.

After that I've tried only renaming EFI\Microsoft\Boot\bootmgfw.efi to bootmgfw.001.efi (then copying refind's .efi to bootmgfw.efi and keeping EVERY OTHER file as it was), but with exactly the same result. Tried marking the GPT EFI partition as read-only, same result.

Now I'm kinda out of luck. Arch boots fine, so does W8 but it destroys the EFI partition in the process.

Thanks for any ideas, Googling brought me this far and I can't find any better.

PS -- windows 8 MAYBE destroys the partition upon shutdown -- when I order a shutdown in W8, it takes unusually long (about half a minute instead of ~5 seconds). So in theory I could solve this by hard-resetting the laptop instead of a normal shutdown, but that's just not nice.

3
  • I'm afraid I can't help here, I don't have a UEFI machine to test stuff. Even though it may not be the most desired way of doing it you may try adding a Linux entry to the Windows bootloader and boot off there, but I haven't tried that in a UEFI machine. See here for the procedure: superuser.com/a/499652/18050 Also, I always use Archboot to install Arch, give it a shot if you're using the official images because the installation takes UEFI systems into account: bbs.archlinux.org/viewtopic.php?id=150833
    – Xandy
    Commented Nov 5, 2012 at 11:52
  • This sounds like a conflict between Arch Linux and something that Windows 8 does. Have you tried another distro to rule its just not Arch Linux which has the problem?
    – Ramhound
    Commented Nov 5, 2012 at 12:51
  • Thanks for the easyBCD suggestion, I'll definitely give that a try. I don't care what boot manager is being used, so if Windows can do that I'll be more than happy. Will post results tomorrow when there's free time from work again to mess something up :) @Ramhound it would be kind of a pain at this moment and I don't think it's related to Arch -- rEFInd is a separate project and I've installed it all by hand (following the man).
    – itchy355
    Commented Nov 5, 2012 at 13:22

1 Answer 1

5

It might be worth doing a cold shutdown (hit the power button) in Windows to see if you can boot afterwards, just as a test. Obviously you wouldn't want to do this on a regular basis, but it might be helpful to confirm that Windows is overwriting your revised ESP data. If it's actually damaging the filesystem on Windows shutdown, then this sounds like a Windows bug that should be reported to Microsoft. If it's just replacing the bootmgfw.efi file, then that's technically within Microsoft's purvue, so it's not really a bug.

More broadly speaking, though, have you tried using linux's efibootmgr program to register rEFInd with the EFI under its own name (say, EFI/refind on the ESP)? This is described in rEFInd's documentation, in the section on manual Linux installation. Alternatively, you could install using the install.sh script. Either method will require an EFI-mode boot to succeed, but you should be able to do this using a rEFInd CD or boot from an emergency disc in EFI mode.

If efibootmgr doesn't work, try using bcfg in an EFI shell program, as described on this Arch wiki page.

If these procedures don't work, try using efibootmgr or bcfg to remove the entry for bootmgfw.efi from the NVRAM and then install rEFInd as EFI/BOOT/bootx64.efi. In theory, the computer might then launch rEFInd, which should work normally and enable booting either OS. There are two potential gotchas, though: The firmware might favor EFI/Microsoft/boot/bootmgfw.efi over EFI/BOOT/bootx64.efi; and Windows might check its boot options and add its own boot loader back to the NVRAM when it boots. Still, this method is worth a try.

The EFI spec requires computers to honor their NVRAM settings (which are managed by efibootmgr in Linux, bcfg in an EFI shell, or similar programs), so if these utilities don't work, your firmware is broken, and you may want to consider returning the computer for another model. (Be sure to tell Sony why you returned the computer if you do so, though!) This type of problem is actually fairly common; I've got a Gigabyte board with a "Hybrid EFI" that keeps forgetting its NVRAM settings, for instance. At least with this board, though, it's possible to bypass the problem by naming my boot manager/loader of choice EFI/BOOT/bootx64.efi.

If you can't get it working and are unwilling or unable to replace the computer, I do have two other suggestions for workarounds:

  • You could keep a bootable CD or USB flash drive on hand with rEFInd on it, and use it when you want to boot Linux. This may require using a function key to tell the computer to boot from the removable media rather than from the hard disk whenever you boot, though.
  • You could wipe the partitions from the disk, repartition using MBR, and re-install both OSes in BIOS mode rather than in EFI mode. This will remove any EFI flakiness from the picture and enable you to use a BIOS-mode GRUB as your boot loader. This will probably require a retail copy of the Windows 8 installer, though; at least for Windows 7, the OEM copies were inflexible about the installation mode (BIOS vs. EFI). Alternatively, it may be possible to convert from an EFI-mode boot to a BIOS-mode boot without re-installing. The opposite switch is possible (I was going to post a link to a site where it's described, but this site won't let me post more than two links; sorry), and I seem to recall running across descriptions of doing an EFI-to-BIOS conversion somewhere, but I don't have a URL handy. A Google search may turn something up.

I stumbled across this page after posting my first answer, and it has another possible cause for at least part of your problem: Apparently Windows 8 uses a shutdown method that's more akin to a suspend-to-disk operation. The result is that mounted partitions can become corrupted if you shut down Windows and then boot Linux. Although the ESP isn't normally mounted in Windows 7, AFAIK, it could be that Windows 8 does things differently, or maybe the ESP is mounted in Windows 7 and just seems to be hidden. In any event, you can disable this feature of Windows 8 by typing the following command in an Administrator Command Prompt window:

powercfg /h off
6
  • Indeed, windows 8 don't break anything when cold shutdown. I don't feel like posting an error, because after all I'm the one messing up their bootloader :)
    – itchy355
    Commented Nov 14, 2012 at 15:36
  • I've tried messing around with the efibootmgr; it shown that there's an unusually high number of bootmanagers (more than the 3 I'd expect), which led me to looking on my disk better; and I've found that in fact I have two EFI partitions :-x Only the second one (/dev/sda2) was shown up as an EFI system partition in GDisk, so that made me think it's the correct one. The other one is just a FAT partition (sda1) with the same size and standard EFI file structure.
    – itchy355
    Commented Nov 14, 2012 at 15:40
  • If I change the boot order to load rEFInd first, then something called ,,sony original'' and then others, it overwrites itself back to default (windows, sony original, others (refind)) PS; that all being said considering that ,,windows'' is my overwritten bootmgfw.efi
    – itchy355
    Commented Nov 14, 2012 at 15:41
  • 1
    In the meantime, I've tried the powercfg /h off in w8, and THAT FIXED W8 BREAKING THE EFI PARTITION..that's the holy grail I've been looking for, it seems :) THANKS THANKS THANKS!
    – itchy355
    Commented Nov 14, 2012 at 15:54
  • I'm glad to hear that powercfg /h off fixed your main problem. You may be interested to hear that I've run across information that some UEFI implementations seem coded to move a boot loader called "Windows Boot Manager" to the top of their lists. Thus, renaming your boot loaders using efibootmgr may enable you to install rEFInd (or whatever you like) under a more sensible filename.
    – Rod Smith
    Commented Nov 15, 2012 at 4:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .