Hibernation device not found after removing swap

Removed swap partition as it’s not recommended to make a swap partition on an SSD.

Steps I followed.

  • Removed swap partition then resize main partition using gaprted.
  • Removed UUID from /etc/fstab
  • Then removed “resume=UUID=” part from /etc/default/grub as mentioned here.
  • sudo mkinitcpio -P
  • sudo grub-mkconfig -o /boot/grub/grub.cfg

Now boot time is significantly faster than before but shows ERROR: resume :no device specified for hibernation

cat /etc/fstab: https://clbin.com/5ka1g
cat /etc/default/grub: https://clbin.com/E4M0H
cat /proc/cmdline: https://clbin.com/VwymB

But you need swap to hibernate.

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

In order to use hibernation, you need to create a swap partition or file

Did you at least create a swap file?

Unless you’re swapping constantly having swap on an SSD isn’t really an issue. Running without swap means you can’t hibernate and if you hit an oom situation the system will likely just crash.

What is the output of:

systemctl --all | grep swap

?

You will either need a swap partition or swapfile to hibernate. So, story checks out and it sounds like everything is working properly.

The error you are reporting may come from the “resume” hook in /etc/mkinitcpio.conf. If you want to disable hibernation you need to remove the resume hook.

But I want to make a general statement regarding swap on SSD. I believe a generic statement like the one you are referring to is wrong:

Just a note, it’s not recommended to make a swap partition on an SSD, this can damage the medium.

  1. If you have a laptop and want to hibernate you need swap. Either file or partition. And because most laptops these days are coming with an SSD, discouraging swap on SSD would simply break hibernation for EndeavourOS

  2. There is no evidence that swap on SSD is dangerous. This warning is just an academic exercise. For old SSDs (5+ years) the warning might have some truth because such old SSDs had much less TBW and not so good controllers to cope with bad sectors. But for modern SSDs I would not be concerned about swap on SSD.

  3. This warning is pretty unique. I am not aware of any other Distro giving such a warning. Not even Arch Linux.

  4. From a performance point of view the SSD is the best place for swap.

EDIT:

  1. If you do not need hibernation and do not want swap on the SSD you could try zram resp. zram-generator. I am using it on my desktop PC to have some emergency swap available and it works well.
1 Like

systemctl --all | grep swap

swap.target loaded active active Swaps

I barely use hibernation feature, can I choose not use swap (partition/file) at all?

It’s a desktop.

free -th

               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       1.6Gi       5.2Gi        41Mi       895Mi       5.8Gi
Swap:             0B          0B          0B
Total:         7.7Gi       1.6Gi       5.2Gi

cat /etc/mkinitcpio.conf: https://clbin.com/nKmhW

Sorry which line? remove HOOKS="base udev autodetect modconf block keyboard keymap consolefont resume filesystems fsck"

Hibernation requires either a swap partition or a swap file. When you removed the swap partition, did you immediately create a swap file?

No. I removed swap partition with not to use Hibernation feature in mind.

Remove resume from this line. Then run:

sudo makinitcpio -P

Barely or not at all?

If not at all, you could do without a swap partition/file, however I would suggest to look into setting up zram for those cases that the kernel needs to swap out some files from RAM.

When it comes to swap, I think it is better to have some than none at all. The points made in the following article make sense to me to the extent I understand the ideas put forward:

1 Like

its always a good idea to have swap, even if you dont use it frequently. The system will crash if you run into an OOM situation as while windows tends to handle OOM in an alright manner Linux usually just crashes the system when it has nowhere to put things in an OOM situation. Running without even a few GB of swap can be fine as long as nothing misbehaves and you dont run out of memory but having it and not using it is better than not having it.

2 Likes

another thing to keep in mind is that Zram/Zswap is not a replacement for a swap file/partition. In high memory pressure situations its frequently not able to handle giving the system long enough to recover which is why still having a file or partition is still a good idea.

I would also like to add that no matter how large the size of the physical RAM is, the listed software solutions (swappiness settings, zram, etc.) cannot replace a swap partition or swap file for memory-intensive operations.

After all, it is the use case that is decisive.

On a laptop with 16 GB where so far I haven’t filled up half of it, the system runs perfectly fine without a swap partition/file. Not hitting, for me the edge case of OOM.

However, I have set up zram which does occasionally get used. I have noticed it after waking up the system from suspension to RAM.

Thanks @pebcak @Echoa After reading the article & your comments I changed my mind.
I think it’s better to have swap partition. IMO eos article should mention that with bracket.

also checked.

lsblk -d -o name,rota UUID in /etc/fstab

NAME ROTA
sda     1
sr0     1

If you get value of rota in the above output as 1, the disk is HDD. If the value is 0 (zero), then the disk is SSD So mine is HDD :man_facepalming:


steps:

  • Added swap partition using gparted from live usb
  • Re-added the new UUID to /etc/fstab
  • Re- added “resume=UUID=” part to/etc/default/grub
  • Re-add resume to the line HOOKS=“base udev autodetect modconf block keyboard keymap consolefont resume filesystems fsck” in /etc/mkinitcpio.conf
  • sudo mkinitcpio -P
  • sudo grub-mkconfig -o /boot/grub/grub.cfg

Marking this as solution for those who want to remove swap & such errors.

1 Like

free -th

               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       1.1Gi       5.7Gi        34Mi       854Mi       6.3Gi
Swap:          7.5Gi          0B       7.5Gi
Total:          15Gi       1.1Gi        13Gi

7.5GiB swap good enough for 8GB RAM?

Do you plan on using hibernation too?
If so, did you add back the resume hook to the the HOOK line in /etc/mkinitcpio.conf ?

I would think so. Even if you hibernate, the content of the RAM gets compressed before being written to the swap device.

1 Like

Do you plan on using hibernation too?

Now as I’m using swap, why not :grin:

If so, did you add back the resume hook to the the HOOK line in /etc/mkinitcpio.conf ?

I didn’t change that in the 1st place, changed my decision before removing it. Added to the step for those removed it. :+1:

1 Like