How to run a script from startup on Raspbian 10 (buster)? - raspbian

I have designed a GUI that I want to run as soon as I turn on my Raspberry Pi. It is currently set up to automatically log in as user on startup, but if that makes the process more difficult I can change that. My Raspi runs on Raspbian 10 (buster), which has made things difficult since I can only find tutorials for Raspbian 8 or so.
I have tried modifying autostart folder, but it is not in the same location as it was in previous Raspbian versions and doesn't seem to be working the way it used to. Tutorials have said to create a .desktop file in /home/pi/.config/autostart but I don't have a .config folder, or at least it's hidden. For me, autostart is in /etc/xdg/autostart and when I try to create a new file here using nano in the terminal, I get the message [Directory '/etc/xdg/autostart' is not writable] and it doesn't save my file.
I have also tried calling my script in /etc/rc.local but it did nothing. Some have said it doesn't work for GUIs.
Here's what I type into terminal:
$ nano /etc/xdg/autostart/gui.desktop
and a new file pops up, but at the bottom I get the warning [Directory '/etc/xdg/autostart' is not writable]
How can I get my GUI script to run on startup with Raspbian 10 (buster)?

There are a number of issues here, first when you are looking at tutorials recognize that Linux distros are built in layers, for simplicity let's say your "layer stack" looks like this: kernel, systemd, x11, xdg, lxde. The kernel boots, then starts systemd, which then starts x11 (and a lot of other stuff), x11 starts xdg (and some other stuff, I think), lxde is started by either x11 or xdg I'm not sure which.
You want to add something to this process, you can do it at the kernel level (bad idea), at they systemd level (probably not right unless its a daemon), at the x11 level (still probably bad as you still don't have a user session yet), or at the xdg or lxde level.
xdg is probably the right place as it has all you need ( a gui, a user session) while being common (xdg will still work if you switch window managers, probably)
With that out of the way, why isn't your solution of modifying xdg working? It's because '/etc/xdg/autostart' is a system configuration directory. Any changes made to it will apply to all users. You may want this, but the system is trying to protect other users on your system and only allows root to make changes to everyone. If you want to do that use "sudo" (documented elsewhere on stack exchange and the internet). If you want to do it just for you use ~/.config/autostart, (https://wiki.archlinux.org/index.php/XDG_Autostart) you might need to create that directory with "mkdir ~/.config/" and then "emacs ~/.config/autostart"

Would it be better to have the python program run in a terminal window from startup? That way you would see what it is doing in case of errors.
If so, perhaps check this out https://stackoverflow.com/a/61730679/7575617
By the way, in the file manager, hit CTRL+H to toggle viewing hidden files and folders.

Related

BeagleBone Black uEnv.txt empty

I've recently purchased a BeagleBone Black. I installed the drivers, got myself a SD card and an external card reader,7yip and win32 disk imager just like the Beaglebone startup guide told me to. However, when I put my disk on the micro-sd card and insert that into the Beaglebone, I need to tell it to boot from micro-sd.
For that I need to go to the SSH terminal (putty) and type the following:
sudo nano boot/uEnv.txt
In that I need to remove the # at the start of
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
for it to boot off the SD. The first time I did this, it worked. I was just navigating down to the line of code when putty told me that it has disconnected. The next dozens of times I tried to access uEnv.txt, it was completely empty. I don't know why it crashed, nor have I found out how the hell I get it to work. I have unzipped the original file again and installed a new disk several times now, but it's still empty.
EDIT:
Hmm, I've heard win32 disk seems to be unreliable. I'll attempt to use another program, but I don't think that's the problem. But take this into consideration
I found the answer!
I asked a guy I know who has more knowledge in this area. It turns out all this time I was just creating a NEW uEnv.txt file. For all other people who might be struggling with this; The command to open the uEnv.txt file is
sudo nano ./boot/uEnv.txt
The ./ plays a very important role here. From there you can edit the file as you wish.
I hope this helps!

Frustrated with WampServer

I've downloaded WampServer twice. The specifications for my WampServer are: "Apache/2.4.17 (Win64) PHP/5.6.16 - Port defined for Apache: 80" and for MySql: "5.7.9 - Port defined for MySQL: 3306". The first time, it worked for sometime (2 weeks) and then it started to complain about:
*** ERROR *** The PHP configuration loaded file is: - should be: C:/wamp64/bin/apache/apache2.4.17/bin/php.ini or c:/wamp64/bin/php/php5.6.16/phpforapache.ini".
When I tried to try to move php.ini files to the right locations there was many of them ("for production ,"for development", "phpforapache" and one that just said it was an ini file). Since I was getting the error that no mbstring extension was found, I went ahead and made sure i un-commented ;extension=php_mbstring.dll from all those ini files. Guess what, nothing worked.
So I decided to uninstall WampServer and downloaded it again. It worked. But after I shut my computer down, it gave the same exact problems as before.
I've been looking online to see how I can fix this problem. There are many solutions but none of them seem to work. There's one where there must not be Internet Information Services on, one where I have to set the system environment variable value to the path of my php ini file, one where I must make sure no other service or program is using port 80. I have made sure that port 80 isn't accessed by other programs already.Then, other solutions mentioned that i should change 127.0.0.1 on my httpd.conf file to "all". Finally, there's another problem that says Skype should not be turned on. I do have Skype for business, but is not turned on. I've tried to delete it and uninstall many times, but somehow is not going away. However, WampServer has worked for me in the past.
More strange things: The only way that WampServer will turn green is if I double tap on the desktop icon. Then, it asks me if I will allowed it to make changes to my hard drive. I've tried stopping services and restarting them, but it wont start this way. Also, when I typed localhost it takes me to the WampServer homepage, but if I try to access "phpMyAdmin" it gives me that the extension to "mbstring" is not found. Here is probably the strangest of all: When I click on my task manager and check for services running on my computer, it says that "wampmysql64" and "wampapache64" are both running, while the the icon for WampServer is red. Also, if i test the files under the www folder: one of them is called "testmysql.php" it gives me this error: Fatal error: Class 'mysqli' not found in C:\wamp64\www\testmysql.php on line 7. The other file "test_sockets.php" gives the server error: Extension PHP sockets not loaded.
I don't know why this product is out there if it will do as it pleases: move files, change ports and all these extensive checks that must be made in order to make sure it works. Am seriously looking for an alternative. Sad, cause the graphical interface seems so easy to understand and navigate through.
Please can someone give me a hand. I am seriously thinking about uninstalling WampServer, loading it again and giving it another go. But, i know all those problems will come back.
I ran into the same problems as you did, and I got the answer by checking on their forums. To begin with, exit Wampserver. According to this page*, you should take the following steps:
Open a command prompt window, and run as administratorC:\Windows\system32>
Move to the apache directory C:\Windows\system32>cd C:\wamp\bin\apache\apache2.4.17\binC:\wamp\bin\apache\apache2.4.17\bin>
Create a symbolic link linking the php.ini to phpForApache.ini in the PHP directory
C:\wamp\bin\apache\apache2.4.17\bin>mklink php.ini C:\wamp\bin\php\php5.6.15\phpForApache.ini
You should get a response that sayssymbolic link created for php.ini <<===>> C:\wamp\bin\php\php5.6.15\phpForApache.ini
For Wampserver to run correctly, it has to be run as administrator. So locate the desktop and start menu shortcuts for Wampserver and right-click. Then select Properties > Shortcut > Advanced and check Run as administrator
After applying changes, you can start up Wampserver again and it will run normally.
*The page is in French, so you may need to run it through Google Translate
I resolved that issue: I just renamed the file phpForapache.ini in the php directory to php.ini, then I copied this php.ini to apache directory; finally all the troubles is resolved.
I hope this helps you.
Thanks for the answer #tizak. What I did is I uninstall wampserver and downloaded the previous version for my 64 bit machine. It hasn't given me any problems.

Using Arch Linux, Self is installed, but there are no messages

I downloaded Cinnarch and have it running on a virtual machine. I tried to install Self, only to find that it was already installed. So I tried playing around with it, but there's a problem. Numbers, strings, etc. work, but I can't send any messages. I can't add 1 + 1. The only advancedish thing I've been able to accomplish is make new objects. What can I do to get my Self system fully working?
Self is similar to Smalltalk in that you need both a virtual machine, and the default distribution of objects. There are a very small number of default primitive methods, and a parser built into the VM itself to help bootstrapping. You need to get the Self equivalent of the standard library/environment.
You can either:
go to http://selflanguage.org/download/index.html and download a .snap file, then start it by running Self -s filename.snap A snapshot is a frozen collection of objects like a Smalltalk image file.
Clone the sources from https://github.com/russellallen/self, cd into the objects directory and run Self -f worldBuilder.self This will build the default snapshot from source. If you want to open a GUI development environment, do 'desktop open'.
Either way should get you to a prompt which gives the right answer to 3 + 4.

iOS Processes Info (pid, uid, cpu, mem, ...)

I'm writing app like System Activity in Mac. I used modified darwin.h and darwin.c from this topic.
But it seems that it shows correct info only for certain fields (and some time ago it showed all correct info but only for current process - this app), for everything else it shows correct only pid, process name, group/owner. Everything else like cpu/mem/disk usage is nulled. I think it may be something with sandbox or security. Tried to move application to /Applications and setting root/wheel 755 but it's not work, still zeroed values.
Here's my output : click
Code changed in darwin.c : click, written after a lot of commented printf lines
Also there is a free apps approved in AppStore like SystemInfo (com.lymbilesoft.systeminfoliteforiphone) that shows detailed info about disk and processes, so how do it work? Tried nm-ing it's binary but did not find something useful.
Can someone please help me with it?
I'm not sure if this is the only problem, but it certainly is possible that your app needs to run as root for this to work correctly.
However, simply installing the app in /Applications, doing chown root.wheel, and chmod 755 will not cause it to run as root. It will still run as user mobile.
In order to get the app to run as root, see this answer
I've used this technique successfully, and if you have a jailbroken phone, you can navigate to /Applications/Cydia.app and see that this launch script is how Cydia does this, too.
I use ps aux from the Terminal/Command Line. That gives me all the stuff I need, regarding your concerns.

Debugging Solaris OS crash

I have access to a remote Solaris terminal which crashes occasionally, and I have to ask someone with physical access to boot the machine up, which it does successfully. I would like to know which tools/files should I look at to find out the cause of the crash so that I can make the necessary configuration changes and avoid it in the future.
What tools you can use will depend on what version of solaris you have running and what the actual problem
is. The first thing to do is check the system console (which it sounds like you don't have access to) and the /var/adm/messages file. This file is updated with system messages and the newest will appear at the end.
Next, you can look for a system core file. If a core file is created, it would be in /var/crash/hostname where "hostname" is the name of the machine.
If you have an actual core file in the /var/crash/hostname directory, this set of commands will give you a good
string to search google with:
# cd /var/crash/hostname
Replace "hostname" with the hostname of your machine.
# mdb -k unix.0 vmcore.0
If you have multiple core files, select the most recent version.
> ::status
This should give you a panic message, cut and paste that into google and see what you can find.
For more core file analysis read this:
http://cuddletech.com/blog/pivot/entry.php?id=965