ahaz86
Posts: 4
Joined: Fri Jan 01, 2016 5:02 pm

Cant get autostart to work

Thu Jan 07, 2016 9:19 pm

Hello, I have read through many posts on here about getting autostart working on the pi 2 running Jessie.

Things I have tried
1. Edited: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart to include lxterminal
Looks like this now:

Code: Select all

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@lxterminal
@leafpad
@xscreensaver -no-splash
2. Edited: sudo nano /etc/xdg/lxsession/LXDE/autostart to include lxterminal
Looks like this now:

Code: Select all

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@lxterminal
@xscreensaver -no-splash
3. Attempted to edit: sudo nano ~/.config/lxsession/LXDE/autostart
The path didnt exist so I created each directory and the file but still no luck.

If I login as root and run the command startx applications launch though (not sure if this helps in figuring out what is going on or not)

None of these launch any application at startup
Any help is appreciated and I apologize in advance for this being such a newbie question!

Thanks!
Alex

malicious
Posts: 96
Joined: Thu Jul 24, 2014 10:07 pm
Location: USA

Re: Cant get autostart to work

Fri Jan 08, 2016 5:15 am

ahaz86 wrote:3. Attempted to edit: sudo nano ~/.config/lxsession/LXDE/autostart
The path didnt exist so I created each directory and the file but still no luck.

If I login as root and run the command startx applications launch though (not sure if this helps in figuring out what is going on or not)
Autolaunch worked for root because:

sudo nano ~/.config/lxsession/LXDE/autostart

is editing the file for root's profile. Do the same edit as your regular, non-root account and leave out sudo. I am not sure why the autostart file under /etc is not working though.

QuietZone
Posts: 89
Joined: Sat Dec 05, 2015 7:13 pm

Re: Cant get autostart to work

Fri Jan 08, 2016 5:36 am

malicious wrote: Autolaunch worked for root because:

sudo nano ~/.config/lxsession/LXDE/autostart

is editing the file for root's profile.
No. Try: sudo echo ~

And then you will know who expands the ~ (and when).

Do the same edit as your regular, non-root account and leave out sudo.
This is correct advice, though. People should not get in the habit of prefixing every command with those 4 magic letters.
"If you haven't got anything nice to say about anybody come sit next to me." — Alice Roosevelt Longworth

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Cant get autostart to work

Fri Jan 08, 2016 12:55 pm

Maybe I can help you out a bit.
ahaz86 wrote:Hello, I have read through many posts on here about getting autostart working on the pi 2 running Jessie.

1. Edited: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart to include lxterminal

2. Edited: sudo nano /etc/xdg/lxsession/LXDE/autostart to include lxterminal

3. Attempted to edit: sudo nano ~/.config/lxsession/LXDE/autostart
The path didnt exist so I created each directory and the file but still no luck.
1. 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.

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

3. That attempt is close, but should have been "/LXDE-pi/" rather than "/LXDE/". Before Raspbian started including the users autostart (and switched from LXDE to LXDE-pi) you had to create your own "/lxsession/LXDE/autostart" to override the one at "/etc/xdg/". If you had used "nano ~/.config/lxsession/LXDE-pi/autostart" you would have been editing the correct autostart, but using "/LXDE/" it created a new file instead, but of course it won't use it.

To add to or edit your user's autostart:

Code: Select all

nano ~/.config/lxsession/LXDE-pi/autostart
That file belongs to the user so don't use "sudo" to edit it.

ahaz86
Posts: 4
Joined: Fri Jan 01, 2016 5:02 pm

Re: Cant get autostart to work

Fri Jan 08, 2016 7:19 pm

JimmyN wrote: To add to or edit your user's autostart:

Code: Select all

nano ~/.config/lxsession/LXDE-pi/autostart
That file belongs to the user so don't use "sudo" to edit it.
THANK YOU SO MUCH!!!! Ugh... I cant believe it was this simple.

gordon77
Posts: 6003
Joined: Sun Aug 05, 2012 3:12 pm

Re: Cant get autostart to work

Fri Jan 08, 2016 7:33 pm

It's usually easy when you know the answer :D

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Cant get autostart to work

Sat Jan 09, 2016 1:00 pm

ahaz86 wrote: THANK YOU SO MUCH!!!! Ugh... I cant believe it was this simple.
You were all around it but hadn't quite hit the right combination. :D

drips
Posts: 6
Joined: Sat Jan 30, 2016 10:35 am

Re: Cant get autostart to work

Sat Jan 30, 2016 10:46 am

Hi. Sorry for bumping, but I still have the same problem.
I am very new to Raspberry Pi and Raspbian, so it may be a simple solution.

I am trying to autostart midori, but the Pi just boots to the default screen. I've done what you guys said and used the autostart
" nano ~/.config/lxsession/LXDE-pi/autostart "

And this is what my autostart looks like:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash


@xset s off
@xset -dpms
@xset s noblank
@midori -e Fullscreen -a http://google.com

I appreciate all the help I can get!

muuh
Posts: 5
Joined: Tue Feb 07, 2017 9:12 pm

Re: Cant get autostart to work

Tue Feb 28, 2017 11:10 pm

same here (for 2017-02-16-raspbian-jessie), by trying to start a script with

@~/.script.sh

where ".script.sh" is chmod 744 (or 777). the script works by manually starting it. any hints?

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Cant get autostart to work

Wed Mar 01, 2017 6:40 am

muuh wrote:~/.script.sh
? what is the file name?
i think its script.sh or absolute /home/pi/script.sh or ~/script.sh

to start it use
./start.sh
but when you are not in /home/pi/ must start it with
. ~/script.sh
where there is a "blank" between "." and "~"

! this has nothing to do with the way you want do auto start, just with the way to call your file !

gordon77
Posts: 6003
Joined: Sun Aug 05, 2012 3:12 pm

Re: Cant get autostart to work

Wed Mar 01, 2017 1:29 pm

drips wrote:Hi. Sorry for bumping, but I still have the same problem.
I am very new to Raspberry Pi and Raspbian, so it may be a simple solution.

I am trying to autostart midori, but the Pi just boots to the default screen. I've done what you guys said and used the autostart
" nano ~/.config/lxsession/LXDE-pi/autostart "

And this is what my autostart looks like:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash


@xset s off
@xset -dpms
@xset s noblank
@midori -e Fullscreen -a http://google.com

I appreciate all the help I can get!
I tried this on mine and it works , BUT I needed to 'sudo apt-get install midori ' first..

I use the latest Raspbian (NOT Noobs)

Code: Select all

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

@xset s off
@xset -dpms
@xset s noblank
@midori -e Fullscreen -a http://google.com

wheresmattdamon
Posts: 1
Joined: Mon Nov 27, 2017 6:09 am

Re: Cant get autostart to work

Wed Apr 25, 2018 1:57 am

muuh wrote:
Tue Feb 28, 2017 11:10 pm
same here (for 2017-02-16-raspbian-jessie), by trying to start a script with

@~/.script.sh

where ".script.sh" is chmod 744 (or 777). the script works by manually starting it. any hints?
Hi, sorry to bump the thread.
For anyone coming here in the future, to autostart a ".sh" script, you need to add "sh " between the "@" and the file path, so that your entry looks like "@sh ~/.script.sh" instead of "~/.script.sh".

Ryan780
Posts: 10
Joined: Wed Sep 06, 2017 2:12 pm

Re: Cant get autostart to work

Fri Dec 11, 2020 10:13 pm

Does this solution not work anymore? Because for the life of me I can't get it to work . And there is no more .config/lxsession directory to hold an autostart file. So, I don't really know what to put in a new one.

klricks
Posts: 8033
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Cant get autostart to work

Fri Dec 11, 2020 10:20 pm

Ryan780 wrote:
Fri Dec 11, 2020 10:13 pm
Does this solution not work anymore? Because for the life of me I can't get it to work . And there is no more .config/lxsession directory to hold an autostart file. So, I don't really know what to put in a new one.
Have a read here: viewtopic.php?f=66&t=294014
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Return to “Beginners”