Pages

Showing posts with label Ubuntu hibernate not working. Show all posts
Showing posts with label Ubuntu hibernate not working. Show all posts

Friday, October 26, 2012

How to enable hibernation in Ubuntu 12.04 lts [Solved]

After upgrading to Precice Pangolin - Ubuntu 12.04 lts, I was unable to hibernate my machine by default. I googled it and found a solution(It worked for me.)

To check whether hibernate is supported, Open a terminal and type:

pm -hibernate

after entering this, your system will attempt a hibernate.

to enable hibernation, open a terminal and type the following line and press enter.

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

insert the following content

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
 
save and exit.
 
restart the system once and hibernation will be enabled. 

Wednesday, January 11, 2012

[Solved] Ubuntu Hibernate not working

For some laptop models, ubuntu installations show up by not hibernate in expected way. I have dug up in google about this issue and found some solutions.

this post.was the most relevant one thanks to the author,

make a script under /etc/pm/sleep.d/. 

sudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd
paste the following code into the file you have just created:

#!/bin/sh
#inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&postcount=19
#...and www.ubutnusolved.blogspot.com    


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
save the file and exit back to terminal.
Give execution permission:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd
Now your system must work well with hibernate option.