I am having some issues with auto-starting programs when my Raspberry Pi 2 boots. I have tried editing both /etc/xdg/lxsession/LXDE-pi/autostart & /etx/xdg/lxsession/LXDE/autostart and neither made any difference. I put the following code in both files

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
@sh ${HOME}/.config/lxsession/LXDE-pi/autokey.sh

Are the tutorials I am following outdated or is there another autostart file to edit? My goal is to boot right into a fullscreen web browser in kiosk mode and no mouse.

  • If the issue is you get a login screen instead, it is because this will only work at boot if you have autologin enabled.
    – goldilocks
    Commented Dec 31, 2015 at 21:33
  • Great question.
    – Alex Lowe
    Commented Jan 1, 2016 at 2:16
  • 1
    @goldilocks I have it configured to boot into the desktop logged in.
    – svicino
    Commented Jan 1, 2016 at 3:26
  • are you looking for a command to run that will get you there or is this more of a configuration/edit?
    – 1''
    Commented Jan 24, 2016 at 8:52
  • "Are the tutorials I am following outdated or is there another autostart file to edit?" Took the words right out of my mouth. I've been at this for four hours now. Five different config files modified later, I still can't get iceweasel to autostart nor can I disable the screen from going black. Commented Mar 20, 2016 at 18:11

6 Answers 6


You should edit ~/.config/lxsession/<profile>/autostart if you have it, or make sure it is removed if you need a global LXSession configuration for all users. If you happen to have both files, the global configuration will be ignored:

Commands globally executed are stored in the /etc/xdg/lxsession//autostart file, and in addition, other commands can be locally specified in the ~/.config/lxsession//autostart file. If both files are present, only the entries in the local file will be executed.

If that doesn't help, I would be inclined to check if LXSession is actually used as your session manager (e.g. by checking X11 config files or running ps ax | grep lxsession). I know it sounds silly, but it's not impossible to install e.g. openbox, forget about it, then wonder why LXSession ignores its config files.


I use crontab because it is simple and equally useful for running all kinds of automated scripts regardless of the Linux/Unix system you happen to be using. This is also answered on this question. Below, my own code:

Open crontab:

sudo crontab -e

Instead of the usual crontab format for date (eg. */5 * * * * script_name) use @reboot:

@reboot sudo python /home/pi/python_scripts/script.py &

I use sudo in both instances because it is required for the script I am running. Thw ampersand & at the end runs the script in the background.

  • cron is not intended to run GUI programs, as it will try to run them whether desktop environment has started or not. Commented Jan 10, 2017 at 10:15

In the /etc/xdg/lxsession/LXDE-pi/autostart file, ${HOME} and ~/ don't seem to work. Instead, as a work around, put in an absolute path. The line should therefore look like:


If you just want to execute simple commands on boot, run crontab -e to edit commands that can be run at certain times, intervals, or at boot. Each crontab is user specific. If you wanted to run sh ${HOME}/.config/lxsession/LXDE-pi/autokey.sh and iceweasel on boot, simple add the line @reboot sh ${HOME}/.config/lxsession/LXDE-pi/autokey.sh && iceweasel to the end of your crontab file.

  • 1
    This doesn't work, jeffresc. Did you test it? Commented Mar 20, 2016 at 18:17

I haven't been right through this: http://blogs.wcode.org/2013/09/howto-boot-your-raspberry-pi-into-a-fullscreen-browser-kiosk/ but the approach, using rc.local (I use successfully this for an auto-boot for a personal project) looks plausible. Also, it's fine grained, deals with screen resolution etc.

I wouldn't use crontab for this, that's mainly for timed batch programs, for example, zipping up log files each day and sending them somewhere.

Best regards Hugh

  • You should include relevant details from that blog post in your answer, before the link breaks. Commented Jan 10, 2017 at 10:21

When Using

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

You are then able to add lines for example:

@/usr/bin/python /home/pi/example.py

Depending what you are running you will need to include the location of what you want to run. You also have to input it in a similar fashion as you would in a terminal. As the previous example you have to call Python before running a python script.

  • Could I get an explanation as to why this is being downvoted? Commented Jan 13, 2017 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.