hibernate, then start Windows [SOLVED]

Greg Woods woods at ucar.edu
Tue Aug 31 13:38:17 UTC 2010

This is in regard to the issue that, when Linux is hibernated, upon
reboot the thaw starts immediately and the grub menu is not presented.

I am now absolutely convinced this is not a BIOS issue, it is a kernel
or boot loader issue.

I worked around it by adding a level of indirection to the boot process.
To do this requires that you have at least one Linux partition that is
not / or /boot. 

The basic idea is that Linux is booted with a chainloader, same as
Windows. So the main grub menu gives you a choice of Linux or Windows,
and both are implemented with "chainloader +1" stanzas. It works, but I
don't recommend trying this unless you are fairly familiar with how the
boot loader works, and are comfortable reinstalling the boot loader from
a rescue CD/DVD if something goes wrong.

The high-level instructions go like this:

1) In your extra Linux partition, create "boot" and "boot/grub"
2) Copy the contents of /boot/grub to this new grub directory.
3) Edit the boot/grub/grub.conf file in this new directory so that
Windows and Linux are presented as "chainloader +1" stanzas.
4) Install grub in the master boot record, pointing to this partition
5) Install grub in the first sector of your root partition, with the
usual kernel choices.

When this is done, at boot time you get a choice of Linux or Windows. If
you select Linux, the second boot loader comes up with the usual choice
of kernels. If Linux is hibernated, you can then boot and run Windows
just fine (my Windows install doesn't have a hibernate option so I
wasn't able to test hibernating Windows in this scenario). If you boot
again and select Linux, instead of getting the choice of kernels, it
immediately resumes the hibernated image. This is how I *want* it to
work, so I have left it this way.

Suppose you have this:

/dev/sda1 Windows
/dev/sda2 Linux root
/dev/sda3 Linux /local

Then /boot/grub gets copied to /local/boot/grub, then
edit /local/boot/grub/grub.conf so that you have something like this:

title Linux
   root (hd0,1)
   chainloader +1
title Windows
   root (hd0,0)
   chainloader +1

Then run:

# grub
grub> root (hd0,2)
grub> setup (hd0)

This loads the master boot record that points to /dev/sda2, the
chainloader configuration.

Now edit /boot/grub/grub.conf and remove the Windows stanza (you don't
need it here any more). Then run:

# grub
grub> root (hd0,1)
grub> setup (hd0,1)

This loads grub into the first sector of the Linux root partition,
pointing at that partition and presenting the usual choice of kernels.

This has worked great for me. I can now hibernate Linux, boot into
Windows, and later resume from the hibernated Linux image.


More information about the users mailing list