4

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!

landon
  • 41

4 Answers4

3

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
Eliah Kagan
  • 119,640
Dragon
  • 71
  • 1
  • 5
1

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
Dawei
  • 81
1

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...

0

I found that installing the "dell firmware addon" package fixed the issue during the development cycle.