Enable Hibernation on Ubuntu

One of those note-to-self posts!

Why does Ubuntu come with Hibernation disabled by default?

Ubuntu had to resort to such measures as users experienced a lot of issues like:

  • No resume after suspending the PC — in a limbo
  • Open files and folders gone — Shutdown instead of hibernation
  • Wifi etc devices not working after waking up — the worst nightmare

And that happened because there wasn’t enough Hardware support. Even in Ubuntu derivatives like Linux Mint it came disabled.

What is hibernation?

Seriously? Forget it. I am not even going to look at you.

Alright Alright suit yourself: https://help.ubuntu.com/community/PowerManagement/Hibernate

Advantages of Hibernation:

  • You have an edge over “suspending”. It saves power.
  • The exact state of the computer is resumed.
  • Major use case for the people who leave their  PCs unattended (think: http://Torrentz.in)

How to enable it in Ubuntu:

Step#1 Check if hibernate works on your hardware.

  • Open Terminal (CTRL + ALT + T)
  • Save your work first and then type
 $ sudo pm-hibernate 
  • If everything goes smoothly, start your laptop and continue iff things look good.
  • If you see anything unexpected then please make sure that the size of SWAP is at least as large as the RAM or just 
     System.exit(1) 

Step#2 You can continue to use that command safely or make it permanent by enabling it on the menu (do it only if Step#1 above works)

Open terminal and type:

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

Enter the password

(instead of `gedit` you can use `vi` its awesome)

hit “i”; paste; hit “ESC”; hit “:”; hit “x”

Step#3 Paste the following lines in the blank file you created just now.

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

Hit Save and Quit.

Step#4 Reboot for the changes to take effect.

If upon restart you still cannot see the “Hibernate” item in the menu, then you need to Tweak the Grub but mostly it would not come to that.

And we’re back …

Also check http://nikunjlahoti.com/2012/04/29/ubuntu-12-04-fix-fn-brightness-keys/

Sources:

https://help.ubuntu.com/12.04/ubuntu-help/power-hibernate.html

https://help.ubuntu.com/12.04/ubuntu-help/power-suspendfail.html

Ubuntu fix Fn Brightness keys

So my Acer Aspire 5738 encountered the oh-the-Brightness-Function-keys-are-not-working-yet-again issue after the installation of Ubuntu 12.04. There is a simple fix and some related caveats. So here we go …..

#1 (open the file in gedit or vi)

$ sudo vi /etc/default/grub
[sudo] password for nikunj:

#2 (find an insert the arguments in gray)

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash acpi_osi=Linux acpi_backlight=vendor

#3 (update the grub configuration)

$ sudo update-grub
Generating grub.cfg …
Found linux image: /boot/vmlinuz-3.2.0-24-generic
Found initrd image: /boot/initrd.img-3.2.0-24-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Ubuntu 11.10 (11.10) on /dev/sda2
done

Just reboot the machine.

Caveats:

At times the screen would go entirely dark. Or would not apparently resume from a blank screen or when the screensaver gets active.

For such cases, all you need to do is press “Fn + Brightness UP button” and screen will GLOW. Simple!!

(This post is more like a NOTE TO SELF. But if it helps you in someway then its even better … AWESOME!! :D)

Update:

Works for Ubuntu 12.10 perfectly 🙂

Update (2013/01/08):

You can use “sudo gedit /etc/default/grub” if you are not very familiar with vi editor! 🙂

Update (2013/05/12):

For Ubuntu 13.04 do the following:

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash acpi_osi=Linux acpi_backlight=vendor

Update (2014/05/25):

Works on Ubuntu 14.04.

That’s how OALD7’s Successfully Installed on amd64!!

😀 Well.. . as crazy as if sounds .. . I finally managed to Break the Code! 😛

IF you-don’t-follow-my-blogs OR you-don’t-remember-stuff THEN
URL.refer (http://mrdigerati.blogspot.com/2010/02/this-is-what-i-did-on-v-day.html)
🙂

oops!
END IF;
// Yeah Some PL/SQL *HIT I’m into these days.  Sucks?

Anyway! Coming to the point. I looked for answers like almost everywhere and couldn’t really find even one…! Finally I went deep and mined some stuff, similar issues that the gamers were facing. Hail Loki.

ISSUES:
#1 (regular usage)

$ ./installation.sh
Verifying archive integrity… All good.
Uncompressing ……………………..
This installation doesn’t support glibc-2.1 on Linux / x86_64

#2 (using x86 emulation)

$ linux32 ./installation.sh
Verifying archive integrity… All good.
Uncompressing ……………………..
/home/nikunj/.setup5913: error while loading shared libraries: libgtk-1.2.so.0: cannot open shared object file: No such file or directory
Couldn’t load ‘atal’
The setup program seems to have failed on x86/glibc-2.1

Both the times it said:
Please contact Loki Technical Support at support@lokigames.com
The program returned an error code (1).

Anyway. ‘linux32’ should’ve ideally worked but .. . . there was more.

WHAT I DID TO MAKE OALD7 run:

#1. To run 32-bit apps on 64-bit Linux, you first need to install these prerequisite packages:

$ sudo apt-get install ia32-libs ia32-libs-gtk ia32-libs-sdl dpkg-dev


#2. Then I downloaded the i386 package from the Ubuntu site.
libGTK1.2: http://packages.ubuntu.com/jaunty/i386/libgtk1.2/download

#3. Deflate (Unzip/Un… hmm… Deb?) the libgtk1.2_1.2.10-18.1build2_i386.deb (right-click and extract) and then go inside the folder hence created. Deflate data.tar.gz and go inside ./usr,

$ cd libgtk1.2_1.2.10-18.1build2_i386/usr/lib (in short)


#4. Now we need to copy the files (lib? Modules?) to the location where OALD7 desires to find it!

$ sudo cp -v -i * /usr/lib32

#5. Try installation now. [ERROR. still?]
(Even after that another library was required)

$ linux32 ./installation.sh

Verifying archive integrity… All good.
Uncompressing ……………………..
/home/nikunj/.setup6372: error while loading shared libraries: libgmodule-1.2.so.0: cannot open shared object file: No such file or directory
Couldn’t load ‘atal’
The setup program seems to have failed on x86/glibc-2.1

#6. Then I downloaded two i386 packages for the Ubuntu site.


Follow the same procedure (#3-5) for libglib1.2ldbl_1.2.10-19build1_i386.deb

😀 and voilà .. . 😛 this is what you get! Don’t kill me 😛

Looks Kinda…  hmm….Nude!!

I don’t know why but just couldn’t see any TEXT 😐 I closed my eyes, trusted my senses and from the last time I installed it without this ‘Chick Chick’. Pushing the third Check-Box would save all the Sounds etc and makes it offline! 🙂 DO THAT.

Finally 😀 ….. Legen — wait for it —- Dary!!!

Update:
OALD8 installation is like so easy. Works Great! But I like the UI of v7 better! 🙂

OALD8 looks Light W8! (Rhyme?)

Update (2012-09-19):

For OALD8 on Ubuntu 12.04 Amd64

#1 Dependencies

$ sudo apt-get install ia32-libs ia32-libs-gtk ia32-libs-sdl dpkg-dev

#2 Mount the ISO/CD

using Furious ISO Mount Tool, etc!

#3 Begin Installation

Go to the mount directory

$ cd linux

$ linux32 ./setup.sh

Tweaks:

#1

No Sound?

Try padsp – PulseAudio OSS Wrapper:

padsp starts the specified program and redirects its access to OSS compatible audio devices (/dev/dsp and auxiliary devices) to a PulseAudio sound server.

$ padsp path-to-the-oald8

eg:

$ padsp ‘/home/nikunj/oald8/oald8’

#2

Create a Shell-Script on the Desktop

#!/bin/sh

padsp ‘/home/nikunj/oald8/oald8’

Make it executable. Also, optionally set the ICON from: /home/nikunj/oald8/chrome/icons/default/main-window.xpm

#3 (adjust)

Annoying Dialog: Click OK to download Plugin

Click Cancel. Yeah! Adjust! 😛

 
Update (2012-09-20)

Just copied and pasted it to my brand new Linux Mint.

It didn’t work by default.

/run-oald8.sh: 166: ./run-oald8.sh: ./oald8-bin: not found

So all I had to do was install the libraries.

$ sudo apt-get install ia32-libs ia32-libs-gtk ia32-libs-sdl dpkg-dev