Page 1 of 1

Autostart in Raspbian Buster...

Posted: Wed Jun 26, 2019 5:21 pm
by 4k3or3et
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.

Re: Autostart in Raspbian Buster...

Posted: Wed Jun 26, 2019 5:37 pm
by gordon77
Try using /etc/xdg/lxsession/LXDE-pi/autostart

Re: Autostart in Raspbian Buster...

Posted: Thu Jun 27, 2019 6:02 pm
by 4k3or3et
gordon77 wrote:
Wed Jun 26, 2019 5:37 pm
Try using /etc/xdg/lxsession/LXDE-pi/autostart
That's the one. Thanks Man!

Re: Autostart in Raspbian Buster...

Posted: Fri Jun 28, 2019 6:15 am
by MarkDH102
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!

Re: Autostart in Raspbian Buster...

Posted: Fri Jun 28, 2019 7:05 am
by gordon77
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.

Re: Autostart in Raspbian Buster...

Posted: Fri Jun 28, 2019 9:52 am
by sellaholics
Thank you. I have the same problem. Anyone has another solutions?

Re: Autostart in Raspbian Buster...

Posted: Fri Jun 28, 2019 12:37 pm
by klricks
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

Re: Autostart in Raspbian Buster...

Posted: Fri Jul 05, 2019 7:59 am
by divest

Code: Select all

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

also works

Re: Autostart in Raspbian Buster...

Posted: Fri Jul 05, 2019 10:22 am
by gordon77
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?

Re: Autostart in Raspbian Buster...

Posted: Fri Jul 05, 2019 8:43 pm
by W. H. Heydt
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.

Re: Autostart in Raspbian Buster...

Posted: Sat Jul 13, 2019 6:22 pm
by clemon79
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.

Re: Autostart in Raspbian Buster...

Posted: Sat Jul 13, 2019 11:02 pm
by klricks
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.

Re: Autostart in Raspbian Buster...

Posted: Sat Jul 13, 2019 11:39 pm
by W. H. Heydt
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.

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 12:17 am
by clemon79
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.

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 12:34 am
by clemon79
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?

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 12:59 am
by W. H. Heydt
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.

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 1:03 am
by clemon79
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?)

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 1:53 am
by klricks
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.

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 3:23 am
by clemon79
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.

Re: Autostart in Raspbian Buster...

Posted: Sun Jul 14, 2019 3:33 am
by clemon79
Solved my problem: adding the above line to the bottom of ~/.profile works perfectly. I think I’m set now!