Auro Run A Script In Terminal MOde On Boot

Oct 31, 2023 Last reply: 2 years ago 20 Replies

I am running Bookworm Lite on a Rspberry Pi Zero 2 W



I have written a python script to display the output from my Solar Panels. The script works well.



How do I get the Pi to run this script on boot and display it on the screen ie in a form of Kiosk Mode I suppose?


Stephen,

Pick one :

formatting link
Regards, Rudy Wieser

Be aware of the limitations of root-level autostarts however - esp for "graphical" apps. When a user gets fully logged in there is a "screen" on which all the graphical stuff can be displayed. However if using root crontab or a number of other tricks they run early, BEFORE the individual user. There's no screen.

Recently wanted a user to autologin - easy - and then for a specific python script to run. Worked on a Pi3, but NOT on a Pi4 ... very strange. All the usual tricks ... /home/pi/.config/lxsession/LXDE-pi/autostart ... did NOT work. Couldn't even get to start from .profile or .bashrc

Find my other recent thread about how to get around this odd Pi4+Bookworm issue.

Followup -

The failure of /home/pi/.config/lxsession/LXDE-pi/autostart appears to be linked to use of the Wayland display system. Switching back to X11 it all works like it used to.

Follow-up to your follow-up

I trust that you've also posted a bug report to

formatting link

No. It's linked to the fact that Wayland doesn't use LXDE but wayfire and wf-panel-pi.

Nope. It's clearly a Wayland issue - one of MANY.

NOT a 'Pi" issue per-se. Almost not a Deb issue, except that Deb is kinda pushing Wayland.

Wayland has had a LONG time - but it's seriously incompatible with vast numbers of existing apps and techniques at the high and low levels.

IMHO, only those who NEED the "speed" - and it's not THAT much better - like for stupid games should think about Wayland. Everyone else, stick to X11.

Some use Linux for "fun" - and that's fine so far as it goes. However the biggest and most important use for Linux is for SERIOUS BUSINESS ... like keeping the whole hidden infrastructure going. IBM didn't buy M$, it bought RHEL. That's where the Real Stuff is happening, the LiniVerse.

And yea, the BSDs are maybe even better at some stuff, esp 'security' and overall 'solidness' - but are also behind the curve in some important ways too. However, if I had to build a whole new corporate system NOW ... I'd use OpenBSD as the foundation.

LONG LONG back I found Red Hat on the software shelf at WalMart (yes, they had that). A bunch of 5 1/4 floppies were in there. After a few days of messing around and downloading a few things over dial-up, I actually got "X" and the keyboard/mouse to work - and was happy. However, other than being "Not Windows" it didn't DO much of interest - so I ignored it.

A couple years later I found the green/white SUSE LINUX box on a shelf (Best Buy ?) and it was a CD. It was drastically easier to install and had a much more interesting selection of apps. NEXT to it on the shelf was a very cheap box containing Oracle DB, ported to Linux. NOW I was much more interested.

Kinda never went back after that. SUSE was a serious supp, eventually replacement, for more and more Winders Infrastructure stuff.

Alas, of late, OpenSUSE has kinda gone downhill. It's no longer the "Cadillac System" it used to be - I think a result of the IBM buyout of RHEL. It's been the DebiVerse thereafter - for now. Depends on how STUPID Deb gets with STUPID changes.

Yea, yea, X11 *is* a kinda complicated mess at this point. However it's extremely WELL DOCUMENTED and it WORKS with everything. Sometimes it's better to stick with the Devil You Know.

Now if you're doing "headless", non-GUI, uses of Linux ... pure servers and such ... then the "X"/ Wayland thing is of almost zero interest. I'd suggest staying away from the RHEL derivatives because you're now essentially beta-testers for RHEL instead of fully with it. Deb is still quite good for "pure", though NetworkManager makes me wonder.

Arch derivs are good - though the package/ports system IS unnecessarily weird. Slack IS still out there too. The BSDs remain strong/safe competitors for certain kinds of "servers" too - and more diversity is being seen in that universe. "Dragonfly" is a fairly nice GUI/Desktop BSD, gotta admit, and there are a few competitors now.

And there's always the infamously-difficult Plan-9 :-) DID get it to do SOME useful stuff, after a lot of effort ........

HOPING for a modernized VMS ... it was WAY ahead of it's time ! Still have a 300+ page, small-print, manual ......

Oops ... too much ?

That's part of the issue - very much. Thing IS that Wayland isn't - and IMHO will NEVER be - really Ready For Prime Time. It has a *niche* - mostly "gamers" - but for extreme compatibility with All That Has Come Before you should stick to X11.

You CAN use Linux for "games" - but the 99% Real World use is NOT for "games" but for The Infrastructure. If you're doing GUI, stick with X11 for max compatibility. If you're doing "headless"/non-gui, servers, then it barely matters.

Around the same time (perhaps a little earlier) I found SLS for sale on floppies. I had been a unix developer for several years at that time and was very happy to have a unix workstation at home. Windows was of no interest to me - I was seriously disgusted when it first appeared and I found it incapable of running multiple DOS applications in parallel - after all DesqView could! I soon found FreeBSD which lacked all of the shortcomings of early Linux (the original TCP stack was crap!) and have been using it ever since - for the last thirty years it has failed to let me down or piss me off. Windows lasts less than thirty minutes before doing one or both - Linux lasts longer if the installation doesn't drive me demented (there's a Linux VM that I use for a handful of applications I can't be bothered to make work under compatibility) - but nothing has had the staying power of FreeBSD.

I'm really not sure in which ways it is behind the curve - but not in any ways that have ever mattered to me.

For work I use a Macbook (they're paying) - it handles the MS orifice stuff perfectly well and provides a POSIX compliant shell.

X11 is, like PostScript*, Systemd , and even MSDOS and Windows, a total disaster of a protocol written by ComputerScientists, who are arguably even worse than ArtStudents when let near a computer.

However as the only game in town, software engineers have spent many lifetimes avoiding and hiding its completely unnecessary features and getting it's necessary ones to work, hiding its sheer ugliness under graphical toolkits that are almost useable.

Like a Porsche 911, it is now a triumph of development over design.

Stick to the roads more travelled.

*The original Apple Laserwriter PostScript Printer cost more, and had a bigger CPU and more RAM than the Apple desktops that drove it.

One thing X11 and PostScript in common is remarkable staying power, extensibility is one (possibly the only one) thing computer scientists tend to do well.

One thing X11 had over everything else was portability, you can run it on anything with sufficient (not very much) capability. The first time I had X11 running at home it was on an Interactive Unix for PC old enough that it lacked TCP/IP and shared memory which left pseudo-tty pairs as the only client server communication supported (every window a separate pair) - and the that was only implemented on one side on the X11R5 tape (server IIRC) so I had to write the other side myself.

It took me two weeks to get a moving X on a black background, and another day to get twm and a bunch of applications up.

Note that portability is what kept unix going from 1975 until the PC became the dominant server architecture, at first the PC was just yet another platform to unix system developers.

Oh and if you think that PostScript is a mess for page layout then please take a good look at XSL-FO and the fun and games involved in using XSLT (the only language I know of where an important flow control mechanism is essentially COME-FROM with wildcards) to translate a markup language like dockbook XML into XSL-FO and the even more extreme fun and games involved in correctly rendering XSL-FO on a printer or even just as an array of pixels. It makes HTML and CSS look sane.

By comparison troff and PostScript are wondrously straightforward and sensible designs.

Agreed. X11 is *ancient* - yet still doing serious work. Also, many little utils and such just EXPECT X11 ... my recent experience with /home/pi/.config/lxsession/LXDE-pi/autostart not working was due to Wayland. Gotta put autostart in a different place with Wayland, and it's not quite as flexible.

Wayland, well, let the "gamers" have it. I'm not interested in "games" but "infrastructure/devices". For that I want everything as super-compatible as possible.

X11 *is* a mess, no question, but it WORKS WELL.

It works well because thousands of man hours have been put into it to

*make* it work well.

Same as systemd and PostScript. And a Porsche 911. And Windows.

If that effort had been put into Wayland instead we would have a graphics interface that use way less CPU and RAM.

But it's all too late, now. We have to make the best of a bad job.

Perhaps, but by the time Wayland appeared most of that effort had already taken place, it would have been a long wait for a graphical interface, X11 dates back to 1984 while Wayland didn't turn up until 2008. Finally Wayland doesn't work over a network which is one of X11s great strengths and a feature I use quite often.

I am not arguing with that.

I tried to use it and it was pants.

It's crap over a WAN IME (mind you I haven't tried across a WAN since I got FTTH) but on a LAN most applications work fine. Here's one I use regularly - my Calibre book repository lives in a jail (container in linux speak) on my NAS, so to run the GUI on my workstation I run (canned in a menu entry in my WM):

ssh calibre@library -f calibre

and up pops the perfectly responsive application window. The old way of permitting access to the X server directly from the host library would be even faster but very insecure. The big advantage over the remote desktop approach is that library isn't running any kind of graphical interface.

Now try streaming video over it

That's not going to work well.

Well ... maybe not Winders .... :-)

X11 isn't "bad" - it's just a long-clunked-together and forever-debugged display system. Yep, in THEORY, Wayland can be smaller/faster ... but in PRACTICE I just don't see it becoming 'generally useful' since SO many of the bits and pieces of the LiniVerse just ASSUME X11.

The FIRST Linux I ever bought - RedHat off a WalMart shelf - had X11. I remember the low-rez base screen with a big "X". Took me a week to get the KB/Mouse working right. BUT, it WAS a GUI for Linux. Got SUSE a couple years later, MUCH easier to get going. That's when I started to dump Winders. I own NO Winders devices ... haven't for a LONG time now.

Hmmm ... maybe an "AI" can go over X11 and tighten it up a bit ? Bound to be a lot of redundancies and un-optimized code in there.

Oh, and as the HARDWARE keeps getting faster, does the "slower" aspect of X11 really MATTER so much ? The Pi4 is often at least twice as fast as the Pi3, and the Pi5 is reputed to be 2-3X faster than the Pi4 for many uses.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required