How to Enable Hibernate in Ubuntu 22.04 LTS
Last Updated :
17 Sep, 2024
Hibernate is a power-saving feature in Ubuntu that saves your open programs and files before completely shutting down. It allows restoring your previous session as it was when you powered on again. This means you don't have to reopen your work after restarting Ubuntu. Enabling hibernate makes this useful feature available in the power options. It can improve workflow convenience on Ubuntu 22.04 LTS for desktops and laptops. The process involves installing a package and editing a configuration file to activate hibernate support. It improves resumes and preserves the work state on rebooting Ubuntu systems.
Why Enable Hibernate Mode in Ubuntu?
Hibernate mode saves what you are working on so you can turn off your computer without losing your work. It stores your open documents, browser tabs, and programs even when powered down. When you turn your computer back on, everything reopens right where you left off. This allows you to temporarily shut down without rebooting from scratch and lose your progress. It's a convenient way for beginners to take a break while ensuring nothing gets erased from memory. In short, hibernate lets you safely power off your computer without consequences to your open tasks.
Steps to Enable Hibernation in Ubuntu 22.04 LTS
There are two primary methods to enable hibernation in Ubuntu:
Method 1: Using Terminal
Step 1: Getting the UUID
The following command is used to get the UUID ( Universal Unique Identifier ) of the Linux swap partition configured on your Ubuntu system.
sudo blkid | grep swap
The resulting line printed shows attributes of the active Linux swap partition, including the UUID unique identifier.
Copy these UUID Because , we're gonna need it in the Next Step.
Use the Given Command to See UUIDStep 2 : Open the Grub folder with Gedit and Edit the file
First of all we need to Open and edit the Grub file to do that use the below Command and hit Enter.
sudo gedit /etc/default/grub
This command opens the main GRUB configuration file for editing using the gedit text editor.
Open the GRUB File in Gedit text editorWe need to edit this file to add the resume device parameter for hibernation support. This tells GRUB which Linux swap partition to use when resuming from hibernation.
quiet splash resume=UUID=" Paste Your UUID here "
Paste your UUIDStep 3 : Update the GRUB File
The following command is used to generate and update the GRUB boot menu after changes have been made to the GRUB configuration files.
sudo update-grub
Updating the GRUB fileThis Command applies edits made to GRUB files and creates an updated boot menu reflecting those changes.
Step 4 : Start the Hibernation
The following command is used to immediately hibernate your Ubuntu system by Saving & suspending machine state to disk.
sudo systemctl hibernate
Hibernation saves the current system state including RAM contents to disk and powers down the machine.
When powered back on, the saved system state is restored and programs/sessions resume as they were before hibernation.
Start the Hibernation using this CommandMethod 2: Using GUI
Step 1: Open the Terminal
Open the file with the help of the following command. It will open in Gedit or if Gedit is not installed, you can open the file in Nano text editor by replacing "gedit" with "nano":
sudo gedit /var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla
Type or Paste the CommandStep 2: Paste the Command and Restart the Ubuntu System
Paste the following commands to enable the hibernate button in the power menu:
[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
Enable Hibernate Button CommandAfter pasting the commands, save and close the file. Then restart your Ubuntu system for the changes to take effect.
Restart the Ubuntu SystemStep 3 : Enable the Hibernation
After, restarting the System open the Power Menu the hibernate option should now be available in the power menu after rebooting.
Hibernate Button Shortcut is AvailableConclusion
Hibernate lets you conveniently resume your Ubuntu system after powering off by restoring your open programs and files. Enabling it allows your work to continue where you left off. The process involves installing a package, editing boot configurations to activate hibernation, and updating the boot menu. A few precise terminal commands set up Ubuntu to hibernate when chosen from the UI power option or when entering the 'systemctl hibernate' command. In short, it enables preserving active sessions on power off to improve workflow for Ubuntu desktop users.
Similar Reads
How to Enable the On-Screen Keyboard on Ubuntu
Ubuntu is a popular open sourced Linux distribution. It is a preferred choice for beginners as well as Technology enthusiasts. An on screen keyboard is a useful feature in Ubuntu in case there is any failure in the physical keyboard, or there is no physical keyboard attached. However, users can choo
6 min read
How to Add Swap Space on Ubuntu 20.04
Swap file takes space in the disk storage and later act as a memory for computation whenever the RAM in our system is full, it is important to create swap space in the Ubuntu system if you feel like your physical RAM is not enough to compute the work, the swap space can be created without any third
9 min read
How to Create a Project using Spring MVC and Hibernate 5?
Spring MVC is a popular model view controller framework that handles dependency injection at run time. Hibernate 5 is an ORM framework that acts as an abstraction over the database. It allows interaction with the underlying database by removing any implementation details which is handled by hibernat
4 min read
Hibernate Example without IDE
Hibernate is a powerful tool used to build applications that need to interact with a database. It is a Java framework that implements the ORM(Object Relational Mapping) technique. What is ORM? ORM stands for Object Relational Mapping. It is a technique that is used to make Java objects persistent by
3 min read
How to Enable Auto Save Feature in Gedit
In this article, we are going to see how to enable autosave features in Gedit. Gedit is a Linux text editor which is the default text editor of the Linux distribution which uses the gnome as the desktop environment like Ubuntu. And the gedit is the official text editor for the gnome desktop environm
2 min read
How to Set Up Cron Jobs in Ubuntu
Setting up cron jobs in Ubuntu allows you to automate repetitive tasks such as backups, clearing logs, or maintaining system. This guide will walk you through the steps to configure cron jobs in Ubuntu, providing detailed instructions and practical examples. Whether you're a system administrator or
5 min read
How to Fix Ubuntu Boot Problems?
Ubuntu, a popular Linux distribution, is known for its stability and reliability. However, like any operating system, it can encounter boot problems that prevent it from starting up correctly. In this guide, we will explore common Ubuntu boot issues and provide detailed solutions to resolve them, ai
5 min read
Hibernate - Logging By Log4j Using Properties File
Apache log4j is a java-based logging utility. Apache log4j role is to log information to help applications run smoothly, determine whatâs happening, and debug processes when errors occur. log4j may logs login attempts (username, password), submission form, and HTTP headers (user-agent, x-forwarded-h
2 min read
How to Enable or Disable Bluetooth in Windows 11?
Knowing how to enable Bluetooth in Windows 11 or disable Bluetooth when not in use can help you manage your device's connectivity more effectively. Whether you need to pair new devices or troubleshoot issues, understanding how to navigate the Bluetooth settings in Windows 11 is essential. In this gu
5 min read
Hibernate Example using JPA and MySQL
Hibernate is a framework that provides some abstraction layer, meaning that the programmer does not have to worry about the implementations, Hibernate does the implementations for you internally like writing queries to perform CRUD operations, establishing a connection with the database, etc. It is
4 min read