3

I'm using Pop OS 22.04. GRUB isn't used.

Here is the procedure I've followed in order to activate the swap

fich=/swap/swapfile
truncate -s 0 $fich
chattr +C $fich
btrfs property $fich compression none
fallocate -l 40G $fich
chmod 600 $fich
mkswap $fich
uuid=$(findmnt -no UUID -T $fich)
offset=$(filefrag -v $fich | awk '{ if($1=="0:"){print $4} }')
kernelstub -a "resume=UUID=$uuid"
kernelstub -a "resume_offset=$offset"
echo "resume=UUID=$uuid resume_offset=$offset" > /etc/initramfs-tools/conf.d/resume
update-initramfs -u

/swap is mounted to a BTRFS subvolume with no compression in the same partition as the root and /home. I'm not using encryption nor LUKS.

Here is the output of swapon:

# swapon --show
NAME           TYPE SIZE USED PRIO
/swap/swapfile file  40G   0B   -2

Finally when I try to hibernate, here is the result:

# systemctl hibernate
Failed to hibernate system via logind: Not enough swap space for hibernation

It should have enough space. 40 Gb > 32 Gb.

I've followed these guides:

UPDATE:

After rebooting, it doesn't complain anymore of not enough space. But hibernate doesn't seem to work....

It tries to hibernate, but it blacks out the scren for some seconds, and finally the screen remains locked. In addition USB keyboard cannot be used until I detach it and reattach it again.

This is dmesg output:

[14186.927084] r8169 0000:01:00.0 enp1s0: Link is Down
[14187.808941] PM: hibernation: hibernation entry
[14187.871279] Filesystems sync: 0.051 seconds
[14187.871346] Freezing user space processes
[14187.873604] Freezing user space processes completed (elapsed 0.002 seconds)
[14187.873606] OOM killer disabled.
[14187.873841] PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
[14187.873844] PM: hibernation: Marking nosave pages: [mem 0x000a0000-0x000fffff]
[14187.873846] PM: hibernation: Marking nosave pages: [mem 0x09bff000-0x0a000fff]
[14187.873859] PM: hibernation: Marking nosave pages: [mem 0x0a200000-0x0a20efff]
[14187.873861] PM: hibernation: Marking nosave pages: [mem 0xc7c42000-0xc7c42fff]
[14187.873863] PM: hibernation: Marking nosave pages: [mem 0xc7c4f000-0xc7c4ffff]
[14187.873864] PM: hibernation: Marking nosave pages: [mem 0xc8d4c000-0xc8ec7fff]
[14187.873869] PM: hibernation: Marking nosave pages: [mem 0xcc223000-0xccdfefff]
[14187.873904] PM: hibernation: Marking nosave pages: [mem 0xce000000-0xffffffff]
[14187.874333] PM: hibernation: Basic memory bitmaps created
[14187.874581] PM: hibernation: Preallocating image memory
[14194.609748] PM: hibernation: Allocated 3122828 pages for snapshot
[14194.609753] PM: hibernation: Allocated 12491312 kbytes in 6.73 seconds (1856.06 MB/s)
[14194.609757] Freezing remaining freezable tasks
[14194.761029] Freezing remaining freezable tasks completed (elapsed 0.151 seconds)
[14194.761301] printk: Suspending console(s) (use no_console_suspend to debug)
[14194.879664] amdgpu 0000:04:00.0: amdgpu: MODE2 reset
[14194.932395] ACPI: PM: Preparing to enter system sleep state S4
[14195.258170] ACPI: PM: Saving platform NVS memory
[14195.259728] Disabling non-boot CPUs ...
[14195.261706] smpboot: CPU 1 is now offline
[14195.265215] smpboot: CPU 2 is now offline
[14195.267772] smpboot: CPU 3 is now offline
[14195.270421] smpboot: CPU 4 is now offline
[14195.272941] smpboot: CPU 5 is now offline
[14195.275591] smpboot: CPU 6 is now offline
[14195.277914] smpboot: CPU 7 is now offline
[14195.280150] smpboot: CPU 8 is now offline
[14195.282161] smpboot: CPU 9 is now offline
[14195.284274] smpboot: CPU 10 is now offline
[14195.286357] smpboot: CPU 11 is now offline
[14195.288633] smpboot: CPU 12 is now offline
[14195.290587] smpboot: CPU 13 is now offline
[14195.292662] smpboot: CPU 14 is now offline
[14195.293429] Spectre V2 : Update user space SMT mitigation: STIBP off
[14195.294726] smpboot: CPU 15 is now offline
[14195.295638] PM: hibernation: Creating image:
[14195.908898] PM: hibernation: Need to copy 2916820 pages
[14195.908902] PM: hibernation: Normal pages needed: 2916820 + 1024, available pages: 4664691
[14213.313641] PM: hibernation: Image created (2916820 pages copied)
[14195.296058] ACPI: PM: Restoring platform NVS memory
[14199.642159] AMD-Vi: Virtual APIC enabled
[14199.642220] AMD-Vi: Virtual APIC enabled
[14199.642233] LVT offset 0 assigned for vector 0x400
[14199.642718] Enabling non-boot CPUs ...
[14199.642949] smpboot: Booting Node 0 Processor 1 APIC 0x1
[14199.645714] ACPI: \_SB_.PLTF.P001: Found 3 idle states
[14199.646108] Spectre V2 : Update user space SMT mitigation: STIBP always-on
[14199.646124] CPU1 is up
[14199.646388] smpboot: Booting Node 0 Processor 2 APIC 0x2
[14199.648926] ACPI: \_SB_.PLTF.P002: Found 3 idle states
[14199.649276] CPU2 is up
[14199.649453] smpboot: Booting Node 0 Processor 3 APIC 0x3
[14199.651883] ACPI: \_SB_.PLTF.P003: Found 3 idle states
[14199.652252] CPU3 is up
[14199.652603] smpboot: Booting Node 0 Processor 4 APIC 0x4
[14199.655470] ACPI: \_SB_.PLTF.P004: Found 3 idle states
[14199.655841] CPU4 is up
[14199.656059] smpboot: Booting Node 0 Processor 5 APIC 0x5
[14199.658479] ACPI: \_SB_.PLTF.P005: Found 3 idle states
[14199.658832] CPU5 is up
[14199.659013] smpboot: Booting Node 0 Processor 6 APIC 0x6
[14199.661403] ACPI: \_SB_.PLTF.P006: Found 3 idle states
[14199.661706] CPU6 is up
[14199.661866] smpboot: Booting Node 0 Processor 7 APIC 0x7
[14199.664229] ACPI: \_SB_.PLTF.P007: Found 3 idle states
[14199.664572] CPU7 is up
[14199.664738] smpboot: Booting Node 0 Processor 8 APIC 0x8
[14199.667117] ACPI: \_SB_.PLTF.P008: Found 3 idle states
[14199.667474] CPU8 is up
[14199.667789] smpboot: Booting Node 0 Processor 9 APIC 0x9
[14199.670282] ACPI: \_SB_.PLTF.P009: Found 3 idle states
[14199.670635] CPU9 is up
[14199.670797] smpboot: Booting Node 0 Processor 10 APIC 0xa
[14199.673201] ACPI: \_SB_.PLTF.P00A: Found 3 idle states
[14199.673575] CPU10 is up
[14199.673741] smpboot: Booting Node 0 Processor 11 APIC 0xb
[14199.676112] ACPI: \_SB_.PLTF.P00B: Found 3 idle states
[14199.676517] CPU11 is up
[14199.676675] smpboot: Booting Node 0 Processor 12 APIC 0xc
[14199.679183] ACPI: \_SB_.PLTF.P00C: Found 3 idle states
[14199.679669] CPU12 is up
[14199.679865] smpboot: Booting Node 0 Processor 13 APIC 0xd
[14199.682269] ACPI: \_SB_.PLTF.P00D: Found 3 idle states
[14199.682689] CPU13 is up
[14199.682856] smpboot: Booting Node 0 Processor 14 APIC 0xe
[14199.685250] ACPI: \_SB_.PLTF.P00E: Found 3 idle states
[14199.685705] CPU14 is up
[14199.685874] smpboot: Booting Node 0 Processor 15 APIC 0xf
[14199.688276] ACPI: \_SB_.PLTF.P00F: Found 3 idle states
[14199.688767] CPU15 is up
[14199.690615] ACPI: PM: Waking up from system sleep state S4
[14199.799682] pci 0000:00:00.2: can't derive routing for PCI INT A
[14199.799687] pci 0000:00:00.2: PCI INT A: no GSI
[14199.799929] [drm] PCIE GART of 1024M enabled.
[14199.799931] [drm] PTB located at 0x000000F4BFC00000
[14199.799948] [drm] PSP is resuming...
[14199.967968] nvme nvme0: 8/0/0 default/read/poll queues
[14199.969924] nvme nvme0: Ignoring bogus Namespace Identifiers
[14200.279788] usb 3-2.2: reset low-speed USB device number 5 using xhci_hcd
[14200.523960] [drm] reserve 0x400000 from 0xf4bf800000 for PSP TMR
[14200.798746] amdgpu 0000:04:00.0: amdgpu: RAS: optional ras ta ucode is not available
[14200.809700] amdgpu 0000:04:00.0: amdgpu: RAP: optional rap ta ucode is not available
[14200.809702] amdgpu 0000:04:00.0: amdgpu: SECUREDISPLAY: securedisplay ta ucode is not available
[14200.809706] amdgpu 0000:04:00.0: amdgpu: SMU is resuming...
[14200.809748] amdgpu 0000:04:00.0: amdgpu: dpm has been disabled
[14200.810673] amdgpu 0000:04:00.0: amdgpu: SMU is resumed successfully!
[14200.811247] [drm] DMUB hardware initialized: version=0x01010027
[14201.043439] [drm] kiq ring mec 2 pipe 1 q 0
[14201.050173] [drm] VCN decode and encode initialized successfully(under DPG Mode).
[14201.050219] [drm] JPEG decode initialized successfully.
[14201.050227] amdgpu 0000:04:00.0: amdgpu: ring gfx uses VM inv eng 0 on hub 0
[14201.050230] amdgpu 0000:04:00.0: amdgpu: ring gfx_low uses VM inv eng 1 on hub 0
[14201.050232] amdgpu 0000:04:00.0: amdgpu: ring gfx_high uses VM inv eng 4 on hub 0
[14201.050233] amdgpu 0000:04:00.0: amdgpu: ring comp_1.0.0 uses VM inv eng 5 on hub 0
[14201.050235] amdgpu 0000:04:00.0: amdgpu: ring comp_1.1.0 uses VM inv eng 6 on hub 0
[14201.050237] amdgpu 0000:04:00.0: amdgpu: ring comp_1.2.0 uses VM inv eng 7 on hub 0
[14201.050238] amdgpu 0000:04:00.0: amdgpu: ring comp_1.3.0 uses VM inv eng 8 on hub 0
[14201.050240] amdgpu 0000:04:00.0: amdgpu: ring comp_1.0.1 uses VM inv eng 9 on hub 0
[14201.050242] amdgpu 0000:04:00.0: amdgpu: ring comp_1.1.1 uses VM inv eng 10 on hub 0
[14201.050243] amdgpu 0000:04:00.0: amdgpu: ring comp_1.2.1 uses VM inv eng 11 on hub 0
[14201.050245] amdgpu 0000:04:00.0: amdgpu: ring comp_1.3.1 uses VM inv eng 12 on hub 0
[14201.050246] amdgpu 0000:04:00.0: amdgpu: ring kiq_0.2.1.0 uses VM inv eng 13 on hub 0
[14201.050248] amdgpu 0000:04:00.0: amdgpu: ring sdma0 uses VM inv eng 0 on hub 8
[14201.050250] amdgpu 0000:04:00.0: amdgpu: ring vcn_dec uses VM inv eng 1 on hub 8
[14201.050251] amdgpu 0000:04:00.0: amdgpu: ring vcn_enc0 uses VM inv eng 4 on hub 8
[14201.050253] amdgpu 0000:04:00.0: amdgpu: ring vcn_enc1 uses VM inv eng 5 on hub 8
[14201.050255] amdgpu 0000:04:00.0: amdgpu: ring jpeg_dec uses VM inv eng 6 on hub 8
[14201.055699] PM: Cannot find swap device, try swapon -a
[14201.055705] PM: Cannot get swap writer

It seems that it cannot find the swap device, even though swapon --show detects it.

In other PC's I've been able to hibernate it correctly. Maybe I should try a swap partition instead of a swap file. Maybe the /dev/zram0 swap interferes with the hibernation process?

1 Answers1

2

After looking at https://www.reddit.com/r/archlinux/comments/aydzo4/btrfs_with_swapfile_cannot_find_swap_device/, it seems that file offsets for btrfs partitions has to be calculated with special utilities.

It's easier to use a separate partition for swapping.

UPDATE Confirm that using a separate partition works like a charm.