21st century tech, Linux and the occasional rant.
How to Re-Enable Hibernate in Ubuntu 12.04
- Get link
- Other Apps
If you have upgraded to Ubuntu 12.04, you may be wondering what happened to the “Hibernate” option in the power menu.
For those of you who are not aware or don’t use this feature at all, the Hibernate button usually lies above the Shut Down option and I use it a lot on my machines to save the current machine state to the hard drive rather than shut down or suspend. The next time you power up, hibernate restores to the previous saved state without going through the full boot process.
So why is hibernate missing in Ubuntu 12.04?”
Apparently Ubuntu’s Hibernate feature has not worked consistently on all computers, particularly new hardware models, where, some instances, the Hibernate feature has even caused data loss. So Canonical put out a statement to the effect:
“For Ubuntu to present a Suspend function that doesn’t work is unprofessional, and presenting a Hibernate function that doesn’t work (and destroys data by never waking up) is even worse.”
“After much discussion and debating, the final decision is to disable Hibernate by default on all computers, unless the computer is on a whitelist. The whitelist will include all “Ubuntu Certified” computers that have been tested and proven to work with the Hibernate feature. So if you are not seeing the Hibernate button, most probably your PC is not “Ubuntu Certified”.
Well, no ####, Sherlock. Sadly those of us who know that it works and want to keep using it now have to resort to the Linux command-line ghetto to re-enable it.
The Hibernate option is still available under “Power -> When power is critically low” system setting, which you can enable without any further action or warning, so you can get your laptop to go into Hibernate mode when your batter power is critically low. But not in regular use.
How to re-enable the Hibernate feature
First, make sure your PC supports the Hibernate feature. Close all open data files, open a terminal and type
If your machine successfully hibernates and you can wake it, then your PC supports the Hibernate feature. You can proceed to restore the Hibernate option for normal use.
In the terminal, use root privileges to open the following policy kit file:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.desktop.pkla
Search for the section
[Disable hibernate by default]
and replace it with the following:
[Re-enable hibernate by default]
If the file is empty (some are), you can simply add this section.
Save the file and exit.
Restart the machine and the Hibernate option should return to the power menu. RC
If you have upgraded to Ubuntu 12.04, one thing that you will find missing is the “Hibernate” button. For those of you who are not aware or don’t use this feature at all, the Hibernate button usually lies above the Shut Down option and it allows you to save your current state to the hard drive so the next time you boot up, it can restore to the previous saved state without going through the usual boot up loop.
Why Hibernate is disabled by default in Ubuntu 12.04?
Some of you who are used to the Hibernate feature in Ubuntu might be asking “why is this missing in Ubuntu 12.04?”
The reason behind this is because Ubuntu’s Hibernate feature has always not been working well in many computers. For new hardware models, the Hibernate feature often don’t work by default. In some instances, the Hibernate feature will even lead to data loss. The rationale behind the removal of the Hibernate button is:
For Ubuntu to present a Suspend function that doesn’t work is unprofessional, and presenting a Hibernate function that doesn’t work (and destroys data by never waking up) is even worse.
After much discussion and debating, the final decision is to disable Hibernate by default on all computers, unless the computer is on a whitelist. The whitelist will include all “Ubuntu Certified” computers that have been tested and proven to work with the Hibernate feature. So if you are not seeing the Hibernate button, most probably your PC is not “Ubuntu Certified”.
Where to access the Hibernate feature?
Currently, the Hibernate feature is only available in the “Power -> When power is critically low” settings. You can get your laptop to go into Hibernate mode when your batter power is critically low.
How to get back the Hibernate feature?
If you are not sure if your PC supports the Hibernate feature, open a terminal and type pm-hibernate . If your PC succeed in going to Hibernate mode and you have no problem waking it up, your PC supports the Hibernate feature. You can then proceed to the next step to restore the Hibernate option.
In the terminal and open the following file:
Add the following:
Save (Ctrl + o) and exit (Ctrl + x).
Restart the PC. The Hibernate option should return now.
Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.
May 14, 2012, 6:00 am EST | 2 min read
If you’ve just updated to Ubuntu 12.04, you may notice an option missing in its system menu. The Hibernate option is now hidden by default, but you can get it back if you prefer to hibernate your system.
Hibernate is disabled by default because it can cause problems on some system configurations. You should perform a hibernate with a special command to test that it works properly before re-enabling it.
Hibernate vs. Suspend
The Suspend option is still available in Ubuntu’s system menu. Like hibernate, suspend saves your open programs and data, so you can quickly resume to your previous sate. However, suspend requires power — while in suspend mode, your computer will continue to draw a small amount of power. If the system loses power — for example, if you unplug a desktop computer from the power socket or a laptop’s battery empties, you’ll lose your work.
In contras, hibernate saves your system’s state to your hard disk and shuts the system off, consuming no power. When you resume from hibernate, your open programs and data will be restored. Hibernate saves power, but it takes longer – the computer has to restore data to the RAM, while suspend preserves the data in the RAM.
Why It’s Disabled
Hibernate doesn’t work properly on many hardware configurations with Ubuntu and other Linux distributions. If hibernate doesn’t work properly on your system, you may resume from hibernate to find that your work has been lost. Some hardware drivers may also not work properly with hibernate — for example, Wi-Fi hardware or other devices may not work after resuming from hibernate.
To prevent new users from encountering these bugs and losing their work, hibernate is disabled by default.
Before re-enabling hibernate, you should test it to verify it works properly on your system. First, save your work in all open programs — you’ll lose it if hibernate doesn’t work properly.
To test hibernate, launch a terminal. Type terminal into the Dash and or use the Ctrl-Alt-T keyboard shortcut.
In the terminal, run the following command:
Your system will shut down. After running the command, turn your system back on — if your open programs reappear, hibernate works properly.
While hardware incompatibilities are a major problem with hibernate, there’s one other common problem. Hibernate saves the contents of your RAM to your swap partition. Therefore, your swap partition must be at least as large as your RAM. If you have a 2GB swap partition and 4GB of RAM, hibernate won’t work properly.
A quick way to compare your RAM and swap sizes is with the System Monitor application.
You can view the memory and swap sizes on the Resources tab. “Memory” here refers to your RAM.
If really want to use hibernate and your swap partition is smaller than your RAM, try running GParted from a live CD. You can run GParted from a Ubuntu live CD or a dedicated GParted live CD. From the live CD, you can resize your Ubuntu partitions — you can’t do this while they’re in-use.
You can run the sudo pm-hibernate command whenever you want to hibernate, but this is inconvenient. To re-enable the hibernate option in the menus, you’ll have to create a PolicyKit file.
You can use any text editor for this, but we’ll use gedit in this example. Run the following command to launch gedit as the root user and specify the file you want to create:
gksu gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Paste the following text into the file:
Save the text file, then log out and log back in. You’ll be able to hibernate from the system menu.
If you like continuing your work from where you left off the last time, such as when using multiple workspaces or regularly using the same applications to perform the same tasks arranged in a similar fashion, you would probably like your computer to remember how everything was arranged when you switched it off.
Of course, there is a special state called “hibernation” to allow for just that, but if you are an Ubuntu user you may have noticed that hibernation is no longer an option. Unfortunately, the standard hibernation that would save your computer’s state to disk before shutting down the system then reload it upon boot, was disabled in Ubuntu 12.04 and beyond for being buggy and unreliable.
If you are using the recent version of Ubuntu, the old dconf trick of turning on org > gnome > gnome-session > auto-save-session will not work either.
Fortunately there is a way to re-enable hibernate in Ubuntu through editing some policykit configurations. So if you are confident in changing your system configurations, just follow the simple tutorial below.
Note: The below modifications have the potential to mess up your system. Please proceed with care and caution and make backups of your important data or even your entire system. Proceed at your own risk. The author is in no way responsible if anything breaks. If you don’t feel confident to troubleshoot a problem, it is best to close this browser window now, have a coffee, and forget about this tutorial at least for the time being.
Checking if hibernation works at all
Before proceeding with permanently changing your system, you should first try to see if you can hibernate it. For this you will need a swap partition that is at least as large as your physical RAM and that will auto-mount at system startup (if you installed Ubuntu with the default options you should probably have it). Save all your work (possibly even make backup if you prefer to be really safe), but leave some windows open. Now open a terminal either from your dash or with the keyboard shortcut “Ctrl + Alt + T” and type
Your system will shut down. Once it is completely powered off, turn it on and see if your last session was restored. If it worked, you can safely proceed; hibernation will work as expected. If your session did not restore, or if you encounter errors, that can be for a number of reasons, and unless you can iron it out, it is best not to proceed with the below modifications.
(MTE has already provided a short tutorial for enabling hibernation in Ubuntu 12.04. Things have changed a little since, so the previous tutorial might not work for the recent version of Ubuntu.)
If you are certain that hibernation will work on your system, you can put the hibernation menu back into where it used to be by creating the file /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla as root with your favourite text editor. With nano you would type:
and insert the following lines:
Ubuntu has switched from upower to logind since 14.04, so the above code should be sufficient. For earlier versions or if the above does not seem to work, you can try:
(Note: this will probably not work for versions below 13.10.)
If you are not sure, or just want to be on the safe side, you can include both versions.
Save the file and either reboot your system or restart the indicator session, with
The “Hibernate” options should now appear as before
Hibernation is a useful feature that would enable you to save your current session and continue working as if uninterrupted. Unfortunately removed by Ubuntu, the option can be easily re-enabled and used for enhanced productivity with the above simple method.
Attila is a writer, blogger and author with a background in IT management. Using GNU/Linux systems both personally and professionally, his advice stems from 10+ years of hands on experience. In his free time he also runs the popular Meditation for Beginners blog.
It seems that Canonical always finds a way to annoy users after the release of each new Ubuntu operating system version. And this time around they have done it again by excluded the Hibernate option from the Session Menu in Ubuntu 12.04. Nonetheless, the Hibernate option is easier to enable than you might think, even if it requires some tweaking with a system file. If you would like to re-enable the Hibernate option in Ubuntu 12.04 Precise Pangolin, then follow the instructions given below.
In the first step enter the following command in a Terminal window.
This will open the hibernate.pkla file. Copy and paste the following text in the file and hit save.
Once done, restart your system for the changes to take effect.
This will enable the Hibernate option. You can see the comparison given in the below screenshots, The left-hand side image displays the default session menu, whereas, the left-hand side image shows the session menu after editing the hibernate.pkla file.
While I will admit that it isn’t all that hard to enable the Hibernate option by using the above mentioned method, I must add that such tweaking is the same reason why many people do not use Ubuntu and other Linux distributions or remain reluctant to switch from other operating systems (such as Windows) to Linux. Why such a minor option is not enabled by default or enabling it requires file tweaking is beyond my understanding. What’s worse is that Canonical will probably not learn any lessons from users complaints regarding such common annoyances.
The Hibernate feature is not active by default under Ubuntu 12.04 (Precise Pangolin). This set of instructions will describe how it can be activated from the command line.
The Hibernate feature has been deactivated since this version of Ubuntu, as the feature does not work properly on many computers.
Unfortunately at this time, there is no way to activate it from the GUI (see ).
Before activating the Hibernate feature, it should be tested from the command line. Open a console to do this and execute the following command:
The computer should then switch to hibernate mode and shutdown. After a re-start, all of the applications that were open before Hibernate was executed should be available again. If this does not work, check the prerequisites for the Hibernate feature (see #Prerequisites for Hibernate).
In order to activate this feature in the GUI, you must create the following file: /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
After re-booting, the Hibernate feature should be able to be activated from the Power menu.
Prerequisites for Hibernate
The Hibernate mode uses the Linux swap partition to store the contents of the main memory (RAM). For that reason, the swap partition should be at least as large as the amount of RAM in use.
You will find additional information regarding the Swap and Hibernate features here: https://help.ubuntu.com/community/SwapFaq#line-56
If the swap partition has been encrypted, this can be problematic for Hibernate (see ).
Are you doing multi-tasking on your Linux machine and suddenly there is a power cut? Is your Laptop battery low or have any problem with your PC’s UPS? Then Hibernate is a good option for you! You can save all your work and resume where you left after switching on the computer.
Table of Contents
What is Hibernate?
Hibernate is an option that allows you to save your system state immediately to your hard-disk, so that when you switch on back then all the programs can be restored from the hard-disk and you can start working again with the same system state as you had before switching off, without losing any data.
Hibernate saves all of your RAM data to hard-disk and restores back into RAM after you turn on the computer.
In Ubuntu Hibernate is not enabled by default, so you will have to do it manually. But don’t worry It will not take much time once you’ve all the requirements.
Before we continue there are some important things to know in order to enable Hibernate.
Why Hibernate is not enabled?
When Hibernate can save work in an emergency then why it’s not enabled by default. Well, Hibernate does not work properly with many hardware configurations in Ubuntu and other Linux distributions. If hibernate does not work properly then this might cause data loss after switching back on from hibernation. So PCs or Laptops capable of enabling hibernate option can enable it manually.
Is my Hardware is Capable of Hibernate?
You can simply know if your system works properly with hibernate or not. Simply save all your work (otherwise you’ll lose work if hibernate does not work properly) and Open up Terminal from dash or ctrl+alt+t.
Type and run the following command in Terminal.
As you run the command, your computer will switch off. Switch back on and see if all your programs that were running before switching off are still running. If all programs are running then Hibernate is working properly.
There is one more common problem. As I told you above hibernate saves all your RAM data to the swap partition that you configured when you installed Ubuntu. That’s why the swap partition must be more than or equal to RAM. To check your swap partition open ‘System Monitor’.
In the Resources Tab check your RAM memory and Swap. If swap is more then you’re good to go, Otherwise, if you still need to enable hibernate then run gparted from a live cd and increase Swap memory.
Enable Hibernate in System Menu
The indicator-session was updated to use logind instead of upower. Hibernate is disabled by default in both upower and logind.
Run the following commands to enable hibernate.
Tips: if the config file does not work for you, try another one by changing /var/lib to /etc in the code.
Copy and paste the below lines to the file and save it.
Log out or Restart your system and you’ve done. After you login, you’ll see hibernate option in your system Menu above in the tray.
LinuxAndUbuntu hosting is sponsored by massiveGRID
For a while, the Ubuntu Linux operating system has taken away the user’s ability to set their computer in “Hibernate” mode. There are several reasons for this, like the Hibernate function not always working, or that most people don’t ever use the feature and prefer Suspend. Even though Hibernate mode on Ubuntu is less popular (and less reliable) than Suspend, it’s still useful. One of the best aspects to Hibernate is that it powers the machine off rather than setting it to low-power mode: something that is a massive help for the battery life of laptop computers.
If this introduction has sold you on Hibernate, or maybe you’ve always wondered why the feature has been taken away, we’ve got good news! As it turns out, anyone can re-enable Hibernate mode on Ubuntu Linux with a few tweaks.
Hibernate vs Suspend
Many Ubuntu Linux users assume that “Suspend” and “Hibernate” are the same. They aren’t. The primary differences between Suspend and Hibernate are how they handle power management when your PC “goes to sleep.”
When you click the “Suspend” button on your KDE or Gnome desktop environment, your computer doesn’t sleep. Instead, it goes into low-power mode, and everything is saved to the RAM. While your Ubuntu computer is in this state, it’ll still drain your laptop’s battery, or use power, albeit minimally.
Hibernation, on the other hand, doesn’t use power at all. When your Ubuntu Linux PC is set to Hibernate, the entire state of the computer is saved to the hard drive and put in a frozen state, which uses no power.
Both Suspend and Hibernate have their use cases. For example: if you’re always on your laptop and need it at a moments notice, Suspend is a good choice, as it can resume very fast. On the other hand, if you need to conserve battery-life Hibernate may be better, and so on.
Re-enable Hibernate on Ubuntu
In order to use the Hibernate feature inside of Ubuntu Linux, you must install a package. This package is a collection of scripts, including the Hibernate function.
To get your hands on the Pm-utils package, you’ll need to launch a terminal window. Opening a terminal window can be done by pressing Ctrl + Alt + T, or Ctrl + Shift + T in some cases.
Once the terminal window is open, use the Apt package manager and load up the Pm-utils package.
After the Pm-utils package is set up on your Ubuntu computer, the Hibernate function is useable. If you’d like to test it, go to the terminal and run the command below.
Note: the Hibernate command will not work without sudo or root account access. Don’t try to run it without it, because it won’t work and could cause some problems!
Assuming the pm-hibernate command runs successfully, Hibernation is working through the terminal, and you’ll be able to use it that way. If you’re happy with setting your Ubuntu PC into Hibernate mode via the terminal, end the tutorial here. Otherwise, move on to the next section where we cover how to re-add the option to the menu.
Re-adding the Hibernate button in Ubuntu
Hibernation is now enabled on your Ubuntu PC. However, the only way to use it is by invoking the Pm-utils hibernation command through the terminal. For average users, this is not very user-friendly. So, if you plan to use this feature regularly, it’s a great idea to add a “Hibernate” button.
Re-adding the Hibernate button is done by modifying the “com.ubuntu.desktop.pkla” file. To edit this file, you’ll need to gain a root shell and then open it up in Nano.
In the terminal, gain a root shell with sudo -s.
Now that your terminal shell has super-user access open up the “com.ubuntu.desktop.pkla” file in the Nano text editor.
In Nano, press the Ctrl + W button. Pressing this keyboard combination will allow you to search the config file. In the search box, type “Disable hibernate” and press the Enter key to jump to the section of the config file that specifies Hibernation settings for Ubuntu.
Under “Disable hibernate by default in upower” and “Disable hibernate” by default in logind,” look for the line below.
And change it so that it looks like:
When you’re done making the changes to the configuration file press the Ctrl + O keyboard combination to save. Then, exit the Nano text editor by pressing Ctrl + X.
Hibernate mode on Ubuntu
The new button is added. If you’re using KDE Plasma 5, XFCE4, Mate or a similar Linux distribution, the “Hibernate” option should appear.
Are you using Ubuntu’s Gnome Shell desktop environment? You’ll need to install the “Hibernate Status Button” extension first. Without this extension, you won’t be able to click the “Hibernate” button in Gnome.
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Jika Anda baru saja memperbarui ke Ubuntu 12.04, Anda mungkin melihat opsi yang hilang di menu sistemnya. Opsi Hibernate sekarang disembunyikan secara default, tetapi Anda bisa mendapatkannya kembali jika Anda lebih suka hibernate sistem Anda.
Hibernate dinonaktifkan secara default karena dapat menyebabkan masalah pada beberapa konfigurasi sistem. Anda harus melakukan hibernate dengan perintah khusus untuk menguji apakah berfungsi dengan benar sebelum mengaktifkannya kembali.
Hibernate vs. Menangguhkan
Opsi Suspend masih tersedia di menu sistem Ubuntu. Seperti hibernate, suspend menyimpan program dan data Anda yang terbuka, sehingga Anda dapat dengan cepat melanjutkan ke sate sebelumnya. Namun, suspend membutuhkan daya – saat dalam mode suspend, komputer Anda akan terus menarik sejumlah kecil daya. Jika sistem kehilangan daya – misalnya, jika Anda mencabut komputer desktop dari soket listrik atau baterai laptop kosong, Anda akan kehilangan pekerjaan Anda.
Di contras, hibernate menyimpan status sistem Anda ke hard disk Anda dan mematikan sistem, tidak memakan daya. Ketika Anda melanjutkan dari hibernate, program dan data terbuka Anda akan dipulihkan. Hibernate menghemat daya, tetapi membutuhkan waktu lebih lama – komputer harus memulihkan data ke RAM, sementara menangguhkan mempertahankan data dalam RAM.
Mengapa Ini Dinonaktifkan
Hibernate tidak berfungsi dengan baik pada banyak konfigurasi perangkat keras dengan Ubuntu dan distribusi Linux lainnya. Jika hibernate tidak berfungsi dengan baik di sistem Anda, Anda dapat melanjutkan dari hibernate untuk menemukan bahwa pekerjaan Anda telah hilang. Beberapa driver perangkat keras mungkin juga tidak berfungsi dengan baik dengan hibernate – misalnya, perangkat keras Wi-Fi atau perangkat lain mungkin tidak berfungsi setelah melanjutkan dari hibernate.
Untuk mencegah pengguna baru menghadapi bug ini dan kehilangan pekerjaan mereka, hibernate dinonaktifkan secara default.
Sebelum mengaktifkan kembali hibernate, Anda harus mengujinya untuk memastikannya berfungsi dengan baik pada sistem Anda. Pertama, simpan pekerjaan Anda di semua program terbuka – Anda akan kehilangannya jika hibernate tidak berfungsi dengan baik.
Untuk menguji hibernate, luncurkan terminal. Ketik terminal ke Dash dan atau gunakan pintasan keyboard Ctrl-Alt-T.
Di terminal, jalankan perintah berikut:
Sistem Anda akan mati. Setelah menjalankan perintah, nyalakan kembali sistem Anda – jika program terbuka Anda muncul kembali, hibernate berfungsi dengan benar.
Mengatasi masalah Hibernate
Meskipun ketidakcocokan perangkat keras adalah masalah besar dengan hibernate, ada satu masalah umum lainnya. Hibernate menyimpan isi RAM Anda ke partisi swap Anda. Oleh karena itu, partisi swap Anda harus setidaknya sebesar RAM Anda. Jika Anda memiliki partisi swap 2GB dan RAM 4GB, hibernate tidak akan berfungsi dengan baik.
Cara cepat untuk membandingkan ukuran RAM dan swap Anda adalah dengan aplikasi System Monitor.
Anda dapat melihat ukuran memori dan swap pada tab Sumber Daya. “Memori” di sini mengacu pada RAM Anda.
Jika benar-benar ingin menggunakan hibernate dan partisi swap Anda lebih kecil dari RAM Anda, coba jalankan GParted dari live CD. Anda dapat menjalankan GParted dari live CD Ubuntu atau CD live GParted khusus. Dari live CD, Anda dapat mengubah ukuran partisi Ubuntu Anda – Anda tidak dapat melakukan ini saat mereka sedang digunakan.
Aktifkan kembali Hibernate
Anda dapat menjalankan perintah sudo pm-hibernate kapan pun Anda ingin hibernate, tetapi ini tidak nyaman. Untuk mengaktifkan kembali opsi hibernasi di menu, Anda harus membuat file PolicyKit.
Anda dapat menggunakan editor teks apa pun untuk ini, tetapi kami akan menggunakan gedit dalam contoh ini. Jalankan perintah berikut untuk meluncurkan gedit sebagai pengguna root dan tentukan file yang ingin Anda buat:
gksu gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Tempel teks berikut ke dalam file:
[Enable Hibernate] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes
Simpan file teks, lalu keluar dan masuk kembali. Anda akan dapat hibernasi dari menu sistem.