In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "Ubuntu 20.04 enable hibernation Hibernate configuration process is what", in the daily operation, I believe that many people in Ubuntu 20.04 enable hibernation Hibernate configuration process is what the problem is, editor consulted all kinds of information, sort out a simple and easy to use method of operation, hope to answer "Ubuntu 20.04 enable hibernation Hibernate configuration process is what is" the doubt is helpful! Next, please follow the editor to study!
Basics
In a broad sense, three sleep modes are supported in Linux, namely:
Suspend to RAM, or Suspend in a narrow sense, refers to this mode when suspending is mentioned later in this article.
Suspend to Disk is what we often call Hibernate.
Suspend to Both, also known as Hybrid Suspend, is a mixture of the above two modes, with both advantages (and disadvantages).
The Ubuntu desktop version only has Suspend mode by default and does not enable Hibernate mode.
The goal of suspending and hibernating is to save the current state of the frozen system and to "quickly" wake up and restore when needed later, but the two are implemented in different ways.
When the system is suspended, the running data of the system is still stored in memory (RAM, usually called MEM), so the system still consumes battery power with low power consumption. Wake-up systems recover very quickly in this state, and SSD is now the default option for many operating systems, including Apple.
When the system is dormant, the running data of the system is written to disk (DISK), and the power of the system is completely cut off (in most cases). When you wake up, you need to read data from the hard disk to memory first, because the recovery speed is slower than that of suspension, and even slower than booting up (20s vs 10s).
The advantage of dormancy is that the notebook is actually turned off, no power consumption or heating at all, no need to worry about accidental power outage, water intake and accidental touch of the keyboard wake-up system, so it can be safely carried and saved.
There are two implementations at the bottom of Linux to support suspend and hibernation, one is the swsusp that comes with the kernel, and the other is uswsusp ('Userspace Software Suspend'), which encapsulates the former and provides more functionality, and swsusp is usually sufficient.
The principle of swsusp is to write a specific status string to a file in the / sys/power directory to determine the operating system's state.
The most important files are / sys/power/state, / sys/power/mem_sleep and / sys/power/disk, which save the sleep mode, suspension method and sleep method supported by the current system, respectively. For more information, please refer to the official documentation.
The Systemd tool provides advanced commands for sleep management, systemctl suspend, systemctl hibernate, and systemctl hybrid-sleep.
Configuration
Configure / swapfile. Enabling hibernation requires a slightly larger swap space than memory. It is recommended to use swapfile. Since kernel 2.4, the performance of swapfile is not weaker than that of swap partitions, and it is easier to resize. If you use the btrfs file system, you need to upgrade the kernel to 5.0 or above to support swapfile.
# first close the existing swap space sudo swapoff-a # to allocate continuous disk space. Fallocate is more secure and faster than the dd command. Refer to the table sudo fallocate-l 20g / swapfile# behind the space size to modify permissions sudo chmod 600 / swapfile# enable swapfilesudo mkswap / swapfilesudo swapon / swapfile# to confirm the result sudo swapon-showfree
The size of the swap file can be found in the following table
Swap space size when memory is off hibernation when swap space size is enabled when hibernation is enabled maximum swap space size 4GB2GB6GB8GB8GB3GB11GB16GB12GB3GB15GB24GB16GB4GB20GB32GB24GB5GB29GB48GB32GB6GB38GB64GB64GB8GB72GB128GB
Mount / swapfile on file system startup
Echo'/ swapfile swap swap defaults 00' | sudo tee-a / etc/fstab
Configure boot kernel parameters
# check swapfile's UUIDsudo findmnt-no UUID-T / swapfile# view swap_file_offset, ignore.. Symbol sudo filefrag-v / swapfile | awk'{if ($1mm = "0:") {print substr ($4,1, length ($4)-2)}}'# Edit the grub file sudo nano / etc/default/grub# and modify the GRUB_CMDLINE_LINUX_DEFAULT parameter in the grub file to the following form # where the values of UUID and resume_offset are changed to the output GRUB_CMDLINE_LINUX_DEFAULT= "quiet splash resume=UUID=51f8eab4-d775-4020-aace-0e411ef5b8ed resume_offset=34816" # Save exit of the above two commands Then update the grub configuration sudo update-grub# edit initramfssudo nano / etc/initramfs-tools/conf.d/resume# to add the following line, replace UUID with the actual value resume=UUID=51f8eab4-d775-4020-aace-0e411ef5b8ed# save exit, and then update the initramfs configuration sudo update-initramfs-u # restart reboot
Perform a sudo systemctl hibernate test to see if you can hibernate properly after rebooting.
Configure the Gnome interface
At this time, the hibernation function has already taken effect, but it is too tedious to enter commands every time. We need to configure Gnome interface buttons.
First install the Hibernate Status Button plug-in
Then add the following configuration file
# New configuration file sudo nano / etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla# add the following and save [Re-enable hibernate by default in upower] Identity=unix-user:*Action=org.freedesktop.upower.hibernateResultActive=yes [Re-enable hibernate by default in logind] Identity=unix-user:*Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibitResultActive=yes
After reboot, you can see the suspend and hibernate buttons in the menu.
At this point, the study on "what is the process of enabling dormant Hibernate configuration for Ubuntu 20.04" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.