4k3or3et
Posts: 48
Joined: Sat Nov 17, 2018 5:47 pm

Autostart in Raspbian Buster...

Wed Jun 26, 2019 5:21 pm

Hi guys

in Raspbian 9 there was a file:

/home/user/.config/lxsession/LXDE-pi/autostart

where you could put some command which were executed by given user at boot.

In Raspbian 10 folder '/home/user/.config/lxsession' does not exist.

The thing is that i need to run command every single boot and the command needs to be executed by regular user not root.

i found '/home/fyahhaffibun/.config/autostart' but putting there scripts does not invoke them at boot (there are only *.desktop files which sort of .lnk equivalent in Windows i believe).

Where is the autostart which supports terminal commands in Raspbian 10?

Thank you.

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

Re: Autostart in Raspbian Buster...

Wed Jun 26, 2019 5:37 pm

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

4k3or3et
Posts: 48
Joined: Sat Nov 17, 2018 5:47 pm

Re: Autostart in Raspbian Buster...

Thu Jun 27, 2019 6:02 pm

gordon77 wrote:
Wed Jun 26, 2019 5:37 pm
Try using /etc/xdg/lxsession/LXDE-pi/autostart
That's the one. Thanks Man!

MarkDH102
Posts: 348
Joined: Fri Feb 13, 2015 3:18 pm

Re: Autostart in Raspbian Buster...

Fri Jun 28, 2019 6:15 am

Sigh.
Why does Linux keep breaking "simple" things on each new distro?
Glad I found this as IF I ever update my 10 Stretch Pi's then I will have to make changes to them all regarding this issue...
I know Microsoft have had issues but I can still run VB6 compiled applications amongst other legacy software on Win10!

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

Re: Autostart in Raspbian Buster...

Fri Jun 28, 2019 7:05 am

Nothing changed this distribution. This used be the place for autostart on the pi, but then a while back it changed to the /.config version, which l believe is the 'correct' location where linux should look if it exists. Then l think with Jessie distribution we went back to /etc... Which was a bit confusing but l assume still correct as /.config... doesn't exist now. Still a bit confusing though if things change.

sellaholics
Posts: 1
Joined: Fri Jun 28, 2019 9:50 am
Contact: Website

Re: Autostart in Raspbian Buster...

Fri Jun 28, 2019 9:52 am

Thank you. I have the same problem. Anyone has another solutions?

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

Re: Autostart in Raspbian Buster...

Fri Jun 28, 2019 12:37 pm

sellaholics wrote:
Fri Jun 28, 2019 9:52 am
Thank you. I have the same problem. Anyone has another solutions?
What problem?
The solution was already given in the first reply above by gordon77.
use:

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

divest
Posts: 1
Joined: Fri Jul 05, 2019 7:55 am

Re: Autostart in Raspbian Buster...

Fri Jul 05, 2019 7:59 am

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
file /home/user/.config/lxsession/LXDE-pi/autostart
directory /home/user/.config/autostart/

also works

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

Re: Autostart in Raspbian Buster...

Fri Jul 05, 2019 10:22 am

divest wrote:
Fri Jul 05, 2019 7:59 am

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
file /home/user/.config/lxsession/LXDE-pi/autostart
directory /home/user/.config/autostart/

also works
Do you have to make that directory first, as its not there by default?

W. H. Heydt
Posts: 10911
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Autostart in Raspbian Buster...

Fri Jul 05, 2019 8:43 pm

An overall cleaner solution would be to create the user autostart and then, within it, execute the system autostart. That way, if a new version is installed, you get whatever changes are there and still run the stuff you want to.

As it is, if you modify the system file, not only does it apply to all users (bad idea), but it is subject to being overwritten any time you do a system upgrade. If you just create a local autostart, then nothing in the system autostart will be run unless you explicitly do so.

clemon79
Posts: 6
Joined: Sat Jul 13, 2019 6:15 pm

Re: Autostart in Raspbian Buster...

Sat Jul 13, 2019 6:22 pm

I'm trying to do the same thing, except I''m just trying to execute an xinput command to flip my touchscreen digitizer input so I can use it upside down, specifically:

Code: Select all

xinput set-prop 'TSTP MTouch' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
I'm on Buster, I've tried editing

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
(adding the line above, both with @ and without), I've tried creating

Code: Select all

~/.config/lxsession/LXDE-pi/autostart
and editing that, and I've tried using the full path to xinput (using

Code: Select all

which xinput
to find it; I don't remember it offhand) , but I can't get it to work. What am I doing wrong? This shouldn't be that hard and it's really frustrating.

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

Re: Autostart in Raspbian Buster...

Sat Jul 13, 2019 11:02 pm

clemon79 wrote:
Sat Jul 13, 2019 6:22 pm
I'm trying to do the same thing, except I''m just trying to execute an xinput command to flip my touchscreen digitizer input so I can use it upside down, specifically:

Code: Select all

xinput set-prop 'TSTP MTouch' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
I'm on Buster, I've tried editing

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
(adding the line above, both with @ and without), I've tried creating

Code: Select all

~/.config/lxsession/LXDE-pi/autostart
and editing that, and I've tried using the full path to xinput (using

Code: Select all

which xinput
to find it; I don't remember it offhand) , but I can't get it to work. What am I doing wrong? This shouldn't be that hard and it's really frustrating.
Try the command without any ' or "

Code: Select all

@xinput set-prop TSTP MTouch Coordinate Transformation Matrix -1 0 1 0 -1 1 0 0 1
If that does not work the try this:

Code: Select all

@lxterminal -e xinput set-prop TSTP MTouch Coordinate Transformation Matrix -1 0 1 0 -1 1 0 0 1
Note that if a file named autostart exists in /home/pi/.config.............. then the autostart at /etc/xdg/.......... will be totally ignored.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

W. H. Heydt
Posts: 10911
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Autostart in Raspbian Buster...

Sat Jul 13, 2019 11:39 pm

klricks wrote:
Sat Jul 13, 2019 11:02 pm
Note that if a file named autostart exists in /home/pi/.config.............. then the autostart at /etc/xdg/.......... will be totally ignored.
That's why, if you create an autostart file in /home/<username>/.config you should start by having it execute the system autostart and only after that, add the additional commands you want to have executed.

clemon79
Posts: 6
Joined: Sat Jul 13, 2019 6:15 pm

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 12:17 am

klricks wrote:
Sat Jul 13, 2019 11:02 pm
Try the command without any ' or "

Code: Select all

@xinput set-prop TSTP MTouch Coordinate Transformation Matrix -1 0 1 0 -1 1 0 0 1
If that does not work the try this:

Code: Select all

@lxterminal -e xinput set-prop TSTP MTouch Coordinate Transformation Matrix -1 0 1 0 -1 1 0 0 1
Really,. that would parse? It would know that the device name is TSTP MTouch and that the specific property I want is the Coordinate Transformation Matrix? I'll give it a shot but you understand my skepticism. :)

EDIT: Yep, didn’t parse. Also when trying that at a terminal prompt (where it works fine in original form!) it told me it could not find the “TSTP” device.

clemon79
Posts: 6
Joined: Sat Jul 13, 2019 6:15 pm

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 12:34 am

W. H. Heydt wrote: That's why, if you create an autostart file in /home/<username>/.config you should start by having it execute the system autostart and only after that, add the additional commands you want to have executed.
Can you share what that would look like?

W. H. Heydt
Posts: 10911
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 12:59 am

clemon79 wrote:
Sun Jul 14, 2019 12:34 am
W. H. Heydt wrote: That's why, if you create an autostart file in /home/<username>/.config you should start by having it execute the system autostart and only after that, add the additional commands you want to have executed.
Can you share what that would look like?
Assume the user name is 'pi'. Within an executable autostart file...

Code: Select all

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

stuff I want to do.
More stuff I want to do.

clemon79
Posts: 6
Joined: Sat Jul 13, 2019 6:15 pm

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 1:03 am

W. H. Heydt wrote:
Sun Jul 14, 2019 12:59 am
Assume the user name is 'pi'. Within an executable autostart file...

Code: Select all

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

stuff I want to do.
More stuff I want to do.
Okay, so no need for other syntax? For example, I could do:

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
xinput set-prop 'TSTP MTouch' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
...then chmod it 755 (or 644?), and that should work? (And what's the "@" sign mean in these autostart files?)

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

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 1:53 am

clemon79 wrote:
Sun Jul 14, 2019 1:03 am
W. H. Heydt wrote:
Sun Jul 14, 2019 12:59 am
Assume the user name is 'pi'. Within an executable autostart file...

Code: Select all

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

stuff I want to do.
More stuff I want to do.
Okay, so no need for other syntax? For example, I could do:

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
xinput set-prop 'TSTP MTouch' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
...then chmod it 755, and that should work? (And what's the "@" sign mean in these autostart files?)
Yes you can do it that way but it is optional and has nothing to do with whatever your issue is.
The @ is optional and is supposed to re-execute the command on failure. Not much more info on that that I can find.

In some cases a delay is needed before the command is executed to make sure the OS has completely booted and/or logged in before your command is executed.

To do that you would need to create a bash script and call the bash script from autostart.

Code: Select all

#!/bin/bash
sleep(3)  # adjust delay as needed.
<your command here>
(Make sure your bash script works from the command line before trying in autostart)

Note: Do not attempt to put sleep commands directly in autostart. They won't work as autstart executes commands all at once..... Or it does not wait for the current command to complete before starting the next one.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

clemon79
Posts: 6
Joined: Sat Jul 13, 2019 6:15 pm

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 3:23 am

Okay, well, first thing I am trying to do right now is just get an autostart working in .config/lxsession/LXDE-pi that calls the one in /etc/xdg/lxsession/LXDE-pi correctly. Apparently just making a text file with the line above and chmoding it (and I’m also not sure if ‘pi’ or ‘root’ should have ownership of the file) isn’t enough. Once I get that working (because that seems like the correct way to do it so it doesn’t get blown out after an update) I will worry about the touchscreen again.

That said, I did discover a way to do the xinput command entirely with IDs instead of strings:

Code: Select all

 xinput set-prop 6 115 -1 0 1 0 -1 1 0 0 1
seems to work fine. So that’s now an option.

clemon79
Posts: 6
Joined: Sat Jul 13, 2019 6:15 pm

Re: Autostart in Raspbian Buster...

Sun Jul 14, 2019 3:33 am

Solved my problem: adding the above line to the bottom of ~/.profile works perfectly. I think I’m set now!

Return to “Beginners”