Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 34

Thread: GRUB + Windows 7 = Can't put windows to sleep/hibernate

  1. #21
    Join Date
    May 2007
    Location
    Virginia, USA
    Beans
    13,377
    Distro
    Ubuntu Mate Development Release

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    Quote Originally Posted by bug-me-not View Post
    Booted using PartedMagic boot cd and selected XP partition as boot (previously win7 was boot). Rebooted into win7 and now win7 hibernates!
    Remember back in my post where I said the CORRECT partition was the one containing the Windows Boot Loader files?

    When you have XP on a PC and then install Win7, it will write its boot loader files to the XP partition. So, in that case, the XP partition needs to have the boot flag turned on.
    Ubuntu 20.04, Mint 19.10; MS Win10 Pro.
    Will not respond to PM requests for support -- use the forums.

  2. #22
    Join Date
    Mar 2009
    Beans
    2

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    I am having the same issue with windows 7 not wanting to sleep or even shutdown properly when booted through grub2. If I change the boot and force the drive which windows resides on to start and bypass grub2 windows works perfectly. Again I have tried all the suggestions here to no avail, I change the boot in Ubuntu but when I update grub it still sees the wrong partition? I have attahced two screenshots that might help someone see if I am doing something wrong...Thanks!
    Attached Images Attached Images

  3. #23
    Join Date
    Mar 2009
    Beans
    2

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    After a few days I finally got it. Turns out I did not try misterbiskits suggestion of "powercfg -h off." However before doing that I did remove the boot flag completely from Ubuntu for the Windows partition... So, not sure if the combo had anything to do with it, have not restarted Ubuntu yet.

    Anyway, thanks for all the great ideas in this thread! See you all around!

  4. #24
    Join Date
    Dec 2007
    Beans
    15

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    Quote Originally Posted by misterbiskits View Post
    setting the boot flag didn't work for me. typing "powercfg -h off" into the windows 7 command prompt seems to have worked, Windows 7 now sleeps as it should.
    In my case, my boot flag was already set. Using your suggestion of "powercfg -h off" worked perfectly. This being a desktop, I don't intend to use hibernate, but I could see that this could be a problem for laptop users.

    Thanks!

  5. #25
    Join Date
    Dec 2010
    Beans
    2

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    Oh boy this takes a while. to speed you along: powercfg.exe -energy in a windows 7 cmd.exe with admin rights - fixs as many problems as you can. if sleep works but hybrid sleep and hibernate don't and you boot with grub: set boot flag for the mini partition (recovery) that windows made when it installed itself - note do NOT do this with windows disk manager as it will BREAK your system (if you did do this use testdisk with puppy linux to recover (but believe me - you don't want to do that)!!!) Instead use parted or gparted or sysrescue disk or your linux partition and fdisk and set the boot flag on that partition. Still not hibernating (like me?) then you need to use the grub menu option that boots windows from the small partition usually /dev/sda1 (you set the boot flag didn't you?) Ok that should be it. Good luck ( when you set up grub it probably gave you more that one windows partition start up option - USE the /dev/sda1 (or 1st small partition with recovery partition on it - it has the smarts to start up a hibernated windows system)....

  6. #26
    Join Date
    Apr 2008
    Beans
    61

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    Quote Originally Posted by dna_gene View Post
    Oset boot flag for the mini partition (recovery) that windows made when it installed itself
    The recovery partition is optional, and many people (such as myself) don't have one.

  7. #27
    Join Date
    Sep 2008
    Beans
    37

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    Quote Originally Posted by Mark Phelps View Post
    Actually -- NO. It's not the order of the partition that matters, it's what it contains.

    When you buy a PC preloaded with Win7, there will be a small 100MB "boot" partition. That is the one containing the boot loader files. The Win7 OS files will be on another partition.

    In other cases, the Win7 boot loader directory and files -- and the Win7 OS files -- are in the same partition.

    The CORRECT partition is the one containing the Win7 boot loader directory and files. Where this happens to be on the drive depends entirely on HOW Win7 was installed.

    So, it's not necessarily true that the correct partition to have the boot flag is the first, or the second, or ... Instead, it's the one containing the boot loader stuff.
    This was my case. Except the partition is 750MB (the RECOVERY one).
    I used Gparted through the Ubuntu live-cd to change the flag.

    I struggled with this for a long time, but it works now. Thank you very much.

  8. #28
    Join Date
    Sep 2012
    Beans
    1

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    If there's still anyone out there who can't hibernate his/her GRUB booted win7 and is still looking for an answer here you go another one;
    just to be clear the setup is the following;
    Code:
    sda:
       Win7 bootloader
       sda1 ntfs System Reserved (100MB,Win7BootFiles)
       sda2 ntfs Windows7Files   (the rest on sda, Win7Install)
    sdb:
       GRUB
       sdb1 ntfs Data  (the rest on sdb,Data)
       sdb2 swap       (8GB,SWAP)
       sdb3 ext4       (30GB,Linux)
    GRUB above means GNU GRUB or GRUB2 that came packed with Ubuntu.
    So after running update-grub the notable generated entries are like:
    for Windows7:
    Code:
    menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os
    {
    	savedefault
    	insmod part_msdos
    	insmod ntfs
    	set root='(hd0,msdos1)'
    	search --no-floppy --fs-uuid --set=root D2BA9E65BA9E45BF
    	chainloader +1
    }
    and for linux:
    Code:
    menuentry 'Kubuntu, with Linux 3.2.0-30-generic' --class kubuntu --class gnu-linux --class gnu --class os 
    {
    	recordfail
    	savedefault
    	gfxmode $linux_gfx_mode
    	insmod gzio
    	insmod part_msdos
    	insmod ext2
    	set root='(hd1,msdos3)'
    	search --no-floppy --fs-uuid --set=root 7a5eb1c2-19f1-4d1c-a18f-176b3be8ae62
    	linux	/boot/vmlinuz-3.2.0-30-generic root=UUID=7a5eb1c2-19f1-4d1c-a18f-176b3be8ae62 ro   
    	initrd	/boot/initrd.img-3.2.0-30-generic
    }
    We should know that windows-es (Win9X DOS Vista Win7) are assuming themselves being on the first hard-drive, which should not be a problem since our GRUB sets the root to (hd0,msdos1).
    After a long time trying out various solutions and menu entries found on the web and constructed by myself, I found that the code above is very very misleading since the search statement overrides the root variable after the "set root" so the indexing of the hard drives isn't necessarily as suggested above the search. I mean of course GRUB believes it to be correct and although it can it doesn't swap the hard drives around helping the installed windows.
    (after reading a lot (I mean a lot) about grub and getting familiar with its console function and its various commands (which in my opinion I shouldn't have been forced to do as an end user)) I tried to boot from the console (this is the grub console now) like this:

    Code:
    set root='(hd0,msdos1)'
    ntldr /bootmgr
    and I got a "file not found" error (what the hell).
    The right one turned out to be:
    Code:
    set root='(hd1,msdos1)'
    ntldr /bootmgr
    Of course I still couldn't hibernate because of the twisted hard drive indexing.
    So the correct menu entry for me is the following:
    Code:
    menuentry "Windows 7"
    {
    	drivemap -s (hd0) (hd1)
    	set root='(hd1,msdos1)'
    	ntldr /bootmgr
    }
    the drivemap command virtually swaps the two hard drives given as parameters, but it's properly documented in the GRUB manual.
    As this is a known disability of the windows family it really should be integrated in the script generating the menu entries


    So the real solution is then:
    Finding out the correct hard drive index (the partition index should be correct)
    In the GRUB press 'c'.
    This will bring up the GRUB console you will get a
    Code:
    grub>
    It's just like any other console just the commands are a little different.
    Now type ls.
    This will list the available hard drives and the partitions, further more
    in my case if I type ls (hd0,msdos1) it lists the known properties of the (hd0,msdos1) partition which turned out to be my ntfs Data partition.
    If you know the proper indices you should turn off the os_probe script which generates the win7 entry from a regular console in ubuntu like this:
    sudo chmod -x /etc/grub.d/30_os-prober
    after that edit the '40_custom' file in the same place (/etc/grub.d/) and write the following (but of course with the proper hard disk index for this example the hard disk index of the one containing the 'System Reserved' partition will be 9999)
    Code:
    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    
    menuentry "Windows 7" --class windows --class os {
    	drivemap -s (hd0) (hd9999)
    	set root='(hd9999,msdos1)'
    	ntldr /bootmgr
    }
    then update-grub and done.

  9. #29
    Join Date
    Aug 2011
    Beans
    4

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    amilmand is correct. Windows expects to be the first HDD and refuses to sleep if it's not.
    You can fix it in /etc/grub.d/30_osprober, just change:
    Code:
          case ${LONGNAME} in
            Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
            ;;
            *)
              cat << EOF
            drivemap -s (hd0) \${root}
    EOF
            ;;
          esac
    To:
    Code:
            cat << EOF
          drivemap -s (hd0) \${root}
    EOF

    I've submitted a bug: https://bugs.launchpad.net/bugs/1055880

  10. #30
    Join Date
    Jun 2008
    Beans
    6

    Re: GRUB + Windows 7 = Can't put windows to sleep/hibernate

    Quote Originally Posted by Antithesis View Post
    Hi all,

    I recently had this problem with my machine, which I just solved, but since other people might run into it, I thought I'd put the solution up here for future users. While not strictly an Ubuntu issue (the problem appears in Win7) it is related to the Ubuntu install.

    Symptom: With Windows 7 installed, installing Ubuntu with GRUB on the MBR can lead to Windows unable to enter sleep or hibernate mode (The screen will go dark for a second, but immediately come back on). Reverting the MBR using the windows 7 DVD fixes the issue (but prevents GRUB from working).

    Issue: For sleep/hibernate to work, the first windows partition needs to be marked as boot, even with GRUB installed.

    Solution: In Ubuntu, use gparted (If not install, add it). On your booting hard drive (usually /dev/sda), make sure that the first windows partition (normally /dev/sda1) is marked as 'boot'. Close gparted and restart.

    GRUB should work just as before (It is on the MBR, so it doesn't really care), and windows will be able to put to sleep and hibernate without issues.

    Hope this helps.
    I had the same problem (Windows 7 64-bit and Ubuntu 12.04 64-bit) and your solution worked beautifully. So simple!
    Thanks a lot.

Page 3 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •