void-linux/void-runit

zzz: sleep permission denied

xianwenchen opened this issue · 4 comments

My daily user is not able to run zzz.

Here is the code that prompted the error, which was that permission denied.

https://github.com/void-linux/void-runit/blob/master/zzz#L39

Could the code add a suggestion how one may grant such a permission to a user that is not root?

In the man page, the error was nicely described too.

sleep permission denied
             You lack sufficent privilege to write to /sys/power/state.

I wonder if the man page could be revised also to include a suggestion on how to grant privilege to write to /sys/power/state?

Not really, because there are many ways one could have such privileges: using sudo, doas, su, logging in as root, changing the permissions in /sys/power/state (bad) or using elogind's loginctl utility.

Maybe the man page could include that This usually requires the user to be root or similar.

Right. Thanks. How about this in the man page?

sleep permission denied
             You lack sufficent privilege to write to /sys/power/state. Usually zzz can only be run directly by root or using sudo or doas. You may change the permision in /sys/power/stat, but it is not advised.

I don't know what you mean by using loginctl. Could you elaborate?

If you have elogind installed, you can do loginctl suspend instead of running zzz, and it will work without requiring root. But it won't run the zzz hooks, if you use any.

Right. Great to know. Thank you!