Grub2 cannot bring Win 7 out of hibernation - error 0xc000009a

Bug #1229886 reported by S Silverstein
60
This bug affects 11 people
Affects Status Importance Assigned to Milestone
grub2 (Arch Linux)
New
Undecided
Unassigned
grub2 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Installed Ubuntu 12.04 for dual-boot on HP P7-1222 (a UEFI machine that came with Win 7). All Ubuntu and Win 7 updates are installed, current as of 9/20/2013.

Ubuntu works well. The 'Grub2 "Windows Boot UEFI loader" selection boots Windows 7 64-bit fine, too.

Problem is: Win 7 cannot resume from hibernate.

Pre-Ubuntu I had activated Win 7 hibernation and used it successfully. I like to hibernate my Windows machines and then unplug them to protect against voltage spikes etc., but have a fast restart with retained state.

After Ubuntu was installed, if I hibernate Win 7 (which it seems to do) and the machine turns off. If I then try to resume Win 7 from hibernation, I get a "Your computer cannot come out of hibernation 0xc000009a" error from the Windows loader.

If I try to reboot Win 7 again from Grub2 I am presented with the "delete hibernation file and restart" option, which then does so and reboots Win 7 OK. Of course, searching on the 0xc000009a error code brings up little of value. (Thanks, MS, for such informative error messages.)

I've tried the "off the top of my head" attempted fixes - powercfg -h off, then powercfg -h on; defragmenting; etc. No change.

In effect, I cannot use hibernation in Win 7 anymore.

This seems to be a grub2 bug. It does not occur on a dual-boot non-UEFI Celeron 352 machine w/Ubuntu 12.04 and Win 7 (note that the old machine is unning the 32 bit version of Win 7 but the 64-bit version of Ubuntu).

I believe this is a Grub bug, but have no idea what source package the bug is in.

Revision history for this message
Phillip Susi (psusi) wrote :

Can you change the bios boot order to bypass grub and go straight to the Windows loader, and see if that fixes it?

Revision history for this message
S Silverstein (scotsilv) wrote :

> Can you change the bios boot order to bypass grub and go straight to the Windows loader, and see if that fixes it?

yes, I can change the BIOS boot order to bypass Grub (which appears first in the list), but when I select the Windows loader I get a black screen with the text message "No boot disk detected or boot disk has failed."

Revision history for this message
stooky (stooky) wrote :

Same problem here. Bypassing Grub solves the problem for me, so this problem is definately related to Grub...

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

Very strange. Just to make sure, you are not booting into Ubuntu between the time you hibernate and try to resume windows right?

Do you have an option for Intel Rapid Start in your bios settings? Can you post the output of sudo parted -l?

Revision history for this message
stooky (stooky) wrote :

No, I didn't boot into Ubuntu I booted into Windows directly since I bypassed Grub.

Here is the output of sudo parted -l:
Modell: ATA ADATA XM11 256GB (scsi)
Festplatte /dev/sda: 256GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: gpt

Nummer Anfang Ende Größe Dateisystem Name Flags
 1 1049kB 316MB 315MB fat32 EFI system partition boot
 2 316MB 945MB 629MB ntfs Basic data partition versteckt, diag
 3 945MB 1079MB 134MB Microsoft reserved partition msftres
 4 1079MB 85,0GB 83,9GB ntfs Basic data partition
 5 85,0GB 200GB 115GB ntfs
 6 200GB 221GB 21,0GB ext4
 7 221GB 226GB 4299MB linux-swap(v1)
 8 226GB 252GB 26,2GB ext4
 9 252GB 256GB 4267MB ntfs

Revision history for this message
S Silverstein (scotsilv) wrote :

I can boot Windows from Grub, hibernate it, and then try to resume Windows from Grub. The error results.

I will have to test hibernating Windows, running Ubuntu, the trying to bring Windows out of hibernation. Not certain I tried that, but the issue of being unable to go right back to Windows suggests the Windows boot loader is unhappy with being called by Grub for hibernation resumption. Perhaps Windows looks for some data that Grub affects - I do not have technical info on the resumption from hibernation process.

Will also post my output of sudo parted -l when I'm at the machine.

Revision history for this message
S Silverstein (scotsilv) wrote :

and on my machine, there is no " option for Intel Rapid Start" in the BIOS. The machine uses a somewhat dated motherboard, the Pegatron IPISB-CU (Carmel2) as at http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02980014 , and a Pentium G630 CPU.

Revision history for this message
stooky (stooky) wrote :

I don't have an Intel Rapid Start option in my BIOS either.

Revision history for this message
Phillip Susi (psusi) wrote :

Could you attach your /boot/grub/grub.cfg?

Revision history for this message
S Silverstein (scotsilv) wrote :

My output from sudo parted -l is:

Model: ATA ST500DM002-1BD14 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number Start End Size File system Name Flags
 1 1049kB 106MB 105MB fat32 EFI system partition boot
 2 106MB 240MB 134MB Microsoft reserved partition msftres
 3 240MB 362GB 362GB ntfs Basic data partition
 5 362GB 474GB 112GB ext4
 6 474GB 482GB 8491MB
 4 482GB 500GB 17.9GB ntfs Basic data partition

Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/cryptswap1: 8491MB
Sector size (logical/physical): 512B/4096B
Partition Table: loop

Number Start End Size File system Flags
 1 0.00B 8491MB 8491MB linux-swap(v1)

Revision history for this message
S Silverstein (scotsilv) wrote :
Download full text (12.6 KiB)

My /boot/grub/grub.cfg is:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
  insmod efi_gop
  insmod efi_uga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_gpt
insmod ext2
set root='(hd0,gpt5)'
search --no-floppy --fs-uuid --set=root a7237fd9-87a1-40e1-aa03-98693376e3f9
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_gpt
  insmod ext2
  set root='(hd0,gpt5)'
  search --no-floppy --fs-uuid --set=root a7237fd9-87a1-40e1-aa03-98693376e3f9
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
 set gfxpayload="${1}"
 if [ "${1}" = "keep" ]; then
  set vt_handoff=vt.handoff=7
 else
  set vt_handoff=
 fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.2.0-53-generic' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 gfxmode $linux_gfx_mode
 insmod gzio
 insmod part_gpt
 insmod ext2
 set root='(hd0,gpt5)'
 search --no-floppy --fs-uuid --set=root a7237fd9-87a1-40e1-aa03-98693376e3f9
 linux /boot/vmlinuz-3.2.0-53-generic root=UUID=a7237fd9-87a1-40e1-aa03-98693376e3f9 ro quiet splash $vt_handoff
 initrd /boot/initrd.img-3.2.0-53-generic
}
menuentry 'Ubuntu, with Linux 3.2.0-53-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod gzio
 insmod part_gpt
 insmod ext2
 set root='(hd0,gpt5)'
 search --no-floppy --fs-uuid --set=root a7237fd9-87a1-40e1-aa03-98693376e3f9
 echo 'Loading Linux 3.2.0-53-generic ...'
 linux /boot/vmlinuz-3.2.0-53-generic root=UUID=a7237fd9-87a1-40e1-aa03-98693376e3f9 ro recovery nomodeset
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-3.2.0-53-generic
}
submenu "Previous Linux ...

Revision history for this message
stooky (stooky) wrote :

My /boot/grub/grub.cfg is:

http://paste.ubuntu.com/6162333/

Revision history for this message
João Henriques (joaoh88) wrote :

I'm having the same problem, cannot resume Windows from grub, but going into settings and overriding the boot sequence and choosing windows bootloader allows hibernation to resume state.

I have an asus N56VB latpot.

Revision history for this message
João Henriques (joaoh88) wrote :

Forgot to refer I'm using windows 8.1 Pro

Revision history for this message
Jonathan Childs (jon-e) wrote :

The following may be useful,

I also have this problem, at first a while ago when I was dual booting ubuntu and win 7 using MBR boot, the same behaviour occurred, I resolved by setting the boot flag (linux def) on the win 7 partition and hibernation worked correctly.

I decided to go GPT/UEFI so that I could squeeze some more partitions onto HDD and encountered the bug again described here, I thought I will try setting the boot flag again (I know you're not meant too but nothing to loose!) and this just resulted in windows hanging on the loading windows when trying to boot without resuming.

Although unlikely it may point to a problem with windows bootloader where for some reason it may be looking for that flag and in mbr its fine to have it and it carries on, but with GPT it find it and carries on but hangs because the flag is out of place in GPT.

Revision history for this message
S Silverstein (scotsilv) wrote :

 Re: João Henriques (joaoh88) - I'm having the same problem, cannot resume Windows from grub, but going into settings and overriding the boot sequence and choosing windows bootloader allows hibernation to resume state.

I can override the BIOS boot sequence to bypass Grub, but when I select the Windows bootloader I get a black screen with the text message "No boot disk detected or boot disk has failed."

Did Grub inastallation possibly rename the windows bootloader?

Note the entry in my /boot/grub/grub.cfg file as posted earlier:

menuentry "Windows Boot UEFI loader" {
search --fs-uuid --no-floppy --set=root 96AD-5B21
chainloader (${root})/EFI/Boot/bkpbootx64.efi

Revision history for this message
Chase Zheng (mzheng086) wrote :

I have the same problem, too. Windows 7 cannot return from hibernation if I try to boot it from grub. However, if I boot it from refind, the error doesn't show up. What's interesting is that both refind and grub points to the same bootmgr.efi file in the ESP partition. I generate grub.cfg with update-grub, so the entry is similar to what others have provided here.

Revision history for this message
Robin Battey (zanfur) wrote :
Download full text (3.9 KiB)

I have the same problem, but also a fair bit of information gleaned from experimentation. Here are my notes:

My setup:
* Lenovo T530 (yes, it can hold 3 internal hard drives, two SATA and one mSATA)
* Windows 7 EFI on /dev/sda1=(hd0,gpt1), Windows install on /dev/sda2=(hd0,gpt2)
* Ubuntu 12.04.3 EFI on /dev/sdc1=(hd2,gpt1), Ubuntu install on /dev/sdc2=(hd2,gpt2)
* grub-efi is installed on (hd2,gpt1)/efi/grub/grubx64.efi
* rEFInd is installed on both EFI partitions under /efi/refind/refind_x64
* Attempts to resume Windows from hibernate using grub result in the 0xc000009a windows error

Things of note: I *had* resume working without issue, using MBR booting rather than UEFI booting and using the drivemap -s grub command to fake the bios ordering for windows (windows MBR resume *only* looks for the BCD on the first bios drive...so stupid), but when my SSD crashed I installed a fresh from-disk copy of Win7 Pro. To do this, I actually *removed* all my linux drives from the machine so that the windows installer had no chances of screwing up the linux partitions or boot sequence, so windows installed thinking it was the only OS on the only drive on the system. It installed itself using UEFI booting, which caused me headaches until I converted my linux grub install to use grub-efi. However, I've collected lots of data in my floundering yet ultimately successful attempts to get windows booting from grub-efi...though I still can't resume from hibernate using grub.

Here's what I've found:

* It doesn't matter if the linux disklabel is GPT or msdos/MBR -- so long as you insmod the proper grub module for the partition table, behavior is exactly similar (can boot linux just fine, and can boot windows but not resume windows from hibernate)
* It doesn't matter if you use the standard UEFI image location of /EFI/Boot/bootx64.efi for grub or if you use the standard /EFI/grub/grubx64.efi location, exact same behavior.
* It doesn't matter if grubx64.efi is installed on the same EFI as windows, or on a different drive (though I must point out that my grub modules are on a different drive -- I have not tested with Ubuntu and Windows on the *same* drive entirely)
* It doesn't matter if the grub EFI partition is partition 1, or partition 3, or partition 4, or if the EFI partition is near the start of the disk or near the end...I've tried all combinations and it's the exact same behavior, both with GPT and MBR disklabels.
* No matter how many times hibernate fails to resume, if I boot directly to the windows EFI image (not through grub), the resume succeeds. Similarly, it will succeed if I boot directly to rEFInd (not through grub), either of them, and then attempt to resume windows from there.

Here's the most interesting stuff I've found:

* rEFInd *can* resume windows from hibernate, using its default of loading /efi/Microsoft/Boot/bootmgfw.efi.
* rEFInd can reusme windows from either refind installation, even -- it doesn't care if it's the same drive or not.
* rEFInd ***CAN'T*** resume windows from hibernate if you've chainloaded to it from grub. Same behavior.

Basically, I can chainload from rEFInd to rEFInd all day long (I have two installs, one on ...

Read more...

Revision history for this message
Fabien D. (fabius1) wrote :

I also have this bug, not with Ubuntu but with Arch Linux & Grub2 working on UEFI.

Like others said, if I boot directly via the Windows Boot Loader, Windows 7 can resume from hibernate.
If I try to load Windows via Grub2, resume fails and I get an error.

Just loading Windows (fresh start) via Grub2 works fine.

Revision history for this message
Baffo32 (baffo32) wrote :

I had this issue. Windows would no longer boot for me after hibernating, giving a black screen with a blinking cursor.

Was able to boot again by changing "chainloader +1" to "ntldr /bootmgr" .

Revision history for this message
Luke McKee (hojuruku-s) wrote :

This is slightly off topic, this bug looks very interesting and has been confirmed from the arch people.

I personally think intel rapid technology is more trouble than it's worth. It's broken on my BIOS. Here's the full story:
https://forum-en.msi.com/index.php?topic=266706.0

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.