Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: A.T.E. on December 31, 2023, 02:23:46 PM
-
Hello,
I am using an Android app named RasPi Check to control my Raspberry Pis. This app is basically a SSH frontend that checks the status of the device and sends commands to it: https://github.com/eidottermihi/rpicheck
On one of them, a Raspberry Pi 2 B, I have just installed piCorePlayer. RasPi Check is able to connect to it, however it does not return some information like the CORE temperature, the ARM frequency, the CORE frequency, the CORE volt and the Firmware version.
The package rpi-vc.tcz is installed (otherwise the app would not work at all). And the app fully works if it connects to other systems like Raspbian, MoodeAudio or LibreELEC.
Is there any configuration that I should make or additional package that I should install?
-
What version of piCore are you running .
tc@Pi5:~$ sudo vcgencmd measure_temp
temp=51.0'C
tc@Pi5:~$ sudo vcgencmd measure_volts
volt=0.9084V
-
Hello, I am running:
piCorePlayer v8.2.0
linux 5.15.35-pcpCore-v7 (32)
piCore v13.2
Then, I can manually run the commands:
tc@pCP:~$ sudo vcgencmd measure_temp
temp=37.9'C
tc@pCP:~$ sudo vcgencmd measure_volts
volt=1.2000V
However, RasPi Check still is not getting that information, if, in the app configuration, I put the tc password as the sudo password or if I leave it blank.
-
You cannot login with root.
The device /dev/vcio, is owned by root:root and is only user readable. You can change the permissions of this file in your boot scripts.
-
Well, does the below mean that in my case it is not user readable?
tc@pCP:~$ ls -ali /dev/vcio
975 crw------- 1 root root 10, 126 Jan 1 1970 /dev/vcio
Should I put somewhere (I am new to TinyCore, I shall find out where and what the boot script is) "chmod a+r /dev/vcio" ?
-
Yes.
/opt/bootlocal.sh
-
Hello,
I have added the line
chmod a+r /dev/vcio
to /opt/bootlocal.sh and then I have run
filetool.sh -b
Yet, after the reboot, although /opt/bootlocal.sh contains the line I added at the bottom of it, it is still:
tc@pCP:~$ ls -ali /dev/vcio
962 crw------- 1 root root 10, 126 Jan 1 1970 /dev/vcio
On the other hand, if I manually run
sudo chmod a+r /dev/vcio
Then the permissions change
tc@pCP:~$ ls -ali /dev/vcio
962 crw-r--r-- 1 root root 10, 126 Jan 1 1970 /dev/vcio
But still Raspi Check cannot get the temperature
-
Hi A.T.E.
... Yet, after the reboot, although /opt/bootlocal.sh contains the line I added at the bottom of it, it is still: ...
Maybe the device doesn't exist yet?
Try changing bootlocal.sh to this:
if [ -c "/dev/vcio" ]
then
echo "vcio found" > /home/tc/vcio.status
else
echo "vcio not found" > /home/tc/vcio.status
fi
chmod 644 /dev/vcio
Run filetool.sh -b and reboot. Check the contents of vcio.status
to see if the device existed when you tried to run chmod.
-
Hello,
First of all, apologies as I had not correctly added the chmod line into /opt/bootlocal.sh (I had put it at the bottom of the script instead of putting it right after the line reading "# put other system startup commands here").
I have corrected that, and the if/fi condition creates now the /home/tc/vcio.status file which contains the line "vcio found".
And:
tc@pCP:~$ ls -ali /dev/vcio
991 crw-r--r-- 1 root root 10, 126 Jan 1 1970 /dev/vcioYet the app RasPi Check is still unable to retrieve the temperature.
-
What are the exact commands being executed the the remote software?
-
I don't know. I have tried to search the answer, and I have found this page: https://github.com/eidottermihi/rpicheck/issues/161 that incidentally gives some indications about what the app is doing.
Also, if vcgencmd is not present, the app gives an error message reading:
"The tool 'vcgencmd' was not found on your Pi. Make sure it is located under '/usr/bin' or '/opt/vc/bin' and your SSH user is in group 'video'."
In LibreELEC, on which the app is fully working, vcgencmd is like this:
LibreELEC:~ # which vcgencmd
/usr/bin/vcgencmd
LibreELEC:~ # ls -ali /usr/bin/vcgencmd
556 -rwxr-xr-x 1 root root 12196 Dec 20 05:55 /usr/bin/vcgencmd
LibreELEC:~ # ls -ali /dev/vcio
86 crw------- 1 root root 10, 127 Feb 16 2023 /dev/vcioIn LibreELEC, it is root that connects via SSH.
-
We package software into /usr/local/bin
So you will need to create a symlink to /usr/bin
-
@A.T.E.: I ran into a situation similar to this quite some time ago and I found that cheating was my only "easy option" to get past SSH and non-root user access.
1. Remove your recent chmod changes
2. in /opt/bootsync.sh BEFORE the line that reads /opt/bootlocal.sh & add:
mv /usr/bin/vcgencmd /usr/bin/new_vcgencmd
cat > /tmp/vcgencmd << EOF
#!/bin/sh
sudo /usr/bin/new_vcgencmd $@
EOF
mv /tmp/vcgencmd /usr/bin/
Repeat as necessary for any apps/scripts/etc. which require root access
filetool.sh -b when you're done to save the changes.
What we're basically doing is swapping out the original executable (vcgencmd) with a script that runs our now "new" executable with super-user (sudo) access.
With TinyCore, even if you logged into SSH as root, you'd still be sent back to the TC account once you've finished logging in, and since the TC account has Sudoer's access without needing a password, this was the only way I could find to do something similar to what you're after.