Problems with SATA-HAT, RPi 4 and rockpi-quad.service

Hi,

after a long period of use I have reinstalled my SATA-hat Quad RPi4, because the Raspberry Pi OS was outdated and OMV was still version 5.
So I installed Raspberry Pi OS Lite 64bit and installed the script rockpi-quad.deb from this page.
(https://wiki.radxa.com/Dual_Quad_SATA_HAT)

So far everything works fine, except for a few ambiguities on my part.
Could it be that the service rockpi-sata is now called rockpi-quad?
The configuration seems to take place under /etc/rockpi-quad.conf.
Unfortunately, this does not seem to have any real effect, because the fan runs as if under full load and the OLED display cannot be rotated by 180°.
When I call “systemctl status rockpi-quad” in the console, the following message appears:

lippi@rpi-nas:~ $ sudo systemctl status rockpi-quad
● rockpi-quad.service - Rockpi SATA Hat
Loaded: loaded (/lib/systemd/system/rockpi-quad.service; enabled; preset: enabled)
Active: active (running) since Fri 2024-11-01 14:24:22 CET; 14min ago
Main PID: 311995 (python3)
Tasks: 5 (limit: 4510)
CPU: 5.043s
CGroup: /system.slice/rockpi-quad.service
└─311995 /usr/bin/python3 /usr/bin/rockpi-quad/main.py

Nov 01 14:24:23 rpi-nas python3[311995]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 01 14:24:23 rpi-nas python3[311995]: File “/usr/lib/python3.11/configparser.py”, line 1168, in _unify_values
Nov 01 14:24:23 rpi-nas python3[311995]: raise NoSectionError(section) from None
Nov 01 14:24:23 rpi-nas python3[311995]: configparser.NoSectionError: No section: ‘fan’
Nov 01 14:24:23 rpi-nas python3[311995]: OSError: [Errno 16] Device or resource busy
Nov 01 14:24:23 rpi-nas python3[311995]: During handling of the above exception, another exception occurred:
Nov 01 14:24:23 rpi-nas python3[311995]: Traceback (most recent call last):
Nov 01 14:24:23 rpi-nas python3[311995]: File “/usr/bin/rockpi-quad/fan.py”, line 25, in init
Nov 01 14:24:23 rpi-nas python3[311995]: with open(f"/sys/class/pwm/{chip}/export", ‘w’) as f:
Nov 01 14:24:23 rpi-nas python3[311995]: OSError: [Errno 16] Device or resource busy

Unfortunately, the error analysis here is beyond my knowledge.
Does anyone have any ideas or tips?
Oh yes, OMV 7 still works perfectly.

Best regard, Falconcrest

in /usr/bin/rockpi-quad/misc.py, which file is stated to parse in cfg.read(’ ')?
does the content of the conf file look OK? for me it seems the content is broken, maybe by a special character unintentionally inserted

Thanks for the reply, this has prompted me to do a little more research here in the forum.
I came across a post where similar behavior was described.
I then looked at misc.py and noticed that cfg.read referred to a file /etc/rockpi-penta.conf…
However, this does not exist, but the rockpi-quad.conf.
I changed this entry, restarted rockpi-quad and lo and behold, the service runs without errors.
Almost!
As soon as I change the information for the fan in rockpi-quad.conf and restart the service, the status query returns error messages that I cannot interpret.
I will provide the output and a little more detail later.
Any problems with the fan.py are output.
As already described, OMV 7 runs without errors.

please give it a try

No updates were necessary when running apt update and apt full-upgrade, the display was 0.

If I do not change anything in the [Fan] section of rockpi-quad.conf, I get the output:

root@rpi-nas:/etc# systemctl status rockpi-quad
● rockpi-quad.service - Rockpi SATA Hat Loaded: loaded (/lib/systemd/system/rockpi-quad.service; enabled; prese> Active: active (running) since Sat 2024-11-02 12:50:46 CET; 1 day 10h a> Main PID: 665 (python3)
Tasks: 5 (limit: 4510)
CPU: 20min 44.231s
CGroup: /system.slice/rockpi-quad.service
└─665 /usr/bin/python3 /usr/bin/rockpi-quad/main.py

Nov 02 12:50:46 rpi-nas systemd[1]: Started rockpi-quad.service - Rockpi SAT>lines 1-10/10 (END)

If I now change the entries under [Fan]
lv0=35 to lv0=40
lv1=40 to lv1=45
lv2=45 to lv2=50
lv3=50 to lv3=55

then I get after
systemctl restart rockpi-quad
with
systemctl status rockpi-quad
I get the following output:

root@rpi-nas:/etc# systemctl restart rockpi-quad
root@rpi-nas:/etc# systemctl status rockpi-quad
● rockpi-quad.service - Rockpi SATA Hat
Loaded: loaded (/lib/systemd/system/rockpi-quad.service; enabled; prese> Active: active (running) since Sun 2024-11-03 23:58:08 CET; 20s ago
Main PID: 599342 (python3)
Tasks: 5 (limit: 4510)
CPU: 509ms
CGroup: /system.slice/rockpi-quad.service
└─599342 /usr/bin/python3 /usr/bin/rockpi-quad/main.py

Nov 03 23:58:08 rpi-nas systemd[1]: Started rockpi-quad.service - Rockpi SAT>Nov 03 23:58:09 rpi-nas python3[599342]: OSError: [Errno 16] Device or resou>Nov 03 23:58:09 rpi-nas python3[599342]: During handling of the above except>Nov 03 23:58:09 rpi-nas python3[599342]: Traceback (most recent call last):
Nov 03 23:58:09 rpi-nas python3[599342]: File “/usr/bin/rockpi-quad/fan.py>Nov 03 23:58:09 rpi-nas python3[599342]: with open(f”/sys/class/pwm/{chi>Nov 03 23:58:09 rpi-nas python3[599342]: OSError: [Errno 16] Device or resou>lines 1-16/16 (END)

There is something wrong with fan.py.
Unfortunately, I don’t have the knowledge to solve the problem.
What other information can I provide that might be useful to solve the problem?

Even if the output of systemctl status rockpi-quad seems to be OK with the “original” setting in the [Fan] section, I still think that the fan is running at full load.
It’s like jinxed…

I would like to emphasize once again that I am using an RPi 4 and a Quad NAS, not a Penta NAS.

Thanks

This seems to be a hardware issue, rpi4 uses pwm, the error is probably the system can not use pwm, you can try to reinstall rockpi-quad*.deb, if you can please reinstall a clean Raspberry PI system.

Do you think it’s a hardware problem?
The “old” installation with Buster and OMV 5 ran for about 3 years without any problems.
I only had to change a fan once.
I have already installed rockpi-quad.deb (v0. 3.1) several times.
I have to say that the end of the installation is a bit unusual… I will run it again and post the output.

I guess that it is a software issue, but just to ensure that it is not hardware specific just restore for test purpose a backup of the so far running setup and see your system running

regarding the software issue, I could imagine tha some of the modifications for penta hat found their way in the quad setup, but on Pi5 the PWM differs from the Pi4 ones

just a guess - maybe you could use the *.py from the backup in your new system

Well, no backup - no pity! :frowning:

As the “old” system was so old, I didn’t see the need for a backup, as I had completely reinstalled it anyway.

I share your suspicion that the entries in the Penta setup may not match, as this has already been partially confirmed.
I read here in the forum that a user found out that an incorrect file was referenced in misc.py.
I have already done this, as explained above, and experienced an “improvement” in the rockpi-quad.service.
Unfortunately, the problem with fan.py still exists.

If someone still has the old rockpi-sata script and the rockpi-sata.conf, it might be possible to compare this with the new rockpi-quad.conf.

I see that the error is that the pwm device cannot be opened. It does not mean that your device is faulty. It means that your modification of rockpi-quad.conf may not work.

Can you provide me with more detailed errors?

Thanks for the reply, but I think I’ve found the error!

It was a chance find as I don’t really have a good overview of Linux.
Sometimes “laymen” are a bit unpragmatic.:rofl:

I tried to manually copy the “old” service rockpi-sata with all the necessary files and the service seemed to work, but the OLED remained dark.

Now I happened to see that the rockpi-quad service was running as 1001/127, which surprised me, as all other services were running as root/root.
Now I simply set rockpi-quad.service, rockpi-quad.conf and rockpi-quad.env to root/root and what can I say, everything works perfectly.

Could this be an error in the rockpi-quad.deb script or did something go wrong with my installation?

Can you tell me what system your Raspberry Pi 4 is using? This problem shouldn’t occur normally.

It is the normal current Raspberry Pi OS Lite 64-bit version.

Linux rpi-nas 6.6.59-v8+ #1810 SMP PREEMPT Fri Nov 1 13:12:57 GMT 2024 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Nov 5 18:38:18 2024 from 10.0.0.73
lippi@rpi-nas:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
lippi@rpi-nas:~ $ uname -a
Linux rpi-nas 6.6.59-v8+ #1810 SMP PREEMPT Fri Nov 1 13:12:57 GMT 2024 aarch64 GNU/Linux
lippi@rpi-nas:~ $ cat /etc/os-release
PRETTY_NAME=“Debian GNU/Linux 12 (bookworm)”
NAME=“Debian GNU/Linux”
VERSION_ID=“12”
VERSION=“12 (bookworm)”
VERSION_CODENAME=bookworm
ID=debian
HOME_URL=“https://www.debian.org/
SUPPORT_URL=“https://www.debian.org/support
BUG_REPORT_URL=“https://bugs.debian.org/

I actually wanted to use my favorite OS “DietPi” as usual, but somehow that didn’t work out.

Thank you very much, we will verify your problem and try to support DiePi, looking forward to our good news.

Please do not forget to correct the incorrect entry in misc.py in the installation package rockpi-quad.deb.

cfg.read(’/etc/rockpi-penta.conf’)
to
cfg.read(’/etc/rockpi-quad.conf’)

Many thanks for the support!