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?