1

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?

Frank Breitling
  • 1,009
  • 1
  • 15
  • 30

3 Answers3

1

In your crontab, run your login shell with the option that does full login processing and have it run vncserver, e.g.:

bash -l -c vncserver

This will ensure that a) your preferred shell is used, and b) /etc/profile and your .bash_profile or .profile are read.

cjs
  • 823
  • 1
  • 6
  • 15
0

to reboot you raspberry pi just execute this command:

  sudo shutdown -h now

but if you want your button to start working you should edit this file:

   nano  ~/.config/lxpanel/LXDE-pi/panels/panel

the content should be like this:

# lxpanel <profile> config file. Manually editing is not recommended.
# Use preference dialog in lxpanel to adjust config when you can.

Global {
  edge=top
  allign=left
  margin=0
  widthtype=percent
  width=100
  height=36
  transparent=0
  tintcolor=#000000
  alpha=0
  autohide=0
  heightwhenhidden=2
  setdocktype=1
  setpartialstrut=1
  usefontcolor=0
  fontsize=12
  fontcolor=#ffffff
  usefontsize=0
  background=0
  backgroundfile=/usr/share/lxpanel/images/background.png
  iconsize=36
}
Plugin {
  type=space
  Config {
    Size=4
  }
}
Plugin {
  type=menu
  Config {
    image=/usr/share/raspberrypi-artwork/launch.png
    system {
    }
    separator {
    }
    item {
      name=Run...
      image=system-run
      command=run
    }
    separator {
    }
    item {
      name=Shutdown...
      image=system-shutdown
      command=logout
    }
  }
}
Plugin {
  type=space
  Config {
    Size=8
  }
}
Plugin {
  type=launchbar
  Config {
    Button {
      id=lxde-x-www-browser.desktop
    }
    Button {
      id=pcmanfm.desktop
    }
    Button {
      id=lxterminal.desktop
    }
    Button {
      id=wolfram-mathematica.desktop
    }
    Button {
      id=wolfram-language.desktop
    }
  }
}
Plugin {
  type=space
  Config {
    Size=8
  }
}
Plugin {
  type=taskbar
  expand=1
  Config {
    tooltips=1
    IconsOnly=0
    ShowAllDesks=0
    UseMouseWheel=1
    UseUrgencyHint=1
    FlatButton=0
    MaxTaskWidth=200
    spacing=1
    GroupedTasks=0
  }
}
Plugin {
  type=space
  Config {
    Size=2
  }
}
Plugin {
  type=tray
  Config {
  }
}
Plugin {
  type=bluetooth
  Config {
  }
}
Plugin {
  type=space
  Config {
    Size=2
  }
}
Plugin {
  type=dhcpcdui
  Config {
  }
}
Plugin {
  type=space
  Config {
    Size=2
  }
}
Plugin {
  type=volumealsa
  Config {
  }
}
Plugin {
  type=space
  Config {
    Size=2
  }
}
Plugin {
  type=cpu
  Config {
    ShowPercent=1
    Foreground=#a9a9a9a9a9a9
    Background=#d3d3d3d3d3d3
  }
}
Plugin {
  type=dclock
  Config {
    ClockFmt=%R
    TooltipFmt=%A %x
    BoldFont=0
    IconOnly=0
    CenterText=0
  }
}
Plugin {
  type=space
  Config {
    Size=2
  }
}
Plugin {
  type=ejecter
  Config {
  }
}

this is the important piece of code:

item {
  name=Shutdown...
  image=system-shutdown
  command=logout
}
Liam Giannini
  • 659
  • 2
  • 10
  • 21
0

~/.config/lxpanel/LXDE-pi/config

holds the panel logout helper

Logout=lxde-pi-shutdown-helper

needs a sudo after a recent update

sudo lxde-pi-shutdown-helper

the button behavior is back to normal

MatsK
  • 2,882
  • 3
  • 17
  • 22