Entire system freezing after pressing "Suspend"

11,153

Solution 1

OK after a bit of work I modified the scrips above from the other suggestions. Thank you @wangdw! Here is the following bad ass script (don't forget as before to create a file using sudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd and also to set the read permissions using sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd):

  #!/bin/sh
  #inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&postcount=19
  #...and http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug    
  # tidied by tqzzaa :)

  VERSION=1.1
  DEV_LIST=/tmp/usb-dev-list
  DRIVERS_DIR=/sys/bus/pci/drivers
  DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
  HEX="[[:xdigit:]]"
  MAX_BIND_ATTEMPTS=2
  BIND_WAIT=0.1

  unbindDev() {
    echo -n > $DEV_LIST 2>/dev/null



  for driver in $DRIVERS; do
    DDIR=$DRIVERS_DIR/${driver}_hcd
    for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
      echo -n "$dev" > $DDIR/unbind
      echo "$driver $dev" >> $DEV_LIST
    done

  #for bus in $EHCI_BUSES; do
     echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
 # done   

  done

}

bindDev() {
  if [ -s $DEV_LIST ]; then
    while read driver dev; do
      DDIR=$DRIVERS_DIR/${driver}_hcd
      #for bus in $EHCI_BUSES; do
          echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
      #done
      while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
          echo -n "$dev" > $DDIR/bind
          if [ ! -L "$DDIR/$dev" ]; then
            sleep $BIND_WAIT
          else
            break
          fi
          MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
      done 


    done /dev/null

  chvt 1
  chvt 7
}



  EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
  case "$1" in
    hibernate|suspend)
    unbindDev;;

    resume|thaw)
    bindDev;;

    esac

Solution 2

I've been experiencing the same problem. It seems that Ubuntu attempts to suspend itself but some hardware doesn't want to comply. Here are some repairs that might work:

1. open a terminal by holding ctrl+alt+t;
2. type: sudo gedit /etc/pm/sleep.d/20_custom-suspend;
3. press Enter and authenticate;
4. put the following text into the created file; save it and exit. 
5. reboot and see if it works. 

This little script comes from somewhere on the Internet but I cannot find the source...

EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "${1}" in
    hibernate|suspend)
        # Switch USB buses off
        for bus in $EHCI_BUSES; do
            echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
        done
        ;;
    resume|thaw)
        # Switch USB buses back on
        for bus in $EHCI_BUSES; do
            echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
        done
        ;;
esac

Please try this out and tell me your findings!

If that script doesn't work, you might want to try another:

#!/bin/sh
#inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&postcount=19
#...and http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-  not-working-bug
# tidied by tqzzaa :)

VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1

unbindDev() {
  echo -n > $DEV_LIST 2>/dev/null
  for driver in $DRIVERS; do
    DDIR=$DRIVERS_DIR/${driver}_hcd
    for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
      echo -n "$dev" > $DDIR/unbind
      echo "$driver $dev" >> $DEV_LIST
    done
  done
}

bindDev() {
  if [ -s $DEV_LIST ]; then
    while read driver dev; do
      DDIR=$DRIVERS_DIR/${driver}_hcd
      while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
          echo -n "$dev" > $DDIR/bind
          if [ ! -L "$DDIR/$dev" ]; then
            sleep $BIND_WAIT
          else
            break
          fi
          MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
      done  
    done < $DEV_LIST
  fi
  rm $DEV_LIST 2>/dev/null
}

case "$1" in
  hibernate|suspend) unbindDev;;
  resume|thaw)       bindDev;;
esac

Solution 3

i have the same problem. try this: http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug work like a charm for me...

Share:
11,153

Related videos on Youtube

landon
Author by

landon

Updated on September 18, 2022

Comments

  • landon
    landon over 1 year

    So I just installed Ubuntu, and I love it. I don't think it's going to replace Windows 7 for me, and it has a few problems that I'm probably going to end up fixing when I figure out how to use WINE, but it's still awesome.

    My main problem now is that whenever I put Ubuntu in to suspend, the entire thing freezes. The monitor is still on, but is only black, and there is no reaction to any buttons.

    While I don't mind pressing Shut Down since Ubuntu loads up rather fast in comparison to Windows 7, it can get annoying and inconvenient.

    Thanks for any help!

    • beeju
      beeju about 12 years
      Pls read this wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/UbuntuDesktop.N‌​ext time when u reply pls include sys configuration too.Suspend is disabled in 12.04 by default.If u want it back see this askubuntu.com/questions/94754/….
    • Jorge Castro
      Jorge Castro about 12 years
      Welcome to Ask Ubuntu! This question should instead be filed as a bug report, thanks! Instructions here.
    • landon
      landon about 12 years
      @beeju , the first is a broken link. The second, I try to put in the pm-hibernate, it spits back a This utility may only be run by the root user. I don't know how to be the "root user."
    • landon
      landon about 12 years
      @JorgeCastro Will do! Sorry that I didn't know that's what I had to do!
    • beeju
      beeju about 12 years
      To be a root,enter this command first "sudo -i" and enter your password.Now you are root.
    • Manuel Selva
      Manuel Selva almost 12 years
      Hi landon, I have the same issue. Did you find any solution ? Please let us know.
  • landon
    landon about 12 years
    This didn't work. It still simply freezes and doesn't come back on, with the LCD still lit up but black. I'll try it again in a bit, I'll be busy for now!
  • Dawei
    Dawei about 12 years
    here is another script: http://chriseiffel.com/everything-linux/how-i-got-suspend-an‌​d-hibernate-working-‌​in-linux-ubuntu-11-0‌​4-mint-11/. Try it!
  • landon
    landon about 12 years
    I'm getting a broken link.
  • Dragon
    Dragon about 12 years
    Sorry that was a comment within the script from the sources I took it from. You can ignore anything with a # in front as it is a comment. Also yes esac is part of the script. It is the ending. I have changed it now because it took me a while to figure out how this silly editor works. Let me know if it works well for you.
  • Eliah Kagan
    Eliah Kagan about 12 years
    The script should run now as it is, though I'm not sure if you have the indentation the way you like it, since it's inconsistent throughout the script. As for editing on AskUbuntu, scroll down and there's a dynamically generated preview as you're writing/editing your posts, so you see what it will look like.
  • Dragon
    Dragon about 12 years
    Yes the indentation got pretty messed up. I shall make another attempt at editing it. I had to add some html tags which don't show but help the script appear better.
  • Brenden
    Brenden almost 12 years
    I tried to get this to work but it had a syntax error about a missing fi so I used the 'new' step 2 on this link: thecodecentral.com/2011/01/18/… (mentioned on this thread) and it worked great.
  • Eliah Kagan
    Eliah Kagan almost 12 years
    Can you provide more information about how/where to find/install this package?