You are not logged in.

#1 2012-11-08 12:29:45

impact
Member
Registered: 2012-10-28
Posts: 55

[solved] systemd power control doesn't work

Since there is no way of getting systemctl power control work without sudo, I tried modifying sudoers to allow my user to operate them without password.
However, it still won't work.
I tried that

cross ALL = NOPASSWD: /usr/sbin/hibernate,/usr/bin/systemctl suspend,/usr/bin/systemctl reboot,/usr/bin/systemctl suspend,/usr/bin/systemctl hibernate

and I tried that

cross ALL = NOPASSWD: /usr/bin/systemctl

The result was the same:

$ systemctl suspend
Failed to issue method call: Access denied
Failed to issue method call: Access denied

Last edited by impact (2012-11-09 11:28:17)

Offline

#2 2012-11-08 12:38:21

nahuy_systemd
Member
Registered: 2012-11-08
Posts: 1

Re: [solved] systemd power control doesn't work

systemd very bad system. I solved this. I moved to CRUX.

Offline

#3 2012-11-08 12:54:15

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [solved] systemd power control doesn't work

You need to actually use sudo for settings in sudoers file to be used (if you want this work-around and don't have the time or the will to fix the real permissions problem).

Offline

#4 2012-11-08 13:13:43

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

1. I used sudo visudo
2. There is no known to me method to fix the real permissions problem which I could have found in Arch wiki, or in Arch, Gentoo, or linux.org forums.

It just stopped working after upgrading to newest polkit and that's that.

Last edited by impact (2012-11-08 13:14:00)

Offline

#5 2012-11-08 13:20:08

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [solved] systemd power control doesn't work

You used sudo visudo to change the sudoers file. Those changes affect the behavior of sudo, not the behavior of systemctl, so it's no surprise that just running systemctl (without sudo) has the same unsatifying result as before.

Last edited by Raynman (2012-11-08 13:20:37)

Offline

#6 2012-11-08 13:44:48

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

I did that with su, too.

Anyway, if you think you'd be able to help me with the original problem, then I invite you to the original thread:
https://bbs.archlinux.org/viewtopic.php?id=152130

Last edited by impact (2012-11-08 13:46:04)

Offline

#7 2012-11-08 14:06:31

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [solved] systemd power control doesn't work

You should be able to run power commands without sudo, if you're session is marked as enabled in "loginctl show-session (session_number)". Please check.

Offline

#8 2012-11-08 14:08:19

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

Yes, I know I should be able to, but it doesn't work:

$ loginctl show-session
ControlGroupHierarchy=/user
NAutoVTs=6
KillExcludeUsers=root
KillUserProcesses=no
IdleHint=yes
IdleSinceHint=0
IdleSinceHintMonotonic=0
InhibitDelayMaxUSec=5s
HandlePowerKey=poweroff
HandleSuspendKey=suspend
HandleHibernateKey=hibernate
HandleLidSwitch=ignore
PreparingForShutdown=no
PreparingForSleep=no

Offline

#9 2012-11-08 14:12:58

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [solved] systemd power control doesn't work

Check with "loginctl" what's your session number, than "loginctl show-session your_session_number" please, so we'll see if your session is marked as active.

Offline

#10 2012-11-08 14:15:24

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

Right. But...

$ loginctl
   SESSION        UID USER             SEAT            

0 sessions listed.
$ loginctl show-session 0
Failed to issue method call: No such file or directory

Offline

#11 2012-11-08 14:33:39

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [solved] systemd power control doesn't work

Wow! Nice big_smile
"systemctl status systemd-logind.service" ?

Offline

#12 2012-11-08 14:50:20

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

$ systemctl status systemd-logind.service
systemd-logind.service - Login Service
	  Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static)
	  Active: active (running) since Thu, 2012-11-08 13:17:15 CET; 2h 32min ago
	    Docs: man:systemd-logind.service(8)
	          man:logind.conf(5)
	          http://www.freedesktop.org/wiki/Software/systemd/multiseat
	Main PID: 338 (systemd-logind)
	  CGroup: name=systemd:/system/systemd-logind.service
		  └ 338 /usr/lib/systemd/systemd-logind

Offline

#13 2012-11-08 14:52:13

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [solved] systemd power control doesn't work

Very strange. The service is up and running, but no session is listed?
How do you start x?
I don't understand how it can be possible...

Offline

#14 2012-11-08 14:56:21

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

Tell me about it.
I am using displaymanager-less method with automatic login as described here https://wiki.archlinux.org/index.php/Au … al_console
and starting x through ~/.bash_profile

. $HOME/.bashrc
if [ -n "$DISPLAY" ]; then
     BROWSER=opera -notrayicon -nomail
fi
[[ $(fgconsole 2>/dev/null) == 1 ]] && exec startx -- vt1

Offline

#15 2012-11-08 15:16:42

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [solved] systemd power control doesn't work

I'm using the same method you mentioned above...to be fair, i have no idea what kind of issue is going on there...let's wait for someone with any other idea, sorry.

Offline

#16 2012-11-08 15:59:39

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

As I said, things worked fine till I upgraded to the newest polkit which included native support for systemd and dropped support for consolekit.
Don't know if it's related, but it could be.

Offline

#17 2012-11-08 16:11:42

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] systemd power control doesn't work

Isn't the visudo file supposed to be a comma and space separated list?  I always have done /usr/sbin/poweroff, /usr/sbin/hibernate, /usr/bin/etc . 

Also, systemctl suspend|hibernate|poweroff should all work without root, so long as you are the only user logged in to the machine, and your session is active. 
To find your session id (if it exists) do:

$ echo $XDG_SESSION_ID 

Also, as long as your system is up to date, the newest update of xorg-xinit includes a new /etc/X11/xinit/xserverrc which takes care of starting your session in the correct TTY (or VT if you prefer).  So I don't think that your "-- vt1" is no longer required, and possibly causing issues since it is now being istructed to start on vt1 as well as vt$XDG_VTNR.

Offline

#18 2012-11-08 16:24:14

marvn
Member
From: Prague
Registered: 2010-01-05
Posts: 84

Re: [solved] systemd power control doesn't work

impact wrote:

Since there is no way of getting systemctl power control work without sudo, I tried modifying sudoers to allow my user to operate them without password.
However, it still won't work.
I tried that

cross ALL = NOPASSWD: /usr/sbin/hibernate,/usr/bin/systemctl suspend,/usr/bin/systemctl reboot,/usr/bin/systemctl suspend,/usr/bin/systemctl hibernate

and I tried that

cross ALL = NOPASSWD: /usr/bin/systemctl

The result was the same:

$ systemctl suspend
Failed to issue method call: Access denied
Failed to issue method call: Access denied

you have to use "sudo systemctl suspend" still, sudoers is only affecting sudo behavior as it was mentioned...

nahuy_systemd wrote:

systemd very bad system. I solved this. I moved to CRUX.

...and you registered to the forum just to tell us that? well, if I were you, i would either change the doctor or make him prescribe me another pills wink


core i5 4590, x86_64, nvidia 970

Offline

#19 2012-11-09 00:16:27

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

WonderWoofy wrote:

Also, systemctl suspend|hibernate|poweroff should all work without root, so long as you are the only user logged in to the machine, and your session is active. 
To find your session id (if it exists) do:

$ echo $XDG_SESSION_ID 

Also, as long as your system is up to date, the newest update of xorg-xinit includes a new /etc/X11/xinit/xserverrc which takes care of starting your session in the correct TTY (or VT if you prefer).  So I don't think that your "-- vt1" is no longer required, and possibly causing issues since it is now being istructed to start on vt1 as well as vt$XDG_VTNR.

I removed -- vt1 but the result of $ echo $XDG_SESSION_ID is still the same, meaning: none:

$ echo $XDG_SESSION_ID 

$ 

Offline

#20 2012-11-09 02:10:11

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [solved] systemd power control doesn't work

Your PAM config is fubar and doesn't use pam_systemd.

Offline

#21 2012-11-09 11:25:17

impact
Member
Registered: 2012-10-28
Posts: 55

Re: [solved] systemd power control doesn't work

falconindy wrote:

Your PAM config is fubar and doesn't use pam_systemd.

Bingo. That was it.

Do you think that lack of  pam_systemd.so somewhere might be also the cause of the fact that after resuming from hibernation called by 'systemctl hibernate', at the last stage of thawing laptop screen gets totally shut down (including the backlit)? System resumes just fine, but I can't see anything and I have to hard-reboot.

This does not happen if I just run 'hibernate' command.

Offline

Board footer

Powered by FluxBB