Odroid XU4 Fan speed.

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Odroid XU4 Fan speed.

Post by MichaIng »

rc.local is natively integrated into Debian, though by default on new Debian images not activated. systemctl enable rc-local and making /etc/rc.local an executable file with exit 0 at the end, does the job.

DietPi used rc.local for own scripts until v6.2, thus all our images have an already enabled/functional rc.local implemented. From v6.3 we switched to an own service for DietPi scripts, but left rc.local in place for users who used it for their own scripts as well.

From v6.5 on fresh images will not touch rc.local (nor the underlying services) at all, thus in most cases users need to enable it by themselves. But this doesn't effect existing/upgraded servers.

And back to your issue:
- It is indeed the wildcard "*" within echo target file name. I just tried it on my Stretch VM an found exactly the same error message, where without wildcard it worked well ;).
- So depending on if the fan device has fixed or not, go with k-plans or my last command suggestion.
Shanther
Posts: 41
Joined: Sat Mar 04, 2017 3:12 pm

Re: Odroid XU4 Fan speed.

Post by Shanther »

MichaIng wrote:rc.local is natively integrated into Debian, though by default on new Debian images not activated. systemctl enable rc-local and making /etc/rc.local an executable file with exit 0 at the end, does the job.

DietPi used rc.local for own scripts until v6.2, thus all our images have an already enabled/functional rc.local implemented. From v6.3 we switched to an own service for DietPi scripts, but left rc.local in place for users who used it for their own scripts as well.

From v6.5 on fresh images will not touch rc.local (nor the underlying services) at all, thus in most cases users need to enable it by themselves. But this doesn't effect existing/upgraded servers.

And back to your issue:
- It is indeed the wildcard "*" within echo target file name. I just tried it on my Stretch VM an found exactly the same error message, where without wildcard it worked well ;).
- So depending on if the fan device has fixed or not, go with k-plans or my last command suggestion.


I tried k-plans method with no luck. I will try enabling rc.local and use the script I was running before rc.local was ignored.

How do I make rc-local executable? I use ssh only.

I love how we can adjust the cpu speed but I wish dietpi had something in the same place to adjust fan temps.
Attachments
after systemctl enable rc-local
after systemctl enable rc-local
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Odroid XU4 Fan speed.

Post by MichaIng »

How do I make rc-local executable?
chmod +x /etc/rc.local

But according to the error message I still believe the command inside your script has some syntax error. Could you provide your /etc/rc.local again? Then I can test here.
trikster
Posts: 4
Joined: Wed Nov 18, 2015 6:42 pm

Re: Odroid XU4 Fan speed.

Post by trikster »

If you're using 4.x kernel then check this tread out https://forum.odroid.com/viewtopic.php?f=146&t=26365
Shanther
Posts: 41
Joined: Sat Mar 04, 2017 3:12 pm

Re: Odroid XU4 Fan speed.

Post by Shanther »

MichaIng wrote:
How do I make rc-local executable?
chmod +x /etc/rc.local

But according to the error message I still believe the command inside your script has some syntax error. Could you provide your /etc/rc.local again? Then I can test here.

Code: Select all

#!/bin/sh -e
#
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to disable this script please use systemd to control the service:
# systemctl disable rc-local.service
#
# By default this script does nothing.

echo "40 50 65" > /sys/devices/odroid_fan.*/temp_levels
exit 0
That is the same line that worked in 4.x. I have no idea about coding. What I have found is a manually edit the temp_levels file the fan speeds fix themselves. The problem is that no matter what rc.local seems to be completely ignored now. every reboot I manually nano that file and taadaa it's fixed. I need the temp lower because plex will easily overheat it otherwise.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Odroid XU4 Fan speed.

Post by MichaIng »

Found the reason:
/bin/bash does parse those wildcards, but /bin/sh does not:
root@DietPi:~# l test7/test
-rw-r--r-- 1 root root 11 Mar 30 13:40 test7/test
root@DietPi:~# cat test7/test
no success
root@DietPi:~# /bin/sh -c "echo 'success' > test*/test"
/bin/sh: 1: cannot create test*/test: Directory nonexistent
root@DietPi:~# cat test7/test
no success
root@DietPi:~# /bin/bash -c "echo 'success' > test*/test"
root@DietPi:~# cat test7/test
success
As we reverted to Debian default rc.local file, it was reverted to /bin/sh:
root@DietPi:~# cat /etc/rc.local
#!/bin/sh -e
...
Jep we should have thought about this, as our own rc.local script used bash and user commands can rely on this shell.

But as you can see your rc.local is not ignored, it does indeed contain a syntax issue/not parsed wildcard by changed shell.

But why insisting in using your old command? Why not just avoid wildcard by giving known fixed folder name or use my method above? Both works well with bourne shell:
for file in /sys/devices/odroid_fan.*/temp_levels
do
echo '40 50 65' > "$file"
done
Otherwise switch back to "#!/bin/bash -e" with rc.local.
Shanther
Posts: 41
Joined: Sat Mar 04, 2017 3:12 pm

Re: Odroid XU4 Fan speed.

Post by Shanther »

So in short I just need to change the script in rc.local to;

Code: Select all

for file in /sys/devices/odroid_fan.*/temp_levels
do
 echo '40 50 65' > "$file"
done
If I change it to that it should work right?

EDIT: IT WORKED!!!! I repeat that made everything work perfectly. Thanks heaps.
Post Reply