Brought a new laptop and decided to jump to Arch and EndevourOS over from Regolith/Ubuntu.
During the install decided on i3 and BTRFS. I also enabled the swap file on the installer. However on lid close and then open the screen would just display a frozen desktop screen from the moment I closed it and required a hard restart. Having no idea if it was trying to suspend or hibernate I decided to check out the swap file first:
Filename Type Size Used Priority
/swap/swapfile file 524284 0 -2
Right that’s too small for a start as it’s got 16GB RAM, I decide to try increasing the swap file to 4GB:
~> sudo dd if=/dev/zero of=/swap/swapfile bs=1M count=4000 status=progress
3995074560 bytes (4.0 GB, 3.7 GiB) copied, 1 s, 4.0 GB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB, 3.9 GiB) copied, 1.05945 s, 4.0 GB/s
~> sudo chmod 600 /swap/swapfile
~> sudo mkswap /swap/swapfile
Setting up swapspace version 1, size = 3.9 GiB (4194299904 bytes)
no label, UUID=blah
~> sudo swapon /swap/swapfile
swapon: /swap/swapfile: swapon failed: Invalid argument
So as you can see I’ve already hit a brick wall, can’t even get past the first part of setting up the swap file for a suspend then hibernate setup. Any ideas?
ID 256 gen 1896 parent 5 top level 5 path @
ID 257 gen 1897 parent 5 top level 5 path @home
ID 258 gen 1525 parent 5 top level 5 path @cache
ID 259 gen 1895 parent 5 top level 5 path @log
ID 260 gen 1801 parent 5 top level 5 path @swap
ID 261 gen 25 parent 256 top level 256 path var/lib/portables
ID 262 gen 26 parent 256 top level 256 path var/lib/machines
Ah cheers that’s done the trick! Finished it with running the regular swap file creation commands. In future if someone else hits this problem here’s the full solution:
> cd /swap
> sudo truncate -s 0 ./swapfile
> sudo chattr +C ./swapfile
> sudo dd if=/dev/zero of=/swap/swapfile bs=1M count=4000 status=progress
4011851776 bytes (4.0 GB, 3.7 GiB) copied, 2 s, 2.0 GB/s
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB, 3.9 GiB) copied, 2.35927 s, 1.8 GB/s
> sudo chmod 0600 /swap/swapfile
> sudo mkswap -U clear /swap/swapfile
Setting up swapspace version 1, size = 3.9 GiB (4194299904 bytes)
no label, UUID=00000000-0000-0000-0000-000000000000
> sudo swapon /swap/swapfile
> swapon -s
Filename Type Size Used Priority
/swap/swapfile file 4095996 0 -2
For a 16GB machine, is 4GB going to be a large enough swap file to enable suspend?
Suspension, that is Suspend-to-RAM won’t need any swap device.
If you need hibernation (Suspend-to-Disk) then you would need a swap device as large as you RAM. You may get away with less as the content of RAM is compressed before being written to disk but that all depends how “full” you RAM is before hibernation.
Ah thanks for that, yeah I meant hibernation, sorry it’s getting late and it’s been a long day fixing all the setup issues with my laptop and i3/EOS. I think I’ll leave it till tomorrow now and resize the swap file to 16GB then. Thanks for yours and @dalto help! Glad I finally made the leap to Arch/EOS.