
Learn how to install Fedora 40 Server in 12 easy steps. Follow this detailed guide with command-line examples, table charts, and essential setup tips to
Learn how to disable or block hibernation in Fedora with easy-to-follow steps. Protect system resources, enhance security, and optimize performance by disabling the hibernation feature on your Linux system.
Hibernation is a useful feature in Linux distributions, allowing users to save the current state of their system to disk and power it down. When powered on again, the system resumes from where it left off. However, there are situations where hibernation may not be necessary or even desirable. Perhaps it is causing system issues, consuming unnecessary resources, or you simply donât need it for your use case.
In this blog post, we will show you how to disable or block hibernation in Fedora. This guide is designed for Fedora users who want to control the behavior of their system’s power management and ensure that hibernation is no longer available.
There are several reasons why you might want to disable hibernation in Fedora:
|
|
|
|
Before proceeding with the process of disabling or blocking hibernation in Fedora, ensure you have the following:
|
|
Photo by admingeek from Infotechys
Fedora, like most Linux distributions, provides a straightforward method of disabling hibernation via the command-line interface (CLI).
Step 1: Check if Hibernation is Enabled |
First, let’s confirm that hibernation is enabled on your system. Run the following command:
sudo systemctl status hibernate.target
If hibernation is enabled, youâll see an output like this:
â hibernate.target
Loaded: loaded (/usr/lib/systemd/system/hibernate.target; static; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd.special(7)
Step 2: Disable Hibernation |
To disable hibernation, we need to modify the systemd configuration. You can do so by executing the following commands:
sudo systemctl mask hibernate.target
This command will prevent the system from entering hibernation mode by “masking” the hibernation target, which essentially disables it. To disable hibernation entirely, issue the following commands:Â
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
To reverse this later:
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
Step 3: Verify the Change |
After masking the hibernation target, verify that it is no longer active by running:
sudo systemctl status hibernate.target
You should see that the hibernation target is now masked or effectively disabled.
â hibernate.target
Loaded: masked (Reason: Unit hibernate.target is masked.)
Active: inactive (dead)
While disabling hibernation via systemd is one approach, it is also possible to remove swap space entirely, which prevents the system from being able to hibernate. This method is more permanent, but it requires careful handling.
Step 1: Disable Swap |
First, you will need to turn off the swap space:
sudo swapoff -a
This command will disable all swap devices currently in use.
Step 2: Remove Swap Entry from |
Next, remove the swap entry from your /etc/fstab
file to ensure it doesn’t get reactivated after a reboot. Open the file using a text editor like vim
:
sudo vim /etc/fstab
Locate the line that corresponds to the swap partition or file, and comment it out by adding a #
at the beginning of the line:
#/dev/mapper/fedora-swap swap swap defaults 0 0
Save and exit the file.
Step 3: Reboot |
Now, reboot your system to apply the changes:
sudo reboot
After rebooting, hibernation will be effectively disabled because the swap partition is no longer available.
Modify the systemd login manager to prevent auto-hibernate when idle or on lid close.
Step 1: Edit the logind.conf |
sudo vim /etc/systemd/logind.conf
Step 2: Uncomment the following lines |
Set or change the following lines:
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
HandleHibernateKey=ignore
IdleAction=ignore
Step 3: Reload logind |
sudo systemctl restart systemd-logind
Disabling or blocking hibernation in Fedora is a relatively simple process that can be achieved through the command-line (CLI), by removing swap space, or by modifying the logind configuration file. With these methods, you can tailor your Fedora system to suit your preferences and ensure that hibernation is no longer a factor in your power management strategy.
Did you find this article helpful? Your feedback is invaluable to us! Feel free to share this post with those who may benefit, and let us know your thoughts in the comments section below.
Learn how to install Fedora 40 Server in 12 easy steps. Follow this detailed guide with command-line examples, table charts, and essential setup tips to
Learn how to install VSCode on Fedora 40 with our easy, step-by-step guide. Follow RPM and repository installation methods, CLI examples, and troubleshooting tips for
Learn how to install KVM on Fedora 41 step-by-stepâcovering prerequisites, CLI & GUI configuration, networking, performance tuning, and best practices for virtualized environments. Table of