I applied hibernation for fedora 41, hibernate is not working

I followed all the steps, and since most of them were blocked, I added sudo code and completed the step successfully.

Only this part was a problem:

After you’ve logged in again check the audit log, compile a policy and install it. The -b option filters for audit log entries from last boot. The -M option compiles all filtered rules into a module, which is then installed using semodule -i.

**$ audit2allow -b** #============= systemd_sleep_t ============== allow systemd_sleep_t unlabeled_t:dir search; **$ cd /tmp $ audit2allow -b -M systemd_sleep $ semodule -i systemd_sleep.pp**

I got the following errors:

$ sudo audit2allow -b
[sudo] password for macellan: 
Option ENRICHED not found - line 9
NOTE - using built-in end_of_event_timeout: 2
NOTE - using built-in logs: /var/log/audit/audit.log

$ cd /tmp

$ audit2allow -b -M systemd_sleep
Error opening config file (Erişim engellendi)
NOTE - using built-in end_of_event_timeout: 2
NOTE - using built-in logs: /var/log/audit/audit.log
Error opening /var/log/audit/audit.log (Erişim engellendi)
compilation failed:
systemd_sleep.te:6:ERROR 'syntax error' at token '0' on line 6:


/usr/bin/checkmodule:  error(s) encountered while parsing configuration
$ sudo audit2allow -b -M systemd_sleep
Option ENRICHED not found - line 9
NOTE - using built-in end_of_event_timeout: 2
NOTE - using built-in logs: /var/log/audit/audit.log
could not write output file: [Errno 13] Erişim engellendi: 'systemd_sleep.te'

$ audit2allow -b -M systemd_sleep
Option ENRICHED not found - line 9
NOTE - using built-in end_of_event_timeout: 2
NOTE - using built-in logs: /var/log/audit/audit.log
could not write output file: [Errno 13] Erişim engellendi: 'systemd_sleep.te'
$ systemctl hibernate
Call to Hibernate failed: Sleep verb 'hibernate' is not configured or configuration is not supported by kernel
$ swapon
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition   8G   0B  100
$ semodule -i systemd_sleep.pp
libsemanage.semanage_create_store: Could not read from module store, active modules subdirectory at /var/lib/selinux/targeted/active/modules. (Permission denied).
libsemanage.semanage_direct_connect: could not establish direct connection (Permission denied).
semodule:  Could not connect to policy handler

audit2allow -w -a
In this command output There was no line related to “systemd-sleep”.

I rebooted a few more times, but hibernate didn’t work:

$ systemctl hibernate
Call to Hibernate failed: Sleep verb 'hibernate' is not configured or configuration is not supported by kernel

Hmmm. Hmmm. Hmmm. Systemd 254+ writes the information necessary to resume to an EFI variable. In most cases manual configuration on the kernel commandline should not be necessary at all.

It’d be great to post an updated version of that article with simplified instructions. @w4tsn, would you be up for that?

2 Likes

This works for me:

$ sudo touch /swapfile
$ sudo chattr +C /swapfile
$ sudo fallocate --length 400M /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap -L SWAPFILE /swapfile
Setting up swapspace version 1, size = 400 MiB (419426304 bytes)
LABEL=SWAPFILE, UUID=ee5307b3-b6d7-4849-966d-2c58a588f49f
$ sudo bash -c 'echo /swapfile swap swap defaults 0 0 >>/etc/fstab'
$ sudo swapon -a
$ swapon -s
Filename	Type		Size		Used	Priority
/dev/zram0   partition	1992700		0		100
/swapfile    file		409596		0		-2
$ sudo systemctl hibernate

The logs from hibernation & resume:

2024-11-09T13:25:27.021613+02:00 systemd[1]: Reached target sleep.target.
2024-11-09T13:25:27.022640+02:00 systemd[1]: Starting systemd-hibernate.service...
2024-11-09T13:25:27.040960+02:00 systemd[1]: session-1.scope: Unit now frozen-by-parent.
2024-11-09T13:25:27.041110+02:00 systemd[1]: user@1000.service: Unit now frozen-by-parent.
2024-11-09T13:25:27.041121+02:00 systemd[1]: user-1000.slice: Unit now frozen-by-parent.
2024-11-09T13:25:27.041137+02:00 systemd[1]: user.slice: Unit now frozen.
2024-11-09T13:25:27.041270+02:00 systemd-sleep[1413]: Successfully froze unit 'user.slice'.
2024-11-09T13:25:27.056624+02:00 kernel: PM: Image not found (code -16)
2024-11-09T13:25:27.056773+02:00 systemd-sleep[1413]: Performing sleep operation 'hibernate'...
2024-11-09T13:25:27.057621+02:00 kernel: PM: hibernation: hibernation entry
2024-11-09T13:25:40.097463+02:00 kernel: Filesystems sync: 0.009 seconds
2024-11-09T13:25:40.097737+02:00 kernel: Freezing user space processes
2024-11-09T13:25:40.097837+02:00 kernel: Freezing user space processes completed (elapsed 0.001 seconds)
2024-11-09T13:25:40.097915+02:00 kernel: OOM killer disabled.
...
2024-11-09T13:25:40.098675+02:00 kernel: PM: hibernation: Basic memory bitmaps created
2024-11-09T13:25:40.098747+02:00 kernel: PM: hibernation: Preallocating image memory
2024-11-09T13:25:40.098824+02:00 kernel: PM: hibernation: Allocated 194863 pages for snapshot
2024-11-09T13:25:40.098885+02:00 kernel: PM: hibernation: Allocated 779452 kbytes in 0.08 seconds (9743.15 MB/s)
2024-11-09T13:25:40.098953+02:00 kernel: Freezing remaining freezable tasks
2024-11-09T13:25:40.099025+02:00 kernel: Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
2024-11-09T13:25:40.099091+02:00 kernel: printk: Suspending console(s) (use no_console_suspend to debug)
2024-11-09T13:25:40.099169+02:00 kernel: Disabling non-boot CPUs ...
2024-11-09T13:25:40.099236+02:00 kernel: smpboot: CPU 1 is now offline
2024-11-09T13:25:40.099308+02:00 kernel: PM: hibernation: Creating image:
2024-11-09T13:25:40.099375+02:00 kernel: PM: hibernation: Need to copy 184291 pages
2024-11-09T13:25:40.099439+02:00 kernel: PM: hibernation: Normal pages needed: 184291 + 1024, available pages: 334404
2024-11-09T13:25:40.099499+02:00 kernel: Enabling non-boot CPUs ...
2024-11-09T13:25:40.099565+02:00 kernel: smpboot: Booting Node 0 Processor 1 APIC 0x1
2024-11-09T13:25:40.099634+02:00 kernel: CPU1 is up
2024-11-09T13:25:40.099698+02:00 kernel: usb usb1: root hub lost power or was reset
2024-11-09T13:25:40.100804+02:00 kernel: usb usb2: root hub lost power or was reset
2024-11-09T13:25:40.101807+02:00 kernel: virtio_scsi virtio2: 2/0/0 default/read/poll queues
2024-11-09T13:25:40.102404+02:00 kernel: virtio_blk virtio4: 2/0/0 default/read/poll queues
2024-11-09T13:25:40.102927+02:00 kernel: usb 1-1: reset high-speed USB device number 2 using xhci_hcd
...
2024-11-09T13:25:40.104670+02:00 kernel: PM: hibernation: Basic memory bitmaps freed
2024-11-09T13:25:40.104843+02:00 kernel: OOM killer enabled.
2024-11-09T13:25:40.104958+02:00 kernel: Restarting tasks ... done.
2024-11-09T13:25:40.105068+02:00 kernel: PM: hibernation: hibernation exit
2024-11-09T13:25:40.098538+02:00 systemd-sleep[1413]: System returned from sleep operation 'hibernate'.
2024-11-09T13:25:40.107329+02:00 systemd[1]: user@1000.service: Unit now thawed.
2024-11-09T13:25:40.107390+02:00 systemd[1]: session-1.scope: Unit now thawed.
2024-11-09T13:25:40.107430+02:00 systemd[1]: user-1000.slice: Unit now thawed.
2024-11-09T13:25:40.107468+02:00 systemd[1]: user.slice: Unit now thawed.
2024-11-09T13:25:40.109647+02:00 systemd-sleep[1413]: Successfully thawed unit 'user.slice'.
2024-11-09T13:25:40.109985+02:00 systemd-resolved[794]: Clock change detected. Flushing caches.
2024-11-09T13:25:40.111102+02:00 systemd[1]: systemd-hibernate.service: Deactivated successfully.
2024-11-09T13:25:40.111591+02:00 systemd[1]: Finished systemd-hibernate.service.
2024-11-09T13:25:40.117309+02:00 systemd[1]: Reached target hibernate.target.
2024-11-09T13:25:40.117527+02:00 systemd[1]: Stopped target sleep.target.
2024-11-09T13:25:40.117935+02:00 systemd[1]: Stopped target hibernate.target.
2024-11-09T13:25:40.119884+02:00 systemd-logind[835]: Operation 'hibernate' finished.
...
2024-11-09T13:25:42.123455+02:00 polkitd[817]: g_error_free: assertion 'error != NULL' failed
2024-11-09T13:25:42.123505+02:00 polkitd[817]: g_error_free: assertion 'error != NULL' failed
2024-11-09T13:25:44.141043+02:00 ModemManager[900]: <msg> [base-manager] couldn't check support for device '/sys/devices/pci0000:00/0000:00:02.0/0000:>
2024-11-09T13:25:48.897814+02:00 kernel: tpm tpm0: NULL key integrity failure!
2024-11-09T13:25:48.901812+02:00 kernel: tpm tpm0: NULL Seed name comparison failed
2024-11-09T13:25:48.902221+02:00 kernel: tpm tpm0: NULL name has changed, disabling TPM due to interference

I don’t have SB on this machine. The TPM error looks strange. Maybe it’s some issue with how the TPM storage is set up.

1 Like
$ sudo swapon -a
[sudo] password for xxyyzz: 
swapon: /dev/sda3: read swap header failed
$ swapon -s
Filename				Type		Size		Used		Priority
/dev/zram0                              partition	8388604		1337856		100
$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 223,6G  0 disk 
├─sda1   8:1    0   600M  0 part /boot/efi
├─sda2   8:2    0     1G  0 part /boot
└─sda3   8:3    0   222G  0 part /home
                                 /
$ sudo mkswap -L SWAPFILE /swap/swapfile
mkswap: /swap/swapfile: warning: wiping old swap signature.
Setting up swapspace version 1, size = 24 GiB (25769799680 bytes)
LABEL=SWAPFILE, UUID=cebe1a8d-2a4c-40d6-8438-a90600efa1d3
$ sudo nano /etc/fstab

add:
UUID=13b41958-faf1-4dcf-8df0-91693dbe1a4d /swap/swapfile swap swap defaults 0 0
Ctrl +0 > Enter > Ctrl + X

Is the UUID incorrect? Because in the guide on the website it says to write the output of this code as UUID:

$ findmnt -no UUID -T /swap/swapfile
13b41958-faf1-4dcf-8df0-91693dbe1a4d

Do I need to add this to /etc/fstab file:

UUID=cebe1a8d-2a4c-40d6-8438-a90600efa1d3 /swap/swapfile   swap   swap    defaults                      0 0

Did I do this correctly?

Or should I run this code:

sudo bash -c 'echo /swap/swapfile swap swap defaults 0 0 >>/etc/fstab'

I ran this code:

sudo bash -c 'echo /swap/swapfile swap swap defaults 0 0 >>/etc/fstab'

Then:

$ sudo nano /etc/fstab

I deleted this line:
UUID=13b41958-faf1-4dcf-8df0-91693dbe1a4d /swap/swapfile swap swap defaults 0 0

The following line is written:
/swap/swapfile swap swap defaults 0 0

Ctrl +O > Enter > Ctrl +X

Then:

$ sudo swapon -a
$

I received no errors.

Then:

$ swapon -s
Filename				Type		Size		Used		Priority
/dev/zram0                              partition	8388604		1337856		100
/swap/swapfile                          file		25165820	0		-2

Do you think I’ve managed to do it now?

Then:

$ sudo systemctl hibernate
Call to Hibernate failed: Sleep verb 'hibernate' is not configured or configuration is not supported by kernel

Not working.

Do you have secure boot enabled?
bootctl status shows this in one of the first few lines.

System:
      Firmware: n/a (n/a)
 Firmware Arch: x64
   Secure Boot: enabled (user)
  TPM2 Support: yes
  Measured UKI: no
  Boot into FW: supported

Can you answer this question please? Where did I go wrong?


$ journalctl -f
Kas 09 03:34:57 fedora systemd[1]: user@0.service: Deactivated successfully.
Kas 09 03:34:57 fedora systemd[1]: Stopped user@0.service - User Manager for UID 0.
Kas 09 03:34:57 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:57 fedora systemd[1]: Stopping user-runtime-dir@0.service - User Runtime Directory /run/user/0...
Kas 09 03:34:58 fedora systemd[1]: run-user-0.mount: Deactivated successfully.
Kas 09 03:34:58 fedora systemd[1]: user-runtime-dir@0.service: Deactivated successfully.
Kas 09 03:34:58 fedora systemd[1]: Stopped user-runtime-dir@0.service - User Runtime Directory /run/user/0.
Kas 09 03:34:58 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user-runtime-dir@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:58 fedora systemd[1]: Removed slice user-0.slice - User Slice of UID 0.
Kas 09 03:34:58 fedora systemd-logind[1022]: Removed session 5.
Kas 09 03:36:56 fedora systemd[2096]: Created slice app-dbus\x2d:1.2\x2dorg.gnome.Nautilus.slice - Slice /app/dbus-:1.2-org.gnome.Nautilus.
Kas 09 03:36:56 fedora systemd[2096]: Started dbus-:1.2-org.gnome.Nautilus@0.service.
Kas 09 03:36:56 fedora nautilus[9780]: Connecting to org.freedesktop.Tracker3.Miner.Files
Kas 09 03:36:56 fedora nautilus[9780]: Unknown key gtk-modules in /home/macellan/.config/gtk-4.0/settings.ini
Kas 09 03:36:57 fedora systemd[2096]: Reached target gnome-session-x11-services.target - GNOME session X11 services.
Kas 09 03:36:57 fedora systemd[2096]: Starting org.gnome.SettingsDaemon.XSettings.service - GNOME XSettings service...
Kas 09 03:36:57 fedora gnome-shell[9801]: The XKEYBOARD keymap compiler (xkbcomp) reports:
Kas 09 03:36:57 fedora gnome-shell[9801]: > Warning:          Unsupported maximum keycode 708, clipping.
Kas 09 03:36:57 fedora gnome-shell[9801]: >                   X11 cannot support keycodes above 255.
Kas 09 03:36:57 fedora gnome-shell[9801]: > Warning:          Could not resolve keysym XF86KbdInputAssistPrevgrou
Kas 09 03:36:57 fedora gnome-shell[9801]: > Warning:          Could not resolve keysym XF86KbdInputAssistNextgrou
Kas 09 03:36:57 fedora gnome-shell[9801]: Errors from xkbcomp are not fatal to the X server
Kas 09 03:36:57 fedora gsd-xsettings[9802]: Failed to get current UI scaling factor: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Destination does not exist
Kas 09 03:36:57 fedora systemd[2096]: Started org.gnome.SettingsDaemon.XSettings.service - GNOME XSettings service.
Kas 09 03:36:57 fedora systemd[2096]: Reached target gnome-session-x11-services-ready.target - GNOME session X11 services.
Kas 09 03:36:57 fedora gnome-terminal-[9645]: Failed to load module "pk-gtk-module"
Kas 09 03:36:57 fedora mutter-x11-fram[9843]: Unknown key gtk-modules in /home/macellan/.config/gtk-4.0/settings.ini
Kas 09 03:36:57 fedora mutter-x11-fram[9843]: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.
Kas 09 03:36:57 fedora systemd[2096]: Starting tracker-miner-fs-3.service - Tracker file system data miner...
Kas 09 03:36:57 fedora audit: BPF prog-id=58 op=UNLOAD
Kas 09 03:36:57 fedora audit: BPF prog-id=57 op=UNLOAD
Kas 09 03:36:57 fedora audit: BPF prog-id=100 op=LOAD
Kas 09 03:36:57 fedora audit: BPF prog-id=101 op=LOAD
Kas 09 03:36:57 fedora audit: BPF prog-id=102 op=LOAD
Kas 09 03:36:57 fedora systemd[1]: Starting systemd-hostnamed.service - Hostname Service...
Kas 09 03:36:57 fedora systemd[1]: Started systemd-hostnamed.service - Hostname Service.
Kas 09 03:36:57 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:36:58 fedora systemd[2096]: Created slice app-dbus\x2d:1.2\x2dorg.gnome.NautilusPreviewer.slice - Slice /app/dbus-:1.2-org.gnome.NautilusPreviewer.
Kas 09 03:36:58 fedora systemd[2096]: Started dbus-:1.2-org.gnome.NautilusPreviewer@0.service.
Kas 09 03:36:58 fedora gnome-shell[2227]: Invalid sequence for VSYNC frame info
Kas 09 03:36:58 fedora gvfsd[9914]: 2024-11-09 03:36:58,543:wsdd WARNING(pid 9914): no interface given, using all interfaces
Kas 09 03:36:58 fedora systemd[2096]: Started tracker-miner-fs-3.service - Tracker file system data miner.
Kas 09 03:37:00 fedora anacron[5975]: Job `cron.daily' started
Kas 09 03:37:00 fedora anacron[5975]: Job `cron.daily' terminated
Kas 09 03:37:00 fedora anacron[5975]: Normal exit (1 job run)

$ journalctl -b
Kas 09 03:01:00 fedora CROND[5962]: (root) CMD (run-parts /etc/cron.hourly)
Kas 09 03:01:00 fedora run-parts[5965]: (/etc/cron.hourly) starting 0anacron
Kas 09 03:01:00 fedora anacron[5975]: Anacron started on 2024-11-09
Kas 09 03:01:00 fedora anacron[5975]: Will run job `cron.daily' in 36 min.
Kas 09 03:01:00 fedora anacron[5975]: Jobs will be executed sequentially
Kas 09 03:01:00 fedora run-parts[5977]: (/etc/cron.hourly) finished 0anacron
Kas 09 03:01:00 fedora CROND[5961]: (root) CMDEND (run-parts /etc/cron.hourly)
Kas 09 03:01:24 fedora systemd[1]: snapperd.service: Deactivated successfully.
Kas 09 03:01:24 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=snapperd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:11:50 fedora NetworkManager[1155]: <info>  [1731111110.8421] dhcp4 (enp7s0): state changed new lease, address=192.168.1.133
Kas 09 03:11:50 fedora systemd[1]: Starting NetworkManager-dispatcher.service - Network Manager Script Dispatcher Service...
Kas 09 03:11:50 fedora systemd[1]: Started NetworkManager-dispatcher.service - Network Manager Script Dispatcher Service.
Kas 09 03:11:50 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:12:00 fedora systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Kas 09 03:12:00 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:19:58 fedora gnome-shell[2227]: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.Failed: Set global engine failed: İşlem iptal edildi
                                          
                                          Stack trace:
                                            _promisify/proto[asyncFunc]/</<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:453:45
                                            @resource:///org/gnome/shell/ui/init.js:21:20
                                            ### Promise created here: ###
                                            _setEngine@resource:///org/gnome/shell/misc/ibusManager.js:286:30
                                            setEngine@resource:///org/gnome/shell/misc/ibusManager.js:299:24
                                            activateInputSource@resource:///org/gnome/shell/ui/status/keyboard.js:554:27
                                            _callHandlers@resource:///org/gnome/gjs/modules/core/_signals.js:130:42
                                            _emit@resource:///org/gnome/gjs/modules/core/_signals.js:119:10
                                            activate@resource:///org/gnome/shell/ui/status/keyboard.js:72:14
                                            _inputSourcesChanged@resource:///org/gnome/shell/ui/status/keyboard.js:692:33
                                            reload@resource:///org/gnome/shell/ui/status/keyboard.js:425:14
                                            _ibusSetContentType@resource:///org/gnome/shell/ui/status/keyboard.js:767:14
                                            _callHandlers@resource:///org/gnome/gjs/modules/core/_signals.js:130:42
                                            _emit@resource:///org/gnome/gjs/modules/core/_signals.js:119:10
                                            _setContentType@resource:///org/gnome/shell/misc/ibusManager.js:264:14
                                            @resource:///org/gnome/shell/ui/init.js:21:20
                                            
Kas 09 03:20:45 fedora zen_browser.desktop[3564]: Missing chrome or resource URL: chrome://browser/skin/aboutNetError.css
Kas 09 03:20:45 fedora zen_browser.desktop[3564]: Missing chrome or resource URL: chrome://browser/skin/aboutNetError.css
Kas 09 03:22:28 fedora zen_browser.desktop[3564]: Missing chrome or resource URL: chrome://browser/skin/aboutNetError.css
Kas 09 03:26:44 fedora zen_browser.desktop[3413]: Crash Annotation GraphicsCriticalError: |[0][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=2652.93) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
Kas 09 03:28:24 fedora audit: BPF prog-id=82 op=LOAD
Kas 09 03:28:24 fedora audit: BPF prog-id=83 op=LOAD
Kas 09 03:28:24 fedora systemd[1]: Starting plocate-updatedb.service - Update the plocate database...
Kas 09 03:28:24 fedora systemd[1]: Starting logrotate.service - Rotate log files...
Kas 09 03:28:24 fedora systemd[1]: logrotate.service: Deactivated successfully.
Kas 09 03:28:24 fedora systemd[1]: Finished logrotate.service - Rotate log files.
Kas 09 03:28:24 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=logrotate comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:28:24 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=logrotate comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:28:24 fedora audit: BPF prog-id=83 op=UNLOAD
Kas 09 03:31:02 fedora systemd[1]: plocate-updatedb.service: Deactivated successfully.
Kas 09 03:31:02 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=plocate-updatedb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:31:02 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=plocate-updatedb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:31:03 fedora audit: BPF prog-id=82 op=UNLOAD
Kas 09 03:31:02 fedora systemd[1]: Finished plocate-updatedb.service - Update the plocate database.
Kas 09 03:31:02 fedora systemd[1]: plocate-updatedb.service: Consumed 2min 5.579s CPU time, 3.7G memory peak.
Kas 09 03:31:03 fedora systemd[1]: fwupd.service: Deactivated successfully.
Kas 09 03:31:03 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=fwupd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:35 fedora systemd[2096]: Started app-gnome-org.gnome.Terminal-9637.scope - Application launched by gnome-shell.
Kas 09 03:34:35 fedora systemd[2096]: Created slice app-org.gnome.Terminal.slice - Slice /app/org.gnome.Terminal.
Kas 09 03:34:35 fedora systemd[2096]: Starting gnome-terminal-server.service - GNOME Terminal Server...
Kas 09 03:34:36 fedora systemd[2096]: Started gnome-terminal-server.service - GNOME Terminal Server.
Kas 09 03:34:36 fedora systemd[2096]: Started vte-spawn-11369c31-e4bc-48bf-a23c-ec9a78fd7fde.scope - VTE child process 9653 launched by org.gnome.Terminal process 9645.
Kas 09 03:34:47 fedora audit[9696]: USER_AUTH pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_unix acct="macellan" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
Kas 09 03:34:47 fedora audit[9696]: USER_ACCT pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix acct="macellan" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
Kas 09 03:34:47 fedora audit[9696]: USER_CMD pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='cwd="/home/macellan" cmd=73797374656D63746C2068696265726E617465 exe="/usr/bin/sudo" terminal=pts/0 res=success'
Kas 09 03:34:47 fedora sudo[9696]: macellan : TTY=pts/0 ; PWD=/home/macellan ; USER=root ; COMMAND=/usr/bin/systemctl hibernate
Kas 09 03:34:47 fedora audit[9696]: CRED_REFR pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
Kas 09 03:34:47 fedora sudo[9696]: pam_systemd(sudo:session): New sd-bus connection (system-bus-pam-systemd-9696) opened.
Kas 09 03:34:47 fedora systemd-logind[1022]: Existing logind session ID 3 used by new audit session, ignoring.
Kas 09 03:34:47 fedora systemd[1]: Created slice user-0.slice - User Slice of UID 0.
Kas 09 03:34:47 fedora systemd[1]: Starting user-runtime-dir@0.service - User Runtime Directory /run/user/0...
Kas 09 03:34:47 fedora systemd-logind[1022]: New session c3 of user root.
Kas 09 03:34:47 fedora systemd[1]: Finished user-runtime-dir@0.service - User Runtime Directory /run/user/0.
Kas 09 03:34:47 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user-runtime-dir@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:47 fedora systemd[1]: Starting user@0.service - User Manager for UID 0...
Kas 09 03:34:47 fedora audit[9703]: USER_ACCT pid=9703 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='op=PAM:accounting grantors=pam_unix acct="root" exe="/usr/lib/systemd/systemd-executor" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:47 fedora audit[9703]: CRED_ACQ pid=9703 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='op=PAM:setcred grantors=? acct="root" exe="/usr/lib/systemd/systemd-executor" hostname=? addr=? terminal=? res=failed'
Kas 09 03:34:47 fedora audit[9703]: USER_ROLE_CHANGE pid=9703 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='op=pam_selinux default-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 selected-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 exe="/usr/lib/systemd/systemd-executor" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:47 fedora systemd-logind[1022]: New session 5 of user root.
Kas 09 03:34:47 fedora audit[9703]: USER_START pid=9703 uid=0 auid=0 ses=5 subj=system_u:system_r:init_t:s0 msg='op=PAM:session_open grantors=pam_selinux,pam_selinux,pam_loginuid,pam_keyinit,pam_namespace,pam_systemd_home,pam_umask,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="root" exe="/usr/lib/systemd/systemd-executor" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:47 fedora (systemd)[9703]: pam_unix(systemd-user:session): session opened for user root(uid=0) by root(uid=0)
Kas 09 03:34:47 fedora audit: BPF prog-id=84 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=84 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=85 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=85 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=86 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=86 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=87 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=87 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=88 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=88 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=89 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=89 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=90 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=90 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=91 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=92 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=91 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=92 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=93 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=93 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=94 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=94 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=95 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=95 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=96 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=96 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=97 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=98 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=98 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=99 op=LOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=97 op=UNLOAD
Kas 09 03:34:47 fedora audit: BPF prog-id=99 op=UNLOAD
Kas 09 03:34:47 fedora systemd[9703]: Queued start job for default target default.target.
Kas 09 03:34:47 fedora systemd[9703]: Created slice app.slice - User Application Slice.
Kas 09 03:34:47 fedora systemd[9703]: grub-boot-success.timer - Mark boot as successful after the user session has run 2 minutes was skipped because of an unmet condition check (ConditionUser=!@system).
Kas 09 03:34:47 fedora systemd[9703]: Started systemd-tmpfiles-clean.timer - Daily Cleanup of User's Temporary Directories.
Kas 09 03:34:47 fedora systemd[9703]: Reached target paths.target - Paths.
Kas 09 03:34:47 fedora systemd[9703]: Reached target timers.target - Timers.
Kas 09 03:34:47 fedora systemd[9703]: Starting dbus.socket - D-Bus User Message Bus Socket...
Kas 09 03:34:47 fedora systemd[9703]: pipewire-pulse.socket - PipeWire PulseAudio was skipped because of an unmet condition check (ConditionUser=!root).
Kas 09 03:34:47 fedora systemd[9703]: Listening on pipewire.socket - PipeWire Multimedia System Sockets.
Kas 09 03:34:47 fedora systemd[9703]: Starting systemd-tmpfiles-setup.service - Create User Files and Directories...
Kas 09 03:34:47 fedora systemd[9703]: Listening on dbus.socket - D-Bus User Message Bus Socket.
Kas 09 03:34:47 fedora systemd[9703]: Reached target sockets.target - Sockets.
Kas 09 03:34:47 fedora systemd[9703]: Finished systemd-tmpfiles-setup.service - Create User Files and Directories.
Kas 09 03:34:47 fedora systemd[9703]: Reached target basic.target - Basic System.
Kas 09 03:34:47 fedora systemd[9703]: gnome-initial-setup-copy-worker.service - GNOME Initial Setup Copy Worker was skipped because of an unmet condition check (ConditionUser=!@system).
Kas 09 03:34:47 fedora systemd[9703]: Reached target default.target - Main User Target.
Kas 09 03:34:47 fedora systemd[9703]: Startup finished in 265ms.
Kas 09 03:34:47 fedora systemd[1]: Started user@0.service - User Manager for UID 0.
Kas 09 03:34:47 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:47 fedora systemd[1]: Started session-c3.scope - Session c3 of User root.
Kas 09 03:34:47 fedora sudo[9696]: pam_unix(sudo:session): session opened for user root(uid=0) by macellan(uid=1001)
Kas 09 03:34:47 fedora audit[9696]: USER_START pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_limits,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
Kas 09 03:34:47 fedora systemd-logind[1022]: /etc/systemd/sleep.conf:2: Failed to parse sec value, ignoring: 600  # Adjust delay time in seconds
Kas 09 03:34:47 fedora kernel: Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
Kas 09 03:34:47 fedora sudo[9696]: pam_systemd(sudo:session): New sd-bus connection (system-bus-pam-systemd-9696) opened.
Kas 09 03:34:47 fedora sudo[9696]: pam_unix(sudo:session): session closed for user root
Kas 09 03:34:47 fedora audit[9696]: USER_END pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_limits,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
Kas 09 03:34:47 fedora audit[9696]: CRED_DISP pid=9696 uid=1001 auid=1001 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_unix acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
Kas 09 03:34:47 fedora systemd[1]: session-c3.scope: Deactivated successfully.
Kas 09 03:34:47 fedora systemd-logind[1022]: Session c3 logged out. Waiting for processes to exit.
Kas 09 03:34:47 fedora systemd-logind[1022]: Removed session c3.
Kas 09 03:34:57 fedora systemd[1]: Stopping user@0.service - User Manager for UID 0...
Kas 09 03:34:57 fedora systemd[9703]: Activating special unit exit.target...
Kas 09 03:34:57 fedora systemd[9703]: Stopped target default.target - Main User Target.
Kas 09 03:34:57 fedora systemd[9703]: Stopped target basic.target - Basic System.
Kas 09 03:34:57 fedora systemd[9703]: Stopped target paths.target - Paths.
Kas 09 03:34:57 fedora systemd[9703]: Stopped target sockets.target - Sockets.
Kas 09 03:34:57 fedora systemd[9703]: Stopped target timers.target - Timers.
Kas 09 03:34:57 fedora systemd[9703]: Stopped systemd-tmpfiles-clean.timer - Daily Cleanup of User's Temporary Directories.
Kas 09 03:34:57 fedora systemd[9703]: Closed dbus.socket - D-Bus User Message Bus Socket.
Kas 09 03:34:57 fedora systemd[9703]: Closed pipewire.socket - PipeWire Multimedia System Sockets.
Kas 09 03:34:57 fedora systemd[9703]: Stopped systemd-tmpfiles-setup.service - Create User Files and Directories.
Kas 09 03:34:57 fedora systemd[9703]: Removed slice app.slice - User Application Slice.
Kas 09 03:34:57 fedora systemd[9703]: Reached target shutdown.target - Shutdown.
Kas 09 03:34:57 fedora systemd[9703]: Finished systemd-exit.service - Exit the Session.
Kas 09 03:34:57 fedora systemd[9703]: Reached target exit.target - Exit the Session.
Kas 09 03:34:57 fedora systemd[1]: user@0.service: Deactivated successfully.
Kas 09 03:34:57 fedora systemd[1]: Stopped user@0.service - User Manager for UID 0.
Kas 09 03:34:57 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:57 fedora systemd[1]: Stopping user-runtime-dir@0.service - User Runtime Directory /run/user/0...
Kas 09 03:34:58 fedora systemd[1]: run-user-0.mount: Deactivated successfully.
Kas 09 03:34:58 fedora systemd[1]: user-runtime-dir@0.service: Deactivated successfully.
Kas 09 03:34:58 fedora systemd[1]: Stopped user-runtime-dir@0.service - User Runtime Directory /run/user/0.
Kas 09 03:34:58 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=user-runtime-dir@0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Kas 09 03:34:58 fedora systemd[1]: Removed slice user-0.slice - User Slice of UID 0.
Kas 09 03:34:58 fedora systemd-logind[1022]: Removed session 5.

I did the following steps (except step 2, the hibernate plugin failed to install):

You have Secure Boot enabled. The kernel does not allow hibernation with SB. Thus I think you get the answer that hibernation is not supported. (The logs could be better. Systemd does display some info, but only at debug level.)

fstab fields are “what”, “where”, “type”, “options”. It seems that you’re trying to specify “what” twice, once via UUID and once via filename. In case of a file, the filename is all we need.

Also, it’s not that UUID that was used in the original recipe for the kernel command line. The UUID of the filesystem containing the swapfile was used, not the UUID of the filesystem in the swapfile. (Though as I said above, systemd now handles specifying that information and the offset of the swapfile on the partition automatically, so there is no need to mention the UUID anywhere.)

The UUID of a filesystem in the file cannot be used to find it. The way UUIDs work is that when then devices are discovered, we enumerate all devices and partitions and make note of the UUIDs. But for file systems or swap areas in files, this wouldn’t work. Instead, we refer to file by the path.

Thank you for your answer.
I will disable Secure boot (as much as I don’t want to) and try it.

Is that right?:

swap   swap

it says swap swap twice. Shouldn’t it normally say 1?

I don’t know how to do journaling, log queries.

$ sudo swapon -a
$ swapon
NAME           TYPE      SIZE USED PRIO
/swap/swapfile file       24G   0B   -2
/dev/zram0     partition   8G 3,5G  100
$ swapon -s
Filename				Type		Size		Used		Priority
/swap/swapfile                          file		25165820	0		-2
/dev/zram0                              partition	8388604		3661312		100

Yes. “swap” is once used as “where” and once as “type”.

My comment about logs wasn’t directed at you. It’s something to fix upstream in systemd code.

1 Like

I disabled Secure boot in the bios.
Hibernate did not work again.

$ sudo systemctl hibernate
Call to Hibernate failed: Access denied
$ systemctl hibernate
Call to Hibernate failed: Access denied
$ swapon -s
Filename				Type		Size		Used	Priority
/swap/swapfile                          file		25165820	0	-2
/dev/zram0                              partition	8388604		0	100
$ cd /tmp
$ sudo audit2allow -b -M systemd_sleep
Option ENRICHED not found - line 9
NOTE - using built-in end_of_event_timeout: 2
NOTE - using built-in logs: /var/log/audit/audit.log
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i systemd_sleep.pp

I tried again after entering this code.

$ sudo semodule -i systemd_sleep.pp
$ systemctl hibernate

It seemed to work. The screen turned off, the monitor disconnected. But the PC didn’t shut down. After 1 minute, the image came back. The user account login screen came up. I entered the password and logged into my account. I continued where I left off, the browser etc. was still open.

$ sudo audit2allow -b -M systemd_sleep
Option ENRICHED not found - line 9
NOTE - using built-in end_of_event_timeout: 2
NOTE - using built-in logs: /var/log/audit/audit.log
compilation failed:
systemd_sleep.te:6:ERROR 'syntax error' at token '0' on line 6:


/usr/bin/checkmodule:  error(s) encountered while parsing configuration

How do I create these log records?
I want to publish the logs to find out the source of the problem.

journalctl. See the man page for various details and examples.

In order to give reviewers here best chances to identify potential issues (including issues that might occur in the logs before the actual hibernation is initiated), I suggest to get a log of a boot.

This means, e.g.: start your machine, and then try 2 or 3 times to hibernate, but document the exact system time (including seconds) when you tried to hibernate.

Then get the logs of the whole boot (which means from the start up of the machine up to and including the hibernation attempts) with sudo journalctl --boot=0 --no-hostname0 means the current boot, so the one you are still in. --no-hostname ensures to keep some private data of yours out of the logs, but feel free to further anonymize the logs if you want to also keep, e.g., your MAC addresses or so hidden.

If you put logs here, please ensure to put the logs in a code box: mark the whole log and then click the button </> , which will then add automatically a ``` above and below the logs. This will make the actual post much better to read and avoids that the post is a kilometer long :classic_smiley:

Also, don’t forget to let the reviewers know the exact system times you attempted to hibernate. That saves some time :wink:

The reason why it can help to include the logs of a whole boot is that sometimes reviewers find issues that occur (or hardware issues that are documented) on start up and thus are logged long before the actual failed attempt happens.

Alternatively, you can start to just post extracts around the system times at which you attempted hibernations.