Skip to content

How it works

Seiichi Horie edited this page Dec 20, 2025 · 4 revisions

Overview

This document provides an overview of how the Fuyujitaku works.

Top-level procedure

  1. Extend the swap file size.
  2. Modify the /etc/default/grub file to set the swap file as the default resume storage.
  3. Update the grub configuration.
  4. Create /etc/systemd/sleep.conf.d/sleep.conf file to set the HibernateDelaySec parameter.
  5. Create /etc/polkit-1/rules.d/50-hibernate.rules file to allow the user to hibernate without a password.

Detailed procedure

Extend the swap file size

First of all, Fuyujitaku will check the swap file name and size. If the swap file is not found, it will abort the installation.

If the swap file is found, it will check if the swap file size matches the record in the ./backup directory for recovery.

By default, the swap file size is set to the double of the RAM size. User can override this value by the -s parameter.

The swap file is extended by using the dd command. Because it is an overwrite operation, it is not necessary to set the file permissions explicitly.

Modify the /etc/default/grub file

To inform the kernel where resume information is stored, we need to pass the partition UUID and file offset as kernel parameters.

After gathering the swap file information, Fuyujitaku will modify the /etc/default/grub file to set the swap file as the default resume storage.

Modification is done by using the sed command. The sed command will search for the line starting with GRUB_CMDLINE_LINUX_DEFAULT and append the resume parameter to it.

Important

The parameters are quoted by single or double quotes. It depends on the distribution. For example, in Ubuntu 24.04.2, the parameters are quoted by double quotes. In Kubuntu 25.04, the parameters are quoted by single quotes.

The script has a tricky sed command to handle both cases.

Update the grub configuration

This is an easy part.

After modifying the /etc/default/grub file, we need to update the grub configuration.

This is done by using the update-grub command.

Create /etc/systemd/sleep.conf.d/hibernate.conf file

By default, Ubuntu 24.04 and its flavors enable the hybrid sleep and Suspend-then-Hibernate. But the HibernateDelaySec parameter is not set by default.

To set the HibernateDelaySec parameter, we need to create the /etc/systemd/sleep.conf.d/hibernate.conf file.

Fuyujitaku will set the HibernateDelaySec to 1440[min] by default. User can override this value by the -d parameter.

Create /etc/polkit-1/rules.d/50-hibernate.rules file

By default, hibernation needs root privilege. But we can allow the user to hibernate without a password by creating the /etc/polkit-1/rules.d/50-hibernate.rules file.

By this modification, the user can hibernate the system without a password. Some distributions, like Kubuntu 25.04 shows the Hibernate option in the power menu. But some distributions, like Ubuntu 24.04.2, do not show the Hibernate option in the power menu.