23

I upgraded a raspberry Pi installation with a Pi 2. But since I upgraded all packages, the autostart does not work anymore:

neither this seems to be working:

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

nor this:

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

the content of the autostart file is:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
# Auto run the browser
@xset s off
@xset -dpms
@xset s noblank
@/usr/bin/epiphany-browser -a --profile ~/.config http://google.de
@sleep 5s # give it time to start
@echo key F11 | xte # simulate pressing the full screen key

How can I configure that the autostart is executed?

2
  • Stupid question/sanity check: Have you confirmed that the autostart file isn't run by replacing your commands with something really basic? For example, remove everything below '#Auto run the browser' and test '@midori'.
    – goobering
    Commented Mar 17, 2016 at 16:28
  • 1
    Yes I did that. It is simply not exectued.
    – S.Spieker
    Commented Mar 17, 2016 at 19:54

7 Answers 7

22
+25

There's a fairly plausible sounding explanation for your problem in this thread on the raspberrypi.org forums.

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

That is the global autostart file, and works for all users... unless they have a user autostart. If the user has an autostart file the global one is ignored and the personal autostart is used. User settings are applied last and take precedence over global settings. Jessie creates a user's autostart file during the install, so changing settings in the global file no longer have any effect.

/etc/xdg/lxsession/LXDE/autostart

That is the "old" location, the new location uses "/LXDE-pi/". The "/LXDE/" directory may exist, but it will be ignored.

The correct location for adding autostart items should be ~/.config/lxsession/LXDE-pi/autostart. It's recommended that you don't use sudo to edit it.

7
  • Thanks for pointing this out, but I changed the ownership to pi:pi, but that does not work either.
    – S.Spieker
    Commented Mar 18, 2016 at 7:12
  • 1
    Sorry, could you confirm what you changed the ownership of? That shouldn't be necessary here.
    – goobering
    Commented Mar 18, 2016 at 8:22
  • -rw-r--r-- 1 pi pi 414 Mar 18 06:55 /etc/xdg/lxsession/LXDE-pi/autostart
    – S.Spieker
    Commented Mar 18, 2016 at 9:05
  • That isn't going to help here - the user level settings will still take precedence over those settings. You need to copy/paste your commands over to ~/.config/lxsession/LXDE-pi/autostart .
    – goobering
    Commented Mar 18, 2016 at 9:28
  • 1
    I'm afraid that lands me pretty much out of suggestions. There's a walkthrough here that may include something I've missed, but as far as I can tell this is how autostart configurations are handled.
    – goobering
    Commented Mar 18, 2016 at 10:58
13

Experienced the same issue. Here are my findings:

Check if the /home/pi/.config/lxsession/LXDE-pi/autostart file exists. If it exists, it will be used instead of /etc/xdg/lxsession/LXDE-pi/autostart.

View logs (after reboot) in /home/pi/.xsession-errors:

$ cat .xsession-errors
Xsession: X session started for pi at Sat 30 Jul 23:14:04 UTC 2016
localuser:pi being added to access control list
** Message: main.vala:99: Session is LXDE-pi
** Message: main.vala:100: DE is LXDE
** Message: main.vala:131: log directory: /home/pi/.cache/lxsession/LXDE-pi
** Message: main.vala:132: log path: /home/pi/.cache/lxsession/LXDE-pi/run.log

This suggest looking at /home/pi/.cache/lxsession/LXDE-pi/run.log:

$ tail -n30 /home/pi/.cache/lxsession/LXDE-pi/run.log
...

** (epiphany-browser:874): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
--profile must be an existing directory when --application-mode is requested
** Message: app.vala:130: /usr/bin/epiphany-browser exit with this type of exit: 256

...

So I tested the command manually in the terminal (in the GUI). I got some errors:

$ /usr/bin/epiphany-browser -a --profile ~/.config https~://google.de

** (epiphany-browser:1218): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
** Message: Remote error from secret service: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files

** (epiphany-browser:1218): WARNING **: Error caching form data: The name org.freedesktop.secrets was not provided by any .service files

But the browser started anyway...

Played with the /usr/bin/epiphany-browser command and reduced it to /usr/bin/epiphany-browser --profile ~/.config https://google.de.

Then changed the /home/pi/.config/lxsession/LXDE-pi/autostart lines to:

@/usr/bin/epiphany-browser --profile ~/.config https://google.de

And it worked - the browser started.

Tested on:

  • Raspberry Pi 3
  • Debian Jessie

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Raspbian
    Description:    Raspbian GNU/Linux 8.0 (jessie)
    Release:    8.0
    Codename:   jessie
    
1
  • "Check if the /home/pi/.config/lxsession/LXDE-pi/autostart file exists. If it exists, it will be used" - that saved my day! Commented Aug 17, 2018 at 15:03
4

Yesterday I downloaded NOOBS and created a new micro SD installer. After Raspian installation everything looked OK at first until I looked at autostart. I found that the folder /home/pi/.config/lxsession did not exist so I created it and the folder /home/pi/.config/lxsession/LXDE-pi. I then created the file autostart as an empty file and added my autostart command. After reboot I had a black screen. I have other working Pis and I checked their autostart files. They have these lines

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi

Adding these lines in the new installation fixed the problem.

I am adding this answer for the benefit of someone else like me who is looking for a solution to the same problem.

0
3

I was able to solve the problem with a cron task.

First I installed the packages:

sudo apt-get install gnome-schedule

The I edited the crontab via:

crontab -e

I added a task after each reboot where I put the browser startup:

@reboot /home/pi/startupscript &
2

Three things that tripped me up:

  • the user's autostart overrides the global one; if you want to start everything as usual plus your custom commands, copy the default and add your commands to the end:

    cp /etc/xdg/lxsession/LXDE-pi/autostart $HOME/.config/lxsession/LXDE-pi/ editor $HOME/.config/lxsession/LXDE-pi/autostart

  • in $HOME/.config/lxsession/LXDE-pi/desktop.conf, there's this part - if disable_autostart=yes, it won't run (obvious in retrospect, yes):

    [Session] disable_autostart=no

  • autostart is not a shell script. If you need anything beyond simply launching programs, better make a shell script and call that from the autostart (E.g. foo && bar won't work here)

0

write on these path the autostart - /home/pi/.config/lxsession/LXDE-pi/

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@/usr/bin/chromium-browser --start-fullscreen --incognito "USE URL¨S HERE, IF YOU WANT TO USE MORE THAN ONE USE A SPACE FOR EACH URL"
@/usr/bin/xdotool x y

Also you can change the --start-fullscreen for kiosk, but kiosk needs to kill the process of your app.

Command: pkill chromium

0

I have encountered this error:

[1216:1216:0128/120813.940515:ERROR:browser_main_loop.cc(582)] Failed to put Xlib into threaded mode.

(chromium-browser:1216): Gtk-WARNING **: cannot open display:

I Managed to overcome it using this tutorial.

I Installed window-manager

$ sudo apt-get install matchbox-window-manager

Then I included this in .config/lxsession/LXDE-pi/autostart BEFORE starting Chromium.

@matchbox-window-Manager -use_cursor no&

Then a command of starting chromium-browser with my options.

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