Jump to content

Recommended Posts

On 8/29/2020 at 1:11 PM, Igor said:

 

Thanks! I tried running a sudo echo 20000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp but I get permission denied, so I edited the file with the temperature I wanted and saved it but it returns to 65000 after a reboot.

 

Anyway to keep it to my set value?

Link to comment
Share on other sites

10 hours ago, Pedro Teixeira said:

Thanks! I tried running a sudo echo 20000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp but I get permission denied


Strange. It worked for me when I was implementing this feature. My fan spins up and down when script starts ... as designed.

 

Since this feature was just added you might not use correct kernel ... which is why we always asks for logs when asking for any help. Type

armbianmonitor -u

And you have to update u-boot otherwise your device might not be properly recognised ... or just use latest image. Best to build on your own to mitigate this bug.

Link to comment
Share on other sites

22 hours ago, Igor said:


Strange. It worked for me when I was implementing this feature. My fan spins up and down when script starts ... as designed.

 

Since this feature was just added you might not use correct kernel ... which is why we always asks for logs when asking for any help. Type


armbianmonitor -u

And you have to update u-boot otherwise your device might not be properly recognised ... or just use latest image. Best to build on your own to mitigate this bug.

 

It does spin up and down at boot though :) And the splash screen shows Odroid N2+ I just can't seem to change the value to stick after a reboot. I'm using the latest Focal 5.7 server image. I can't do that bash command as I've specified but I can sudo nano and edit the file to say 40000 and it does stay like that until a reboot. It doesn't seem to apply when I change it though.

 

https://pastebin.com/d6c5eUEB

Link to comment
Share on other sites

Hi, I have N2+ units with the odroid fans installed, but I need help with a script to run these on auto etc.  Currently have the  Armbian 21.08 odroid n2 bullseye OS installed.  A pity Armbian does not have a config setup like Raspi, just go into raspi config, select fan option, set the temps and away you go>>>>>>. ;) , , 

Edited by orion_jg2001
grammar
Link to comment
Share on other sites

I created a script to set the trip point, which can then be run at boot with a service or by placing it in /etc/rc.local

 

# Script
sudo wget https://raw.githubusercontent.com/pyavitz/scripts/master/fan-ctrl -P /usr/local/bin
sudo chmod +x /usr/local/bin/fan-ctrl

# Service
sudo tee /etc/systemd/system/odroid-fan-ctrl.service <<EOF
[Unit]
Description=Odroid Fan Control
ConditionPathExists=/usr/local/bin/fan-ctrl

[Service]
ExecStart=/usr/local/bin/fan-ctrl -r &>/dev/null
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable odroid-fan-ctrl

# Options
Odroid N2 Trip Point
Usage: fan-ctrl -h

   -1       65°C
   -2       55°C
   -3       45°C
   -4       35°C

   -r       Run
   -u       Update
   
The systemd service runs 'fan-ctrl -r' during boot.

 

One down side is that it requires sudo to work, so you would need to either edit the script to your needs or setup sudo, so that you don't need a password to execute. But then again, it shouldn't matter when being run as a service, as root shouldn't care about sudo?

Link to comment
Share on other sites

Wow thanks for this!!!  I am not too bad with SSH etc and sudo works with what I have been doing with my set ups. But when I look at above  hmmmm  I will need some help with getting this set up and where to put things.  You give 2 options of where, as a service or by placing it in /etc/rc.local.  I have got into my rc.local, when trying some scripts to get something working but I have never set up a service.

Link to comment
Share on other sites

2 hours ago, orion_jg2001 said:

Wow thanks for this!!!  I am not too bad with SSH etc and sudo works with what I have been doing with my set ups. But when I look at above  hmmmm  I will need some help with getting this set up and where to put things.  You give 2 options of where, as a service or by placing it in /etc/rc.local.  I have got into my rc.local, when trying some scripts to get something working but I have never set up a service.

 

It's pretty much just a copy and paste job, the above commands do all the work for you. I've personally never used it on Armbian and the only thing I can think of that could create a problem is if the service runs before the armbian-hardware-optimize.service. If that's the case, its an easy enough mod to the odroid-fan-ctrl.service file followed by a daemon-reload.

 

But yeah, using the /etc/rc.local file will accomplish the same thing. You only need to set the trip point once and then have the rc-local service run the script: fan-ctrl -r 

Link to comment
Share on other sites

19 hours ago, Cornelius said:
sudo wget https://raw.githubusercontent.com/pyavitz/scripts/master/fan-ctrl -P /usr/local/bin
sudo chmod +x /usr/local/bin/fan-ctrl

I have run these 2 lines of script..

 

And my rc local looks like this:

 

#!/bin/sh -e
#
# rc.local
#
# 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 enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

[Service]
ExecStart=/usr/local/bin/fan-ctrl -r &>/dev/null
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable odroid-fan-ctrl

# Options
Odroid N2 Trip Point
Usage: fan-ctrl -h

   -1       65°C
   -2       55°C
   -3       45°C
   -4       35°C

   -r       Run
   -u       Update
exit 0
 

Is that how I should have set it up and the options, how do they work and where to you put that in the script, possibly in the sudo systemctl for the fan ??

 

 

 

Link to comment
Share on other sites

3 hours ago, orion_jg2001 said:

I have run these 2 lines of script..

 

And my rc local looks like this:

 

#!/bin/sh -e
#
# rc.local
#
# 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 enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

[Service]
ExecStart=/usr/local/bin/fan-ctrl -r &>/dev/null
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable odroid-fan-ctrl

# Options
Odroid N2 Trip Point
Usage: fan-ctrl -h

   -1       65°C
   -2       55°C
   -3       45°C
   -4       35°C

   -r       Run
   -u       Update
exit 0
 

Is that how I should have set it up and the options, how do they work and where to you put that in the script, possibly in the sudo systemctl for the fan ??

 

 

 

 

Remove all this from /etc/rc.local:

[Service]
ExecStart=/usr/local/bin/fan-ctrl -r &>/dev/null
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable odroid-fan-ctrl

# Options
Odroid N2 Trip Point
Usage: fan-ctrl -h

   -1       65°C
   -2       55°C
   -3       45°C
   -4       35°C

   -r       Run
   -u       Update

 

The script is downloaded already, correct? Set the trip point, for example: fan-ctrl -3

Now have the script run upon boot by adding it to /etc/rc.local.

 

Example:

 

#!/bin/sh -e
#
# rc.local
#
# 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 enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/usr/local/bin/fan-ctrl -r

exit 0

 

That's it! :)

Link to comment
Share on other sites

5 minutes ago, orion_jg2001 said:

How do you set that option fan-ctrl, in your line in the etc/rc.local ie: 

 

/usr/local/bin/fan-ctrl  -3 -r ?

 

In the terminal execute: fan-ctrl -h

This will show you a list of all the options available, which include the trip points you can set. Once you select a trip point the script takes note of the choice you made and runs its self. Your trip point is now set and the fan will spin up at the given temp you chose. So in rc.local from that point on you just need to use the run function: fan-ctrl -r

 

You can look over the script here to see what its actually doing: https://github.com/pyavitz/scripts/blob/master/fan-ctrl

Link to comment
Share on other sites

Ahh got it now.  Saw the function of fan-ctrl -h, didn't then realise that your next line needed to be fan-ctrl 3 or what ever and then see the temp set :)  Thanks working now.  In looking at all the scripts, I see some that can increase the fan at a higher temp say boots up with 55, have you developed something like that as well??

Link to comment
Share on other sites

FYI, I noted when first reboot after setting rc local, it didn't kick in on a stress test.  I had seen in the many posts, someone having problems with their service in the rc local line not working as the re boot was too fast.  A boffin, like yourself, suggested a line sleep 20, first in the rc local field, to "slow" the reboot down, to enable such services to process.  Worked a treat with your script as well :) 

Link to comment
Share on other sites

Hmm trying to install in second unit, getting this error when trying to set the 45c:

 

root@odroidn2:~# fan-ctrl -3
/usr/local/bin/fan-ctrl: line 7: `35000': not a valid identifier
/usr/local/bin/fan-ctrl: line 12: `45000': not a valid identifier
/usr/local/bin/fan-ctrl: line 17: `55000': not a valid identifier
/usr/local/bin/fan-ctrl: line 22: `65000': not a valid identifier
/usr/local/bin/fan-ctrl: line 100: 45000: command not found
 

Link to comment
Share on other sites

1 hour ago, orion_jg2001 said:

Hmm trying to install in second unit, getting this error when trying to set the 45c:

 

root@odroidn2:~# fan-ctrl -3
/usr/local/bin/fan-ctrl: line 7: `35000': not a valid identifier
/usr/local/bin/fan-ctrl: line 12: `45000': not a valid identifier
/usr/local/bin/fan-ctrl: line 17: `55000': not a valid identifier
/usr/local/bin/fan-ctrl: line 22: `65000': not a valid identifier
/usr/local/bin/fan-ctrl: line 100: 45000: command not found
 

 

On the unit make sure what the script is looking for is there `ls /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp`

As far as I know, on Hardkernel, Armbian and my own image that is the only location that the trip point is located?

 

I guess I should add a check in the functions there to give an error, instead of a bash cry?

 

As for the trip points, I didn't develop anything and as far as I know in my testing that can be set to whatever? It doesn't have to be 35000, it could be 20000 if someone so wanted, which would just make the fan run all the time as the board idles higher than that. I place mine at 45000 as it seems like a happy medium when compiling on it.

Link to comment
Share on other sites

Worked it out. The 2nd unit I tried to install is my base ADS-B unit that I have been using as the litmus check, for other programming changes with the ADSB programs I dabble with.  That OS  is debian buster.  I just successfully installed it in the other N2+ unit up in my mast enclosure, which is running Armbian bullseye.  Installed no problems.  So I just have to change over the OS of that other unit.  Actually, it will be a good comparison today to have one running a fan and the other not.  they both just creeped of 45 for an hour or two yesterday, so it will be interesting to see what happens today.  I wont re image the other one until tomorrow, to see how they compare today.

Link to comment
Share on other sites

1 hour ago, orion_jg2001 said:

FYI, I noted when first reboot after setting rc local, it didn't kick in on a stress test.  I had seen in the many posts, someone having problems with their service in the rc local line not working as the re boot was too fast.  A boffin, like yourself, suggested a line sleep 20, first in the rc local field, to "slow" the reboot down, to enable such services to process.  Worked a treat with your script as well :) 

 

I've seen that happen before and has more to do with how people set the systemd services on the OS up more than anything. Most services "if any?" don't account for the rc-local service, so sometimes putting a sleep on your script is the easiest route to take.

 

Happy its working for you.

Link to comment
Share on other sites

 

29.08.2020 в 17:11, Igor сказал:

@Igor And how do I can fix my changes to active trip point (/sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp) not to be overwritten on boot?

 

Sorry for necroposting

Link to comment
Share on other sites

Hello. I have an Odroid N2+ on Kernel 6.1.30 (running Jammy 23.5) and like AreaScout see no trip_point_4_temp under /sys/devices/virtual/thermal/thermal_zone0/, yet the armbian-hardware-optimization still tries to test the fan using that file,https://github.com/armbian/build/blob/master/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization#L112-L117.

 

Is this an error? Or should I be controlling the fan some other way?

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines