Tags

,

Hibernation is a must-have feature in a laptop. I can work on my programming, then hibernate the machine in 30 seconds, take a nap and resume the machine to the state before it hibernates in 30 seconds and continue my work — I can just continue my work from I stop seamlessly. However, the hibernation function seems to be missing in Linux Mint Maya (KDE) in my Dell Vostro 3450. The followings are the patches to overcome this issue.

The patches include:
1. Prepare the scripts to hibernate.
2. Make an hibernation icon in the start menu.
3. Solve the noisy fan issue (due to the hybrid card) after resume from hibernation.

1. Prepare the scripts to hibernate
We need to prepare two scripts here.

First, start the terminal (ALT-F2 and type “terminal”). Then, in the terminal, type “kate ~/bin/hibernation.sh”. In the kate editor, fill in the following script.

#!/bin/bash
echo This script will put the machine into hibernation.
echo Please ENTER to continue
read

# Lock the screen first
qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock

sleep 2

# Suspend to disk.
sudo pm-hibernate

Then, in the terminal type “sudo kate /etc/sudoers.d/hibernate”.

{your username} ALL=(ALL) NOPASSWD: /usr/sbin/pm-hibernate

Also, type “sudo chmod 0440 /etc/sudoers.d/hibernate” in the terminal.

2. Make an hibernation icon in the start menu

Create icon in KDE Menu Editor.

Then, right click the start menu–> Edit Applications. Select the “System”. Right click and choose “New Item”. Item name as “Hibernate”. In the command, type “/home/{your username}/bin/hibernation.sh”. Then, “save”.

After that, you should be able to find the “Hibernation” appears in your start-menu (Applications -> Systems -> Hibernate). Right click it to “Add to Favorite”.

KDE Menu

3. Solve the noisy fan issue (due to the hybrid card) after resume from hibernation.

The hybrid display card is always an issue in Linux. In my case, the fan will spin at high speed after it resumes from hibernation.

To resolve this, we need to create a script that that run after the machine resumes from hibernation.

In the terminal, type “sudo kate /etc/pm/sleep.d/99_restart-hybrid-card”. In the kate editor, fill in the followings.

case "${1}" in
    resume|thaw)
    chown {your username} /sys/kernel/debug/vgaswitcheroo/switch
    echo ON > /sys/kernel/debug/vgaswitcheroo/switch
    sleep 3
    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
    touch /tmp/restart-hybrid-card
;;
esac

Then, we have to make it executable with “sudo chmod +x /etc/pm/sleep.d/99_restart-hybrid-card” in the terminal.

After that, try hibernate your machine and resume it. Everything should be work fine now.