How to enable suspend-hibernate in Alpine Linux
Yes, I'm still trying and experimenting with Alpine Linux and gave it a full install (sys mode) it in the machine I found from the trash a few months ago. FreeBSD is still safe and sound since I'm using another HDD that I also found on the trash.
A laptop is not a virtual machine, so power management is necessary to keep sessions alive as human beings go to sleep or to work. Can you do that in Alpine? You bet. Here's how I did it:
- Edit
/etc/apk/repositoriesand uncomment the lines containing thecommunityandedge/testingrepositories to enable them (along with 90% of all the packages available for Alpine). - Install elogind from the community repos with
apk add elogind. This is the clone of systemd's elogind but only the bare minimum to play nicely with Alpine's OpenRC. - Start the elogind service with
rc-service elogind start - You now can suspend the system with
sudo loginctl suspendand hibernate to RAM withsudo loginctl hibernate.
The end result is a power management system similar to Artix, with one difference: you need to sudo it. I'm not sure how you can remove this requirement, though I know it's possible (in Artix a regular user can do without it). The closest I've got was to edit sudoers and remove the password requirement (sudo is still required).
Anybody got any ideas?