Page 1 of 10 123 ... LastLast
Results 1 to 10 of 99

Thread: Ubuntu 12.04 LTS Suspend not working FIX

  1. #1
    Join Date
    Mar 2012
    Beans
    4

    Ubuntu 12.04 LTS Suspend not working FIX

    Hi! Finally after a long time of searching and messing around I have figure out a temporary work around solution until this bug gets patched in future kernel releases. Please see below:

    Use this script only if you have been experiencing issues with resuming from standby/suspend in Ubuntu 12.04 LTS and the screen remains lit but black when you wake your machine.


    Step 1:
    Open up a terminal and create a script file as follows:
    Code:
     sudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd
    Step 2:
    Copy the entire script below into the file you just created and save it:
    Code:
    #!/bin/sh
    #inspired by http://art.ubuntuforums.org/showpost...0&postcount=19
    #...and http://thecodecentral.com/2011/01/18...ot-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_LIST
      fi
      rm $DEV_LIST 2>/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
    Step 3:
    Give the script run permissions by typing:
    Code:
     sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
    This script should work or your money back guaranteed (Joking this is open source project so use at own risk :P ), as it forces the graphic card to reboot itself using a good old kick from chvt1 and chvt7 commands which simulate what I used to do manually using Ctrl + Alt + F1 and Ctrl + Alt + F7 to refresh the GUI.
    Last edited by Kirboosy; June 9th, 2014 at 07:01 PM. Reason: added code tags for post

  2. #2
    Join Date
    Mar 2011
    Location
    Goshen, IN
    Beans
    396
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    Interesting. I'll have to give it a shot.

    Could you please edit your post and put your script in code tags?

  3. #3
    Join Date
    Mar 2010
    Beans
    6

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    I almost can't believe it! Suspend has never worked for me on my laptops and this has worked like a charm!

    Many thanks bud!

  4. #4
    Join Date
    Mar 2011
    Location
    Goshen, IN
    Beans
    396
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    Same code wrapped in code tags for clarity:

    Step 1:
    Code:
    gksudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd
    Step 2 (paste this into gedit and save):
    Code:
    #!/bin/sh
    #inspired by http://art.ubuntuforums.org/showpost...0&postcount=19
    #...and http://thecodecentral.com/2011/01/18...ot-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_LIST
        fi
        rm $DEV_LIST 2>/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
    Step 3:
    Code:
    sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd

  5. #5
    Join Date
    Jun 2012
    Beans
    2

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    I honestly can't believe it. I have been having problems with the suspend option on my Asus laptop since i installed Ubuntu onto it. This fixed it completely. You're my freaking hero. I actually made an account on here just to thank you for being the coolest person ever born.

    Thank you! haha

  6. #6
    Join Date
    Mar 2012
    Beans
    4

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    Now although I have tested the latest kernel 3.4 ppa release and I must say it does run quite well and fixes some of the major bugs in Ubuntu 12.04 including of course the bug mentioned here regarding standby/suspend, it is still not a release version and I am still using kernel 3.2.0-24-generic release version.
    Now since this version many of you probably noticed that the script I have posted before providing a quick fix for this bug no longer works. At least for me it no longer works. If for you it still works then don't touch it. It seems for me however some issues may have been attempted to fix regarding sleep and wake up driver issues. As a result the previous script no longer works, however I have written a simplified version which takes in consideration these fixes and this seems to work like a charm for me.

    As previously...
    Step 1: Open up a terminal and create a scrip file as follows:

    Code:
    sudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd
    Step 2: If and only if you have problems with your current script and your machine refuses to sleep or wake up on kernel 3.2.0-24-generic then replace the entire code with the following:

    Code:
    #!/bin/sh
    # File: "/etc/pm/sleep.d/20_custom-ehci_hcd".
    TMPLIST=/tmp/ehci-dev-list
    
    case "${1}" in
            hibernate|suspend)
    
            ;;
            resume|thaw)
    
         chvt 1
         chvt 7
            ;;
    esac
    Step 3:
    Give the script permission to run by typing the following in the terminal:

    Code:
    sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
    Hope that helps and it works for me nicely.

  7. #7
    Join Date
    Jun 2012
    Beans
    1

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    Many thanks, now suspend works on my Samsung NP530U3B-A01

  8. #8
    Join Date
    Mar 2007
    Beans
    339

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    Oh yes... suspend works now on my samsung Chronos Series 7.

    Only problem I see right away is that I have Samsung-tools installed and tell it to keep bluetooth disabled. When I wake from suspend, bluetooth is on. Other things might be flaky as well, but this is one that stood out.

    Any thoughts?

  9. #9
    Join Date
    Jun 2012
    Beans
    1

    Re: Ubuntu 12.04 LTS Suspend not working FIX

    This is absolutely amazing. I take my hat off to you all for being such Gurus. After months of no Suspend on my iterations of Ubuntu versions, I can finally put my Lenovo S10-3 to sleep and resume without a single hitch. Thank you Thank you Thank you

  10. #10
    Join Date
    Jan 2012
    Beans
    17

    Talking Re: Ubuntu 12.04 LTS Suspend not working FIX

    Another confirm success story from my part, I have an asus U56E and were to experiencing problems with suspend and this made it posible.

Page 1 of 10 123 ... LastLast

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
  •