Systemctl reboot and poweroff always ask for password

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Systemctl reboot and poweroff always ask for password

Postby ngoonee » Wed Jul 20, 2016 2:42 am

I've installed polkit so I can systemctl reboot as a user, and then came across this.

When trying to reboot/poweroff I get the following:-
$this->bbcode_second_pass_code('', '[alarm@alarmpi ~]$ systemctl reboot
==== AUTHENTICATING FOR org.freedesktop.login1.set-wall-message ===
Authentication is required to set a wall message
Authenticating as: alarm
Password:
==== AUTHENTICATION COMPLETE ===
==== AUTHENTICATING FOR org.freedesktop.login1.reboot ===
Authentication is required for rebooting the system.
Authenticating as: alarm
Password:
==== AUTHENTICATION COMPLETE ===
')

This seems to indicate a login problem. Here's my output for loginctl user_status

$this->bbcode_second_pass_code('', '[alarm@alarmpi ~]$ loginctl user-status
alarm (1000)
Since: Tue 2016-07-19 23:26:37 UTC; 1min 11s ago
State: active
Sessions: *c1
Linger: no
Unit: user-1000.slice
|-session-c1.scope
| |-282 sshd: alarm [priv]
| |-292 sshd: alarm@pts/0
| |-293 -bash
| |-334 loginctl user-status
| `-335 less
`-user@1000.service
`-init.scope
|-284 /usr/lib/systemd/...
`-287 (sd-pam)

Jul 19 23:26:37 alarmpi systemd[284]: pam_unix(systemd-user:session): session opened for user alarm by (uid=0)
Jul 19 23:26:37 alarmpi systemd[284]: Starting D-Bus User Message Bus Socket.
Jul 19 23:26:37 alarmpi systemd[284]: Reached target Paths.
Jul 19 23:26:37 alarmpi systemd[284]: Reached target Timers.
Jul 19 23:26:37 alarmpi systemd[284]: Listening on D-Bus User Message Bus Socket.
Jul 19 23:26:37 alarmpi systemd[284]: Reached target Sockets.
Jul 19 23:26:37 alarmpi systemd[284]: Reached target Basic System.
Jul 19 23:26:37 alarmpi systemd[284]: Reached target Default.
Jul 19 23:26:37 alarmpi systemd[284]: Startup finished in 289ms.
')

Any ideas?
ngoonee
 
Posts: 17
Joined: Wed Apr 20, 2016 8:26 pm

Re: Systemctl reboot and poweroff always ask for password

Postby sdjf » Wed Jul 20, 2016 3:02 am

How many users are there for the system? If you are the only one, why not use sudo to reboot or poweroff?
sdjf
 
Posts: 178
Joined: Wed May 08, 2013 1:55 pm

Re: Systemctl reboot and poweroff always ask for password

Postby ngoonee » Fri Jul 22, 2016 3:53 am

I'm the only one, and I can indeed do that, but that's a workaround rather than a solution. Not that I'm against workarounds, but it does seem like something isn't working properly and I'd like to get to the bottom of it if possible.
ngoonee
 
Posts: 17
Joined: Wed Apr 20, 2016 8:26 pm

Re: Systemctl reboot and poweroff always ask for password

Postby WarheadsSE » Fri Jul 22, 2016 1:45 pm

Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Systemctl reboot and poweroff always ask for password

Postby ngoonee » Mon Jul 25, 2016 6:16 am

Thanks, but as I already indicated polkit is installed, and I'm indeed the only user. Further investigation suggests that the fact that I'm logging in remotely to systemd may be causing the symptoms I'm experiencing. Has anyone done that?
ngoonee
 
Posts: 17
Joined: Wed Apr 20, 2016 8:26 pm

Re: Systemctl reboot and poweroff always ask for password

Postby WarheadsSE » Mon Jul 25, 2016 11:42 am

Yes, your SSH connection is why. It doesn't count as a "seat"
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Systemctl reboot and poweroff always ask for password

Postby qinohe » Sun Jul 31, 2016 8:10 pm

It's very well possible to shutdown a remote session as user with the help of polkit.
I'm logged in on my server trough SSH, in this session I call another SSH connection, from this server! to my 'pipod'.
On this 'pipod', polkit is installed, and I can, as user, poweroff remotely remote.

edit:
I'm a member of the wheel group, edit visudo and add below '%wheel'

$this->bbcode_second_pass_code('', '%wheel ALL = NOPASSWD: /usr/bin/poweroff,/usr/bin/reboot')
qinohe
 
Posts: 11
Joined: Thu May 15, 2014 2:14 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 16 guests