I am running my the PIXEL desktop of Rasbian (Jessie) in VNC started by cron. In this case the Shutdown and Reboot of the shutdown menu do not work (only Logout).
How can I get shutdown and reboot working?
From the discussion at the RPi Forum this problem seems to happen in a VNC desktop started through the user's crontab via @reboot vncserver & since the cron environment is restricted and prevents (PAM?) from working correctly. The problem shows up when I start the button script in a shell and click on reboot:
raspberrypi:~$ lxde-pi-shutdown-helper
Failed to execute operation: Access denied
Must be root.
Interestingly when I ssh in as user pi I get:
raspberrypi:~$ lxde-pi-shutdown-helper
==== AUTHENTICATING FOR org.freedesktop.login1.power-off ===
Authentication is required for powering off the system.
Multiple identities can be used for authentication:
1. ,,, (pi)
2. root
Choose identity to authenticate as (1-2):
So lxde-pi-shutdown-helper seems to be a complex program which I would like to understand and use better in VNC.
A similar issue is Get Bash instead of /bin/sh in a VNC session started by cron.
What does it take to run lxde-pi-shutdown-helper correctly?
1and type thepiuser's password, it should work.) – cjs Apr 05 '17 at 17:35lxde-pi-shutdown-helperto work and the other question is about starting VNC through cron without limitations. Now when I click the shutdown button I don't get this menu so I can't follow your suggestion. – Frank Breitling Apr 05 '17 at 17:55lxde-pi-shutdown-helperfrom the command line and choose1from the menu above, does the Pi then correctly shut down? And do you have to type a password when you do that? (I.e., did you add a password to your account?) – cjs Apr 05 '17 at 18:10gksudo lxde-pi-shutdown-helperI can reboot by clicking the reboot button. Otherwise I seeFailed to execute operation: Access denied Must be root.And yes my users have passwords. – Frank Breitling Apr 06 '17 at 09:46lxde-pi-shutdown-helper, and in my Raspbian Lite system with graphics packages added, I can't find it, even withapt-file. Can you do adpkg -Son the full path of that file and tell me which package it's from, andapt showthe package to find the source of the package? – cjs Apr 06 '17 at 17:12raspberrypi:~$ dpkg -S /usr/bin/lxde-pi-shutdown-helper diversion by pishutdown from: /usr/bin/lxde-pi-shutdown-helper diversion by pishutdown to: /usr/bin/lxde-pi-shutdown-helper.old pishutdown: /usr/bin/lxde-pi-shutdown-helper.) – Frank Breitling Apr 06 '17 at 21:33