Windows hibernate… where did my bios options go?

So a couple months ago I acquired a new laptop installed with Windows 7.  Of course, one of the first things I did was install linux on it.  But I did this by shrinking the win7 install to make space for linux.  I figured that it might come in handy one day to run windows, and promptly left the win7 to gather dust.

Well I’ve recently been spending a lot of time back in windows playing with the BWAPI (the subject of a forth coming post).  Because I’ve been doing non-trivial things in windows, I want to hibernate the machine instead of just shutting it down.  To my consternation, I noticed that, after hibernating from windows and then restarting, the bios disabled access to the bios menu and bios boot menu and booted directly to the windows device.  Since I boot my linux from a usb but the windows install is on a harddisk, this is problematic.  Effectively hibernating to windows forces me to resume back to windows.  However, when I shutdown windows and boot back up, the bios menus are re-enabled.

After doing some googling around, i found others with the same problem, but no solution.  Now, I’ve been spending a lot of time learning about my Phoenix UEFI firmware and know that the boot menu can be modified from a UEFI booted machine by modifying the UEFI variables.  So, I could see how a UEFI booted OS could at hibernation change these variables to only boot the device which was being hibernated to and disabling all other firmware access.  The funny thing was that the OEM windows install booted from the MBR and not an EFI bootloader application.  Thus windows was not running under UEFI (actually it is running under UEFI, but in a BIOS compatibility mode) and accordingly could not modify the UEFI variables.

So I started thinking “how is the firmware being modified such that the firmware knows to disabled firmware access and boot directly to the windows hibernated device?”  The first thought I had, was that somehow this information is being stored in ACPI, which I knew only a little about.  After downloading the ACPI spec and reading about the various sleep states, I realized that the hibernate state, S4, does not fully turn off power to the machine.  Yes, the computer looks completely off, no lights or sounds, and even a firmware loading screen is presented on “power on”, but it is sucking tiny bit of energy (see ACPI spec v5 16.1.4).  Somewhere, maybe in some modified ACPI tables but I’m not sure, windows hibernate tells the firmware to just boot directly to the device window hibernated to.

Armed with this knowledge, I decided to see if cutting all power to the machine would change anything.  I hibernated windows, then disconnected AC power and the battery.  When turning the laptop back on the result was the same, no boot options.  Coincidentally, I had been reading my laptop’s service manual about how to replace core components and I remembered that the manual said to ensure that there was no residual power in the system before disassembling.  The manual said to ensure this by removing battery and power and then pushing power button waiting for a second and pushing the power button again, repeating several times.  That did the trick, the firmware booted back up and allowed me to select which device I wanted to boot from and get into the firmware setup menu.  It also has no effect (as far as I can tell) on the resumed windows, which resumes without issue.

Strangely, hibernating from linux (using the tux-on-ice kernel) does not exhibit this behavior.  I can think of two possible reasons for this.  One, linux or tux-on-ice specifically do not actually go to S4 on hibernate, but actually go to S5 (logical off).  Or two, it has to do with the fact that I’m hibernating from a running OS that was booted from a removable device.  Without further testing, I suspect the former more likely.  Anyone else have any ideas?

 

Advertisements

12 Responses to “Windows hibernate… where did my bios options go?”

  1. Great article! My win7 x64 desktop also requires unplug and push power button to access bios menu while hibernate.

  2. Obaida Kurdi Says:

    I once (long time ago) had the same problem with my laptop, but I didn’t know that I can push the power button several times to solve it, what I did was rather destructive to my laptop, I removed all screws I found until I reached the battery of the BIOS (a small lithium-ion battery) then I removed it like for 10 secs and then put it back, then reassembled my laptop and started it and I got the BIOS menus back.

  3. Thanks for this write-up – I had the same behavior with my Thinkpad T430.

    Apart from completely powering off like you described (didn’t try that) there is another option: you can install an alternative bootloader like GRUB which does not care if windows is hibernated or not and does not start the hibernated Windows right away like the Windows bootloader does. GRUB then allows you to chose between the hibernated Windows and other OS you configure in GRUB.

    • Thanks for the comment, but an alternative bootloader most certainly will not solve the problem in my case. Why? Because I’m already using grub. As the post mentions, I’m booting linux from usb, so I’m certainly not using the windows bootloader as the primary one. The fact is that this is a BIOS issue, not a bootloader issue. Actually, I over-simplified the situation. The BIOS is not booting directly to windows, but booting directly to the device the windows boot partition is on. So I could boot a linux install on that device, but not on other devices (like another harddrive or a usb).

      I don’t know if the T430 exhibits the behavior or not. But as I said in the write up, this is a BIOS issue (though it is windows putting the BIOS into the problematic state when its hibernating).

  4. Had similar issue yesterday, I solved by temporarily taking out a second hdd from laptop – than booting it.

    • Yes, that would likely work as well (depending on the configuration). I suspect that what happened is that you had something like SATA1 and SATA2, hibernated SATA2, removed SATA1, then hit the power button. Coming back from a warm boot, SATA2 would then become SATA1, which would likely confuse the booting process causing it to disregard the hibernated state and boot afresh.

  5. Didn’t work for me. Hibernated windows, turned off PSU switch, removed power cord. Many lights continued to blink on the motherboard for 5 minutes, so while the cord was still unplugged, I pressed and held the power button like your article says. The CPU fan spun for a split second, and then died. I held the button for another 30 seconds. Confident I had now completely turned off the computer, I tried to boot it up again. I was STILL not able to use the BIOS setup or the boot selection dialog!

    So while it may be true that hibernate does not fully power off the computer, and it may be true that hibernate sets a flag that the BIOS looks for to prevent the user from changing BIOS options, I don’t think the two are related.

    • You did not mention whether you removed the battery or not. I assume you didn’t and that’s why it didn’t work. That is certainly the way my Lenovo works.

      Its possible that in your laptop the non-volatile ram is used to record that the machine is hibernated, but I actually doubt it.

      Try again, but make sure that you remove the battery(!) before holding down the power button.

  6. Didn’t work for me either. Desktop with Window 7 x64.

    Put the computer on hibernation, unplugged, waited more than 5 mins pressing the power button to discharge it. When I plugged it back in and booted, it went straight to the “Resume from hibernation” screen.

    • This post was intended to address this issue for laptops only. As Hudcap mentioned in reply to Joe Sull, for desktops (which do not have laptop batteries) there is the BIOS battery. Removing and reinserting that battery may get your BIOS back, but I’ve not tested it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: