Odroid XU4 Fan speed.

I used to just edit the rc.local file and add a line of code to it but now rc.local is ignored how do I use the following line to change the fan speed? I have changed it manually but after each reboot the speeds change back to default which is why I had the edit to rc.local.

How do I keep the temp_levels file edited or at least edit it every startup again?

echo "40 50 65" > /sys/devices/odroid_fan.*/temp_levels

P.S. I have tried adding it to rc.local again but that is ignored for some reason.

bump?

Hmm DietPi does not use rc.local anymore for its own scripts, but we don’t touch it’s finality. But on default Raspbian/Debian images it might be not enabled.

Please check/assure that rc-local.service is enacted and rc.local executable:
systemctl enable rc-local
chmod +x /etc/rc.local

Afterwards it should work.

:question:

Can you show us the output of:

root@Odroid-HC1:~# ls -lah /sys/devices/ | grep odroid*



root@Odroid-HC1:~# ls -lah /sys/devices/odroid*



root@Odroid-HC1:~# cat /sys/devices/odroid_fan.*/temp_levels



root@Odroid-HC1:~# cat /etc/rc.local



root@Odroid-HC1:~# ls -lah /etc/rc.local



root@Odroid-HC1:~# service rc-local status



But anyway …

[HOWTO] Control automatic fan settings on XU3/XU4

ls -lah /sys/devices/ | grep odroid*

drwxr-xr-x   3 root root 0 Mar 17 14:40 odroid_fan.14



cat /sys/devices/odroid_fan.*/temp_levels

40 50 65



cat /etc/rc.local

#!/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



ls -lah /etc/rc.local

-rwxr-xr-x 1 root root 387 Mar 14 21:28 /etc/rc.local



service rc-local status

● rc-local.service - rc.local backwards compatibility
   Loaded: loaded (/etc/systemd/system/rc-local.service; enabled)
   Active: active (exited) (Result: exit-code) since Sat 2018-03-17 14:39:51 ACDT; 1 day 19h ago
  Process: 1133 ExecStart=/bin/bash -c /etc/rc.local (code=exited, status=2)
 Main PID: 1133 (code=exited, status=2)
   CGroup: /system.slice/rc-local.service

Mar 17 14:39:51 DietPi systemd[1]: Started rc.local backwards compatibility.
Mar 17 14:39:51 DietPi systemd[1]: rc-local.service: main process exited, code=exited, status=2/INVALIDARGUMENT



That is everything. Sorry it isn’t neat. As for the temp_levels file I have edited that and need to every restart.

Mar 17 14:39:51 DietPi systemd[1]: rc-local.service: main process exited, code=exited, status=2/INVALIDARGUMENT

Something with rc.local or rc-local.service seems to be wrong. Actually if I remember right, echo > file does not allow wildcards in file name. Try:

for file in /sys/devices/odroid_fan.*/temp_levels
do
     echo '40 50 65' > "$file"
done

Hmm … no, I miss

But anyway …

 root@Odroid-HC1:~#  nano /etc/rc.local

#!/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.

## Message-start:
echo  "\n - setting Custom Temp. Levels for Fan Speed ... "

## set Custom Temp. Levels for Fan Speed
echo "40 50 65" > /sys/devices/odroid_fan.14/temp_levels


## Message-finish:
echo  " - Done! -\n"

exit 0



root@Odroid-HC1:~# systemctl daemon-reload



root@Odroid-HC1:~#  echo "57 63 68" > /sys/devices/odroid_fan.*/temp_levels



root@Odroid-HC1:~# cat /sys/devices/odroid_fan.*/temp_levels



root@Odroid-HC1:~#  /etc/rc.local



root@Odroid-HC1:~# service rc-local status



root@Odroid-HC1:~# cat /sys/devices/odroid_fan.*/temp_levels

I noticed the echo. Please be aware my script used to work and I do not have any screen attached. I use it as a server. I don’t think that will help in my exact circumstance.

Is rc.local even being used any more? If not why change anything to do with it at all? If it’s no longer being used then wouldn’t I need to change something in whatever has replaced it?

You get two solutions to try out.

Have you test this? No?

If you ask for help and don’t try proposals or post the output, so what can we do?

Personally, I think, have to look for a different field of activity. Bye …

No need to be like that. I don’t know much at all about any of what you wrote and that echo line stood out. I was checking that it wouldn’t cause any issues. If it did I wouldn’t be able to fix and would lose an entire day re-installing my server.

Keeping in mind that I have no gui or screen and only ever access via ssh when needed which of the 2 preposed solutions do you think would work for me?

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 :wink:.
  • 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.

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.

If you’re using 4.x kernel then check this tread out https://forum.odroid.com/viewtopic.php?f=146&t=26365



#!/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.

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.

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

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.