What file and line # did you make the adjustment?
libgpiod_pin_1_x.py?
and what did it look like before you made the changes?
for the first recommendation.
What file and line # did you make the adjustment?
libgpiod_pin_1_x.py?
and what did it look like before you made the changes?
for the first recommendation.
Sorry i need a bit more help to understand…
for the second set of changes you recommend. For this line you showed 4?
Below is directly from my machine. and 0 is already there on my config.
self._chip = gpiod.Chip(str(pin_id[0]), gpiod.Chip.OPEN_BY_NUMBER)
and in misc.pi, i currently show this:
chip = gpiod.Chip(str(CHIP_NAME))
so you are overriding the variable all together? yes? and did read like this prior to the change?
and this what journactl shows for me:
: TTY=pts/0 ; PWD=/usr/bin/rockpi-penta ; USER=root ; COMMAND=/usr/bin/systemctl restart rockpi-penta.service
Sep 11 21:09:57 zomv sudo[3418101]: pam_unix(sudo:session): session opened for user root(uid=0) by pi(uid=1000)
Sep 11 21:09:57 zomv systemd[1]: Started rockpi-penta.service - Rockpi SATA Hat.
Sep 11 21:09:57 zomv sudo[3418101]: pam_unix(sudo:session): session closed for user root
Sep 11 21:09:57 zomv python3[3418105]: Traceback (most recent call last):
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/bin/rockpi-penta/main.py”, line 10, in
Sep 11 21:09:57 zomv python3[3418105]: import oled
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/bin/rockpi-penta/oled.py”, line 5, in
Sep 11 21:09:57 zomv python3[3418105]: import adafruit_ssd1306
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/local/lib/python3.11/dist-packages/adafruit_ssd1306.py”, line 17, in
Sep 11 21:09:57 zomv python3[3418105]: from adafruit_bus_device import i2c_device, spi_device
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/local/lib/python3.11/dist-packages/adafruit_bus_device/spi_device.py”, line 20, in
Sep 11 21:09:57 zomv python3[3418105]: from digitalio import DigitalInOut
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/local/lib/python3.11/dist-packages/digitalio.py”, line 27, in
Sep 11 21:09:57 zomv python3[3418105]: from adafruit_blinka.microcontroller.bcm2712.pin import *
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/local/lib/python3.11/dist-packages/adafruit_blinka/microcontroller/bcm2712/pin.py”, line 8, in
Sep 11 21:09:57 zomv python3[3418105]: D0 = Pin((4, 0))
Sep 11 21:09:57 zomv python3[3418105]: ^^^^^^^^^^^
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/local/lib/python3.11/dist-packages/adafruit_blinka/microcontroller/generic_linux/libgpiod/libgpiod_pin_1_x.py”, line 30, in init
Sep 11 21:09:57 zomv python3[3418105]: self._chip = gpiod.Chip(str(pin_id[0]), gpiod.Chip.OPEN_BY_NUMBER)
Sep 11 21:09:57 zomv python3[3418105]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 11 21:09:57 zomv python3[3418105]: FileNotFoundError: [Errno 2] No such file or directory
Sep 11 21:09:57 zomv python3[3418105]: Exception in thread Thread-1 (running):
Sep 11 21:09:57 zomv python3[3418105]: Traceback (most recent call last):
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/lib/python3.11/threading.py”, line 1038, in _bootstrap_inner
Sep 11 21:09:57 zomv python3[3418105]: self.run()
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/lib/python3.11/threading.py”, line 975, in run
Sep 11 21:09:57 zomv python3[3418105]: self._target(*self._args, **self._kwargs)
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/bin/rockpi-penta/fan.py”, line 101, in running
Sep 11 21:09:57 zomv python3[3418105]: pin = Gpio(0.025)
Sep 11 21:09:57 zomv python3[3418105]: ^^^^^^^^^^^
Sep 11 21:09:57 zomv python3[3418105]: File “/usr/bin/rockpi-penta/fan.py”, line 58, in init
Sep 11 21:09:57 zomv python3[3418105]: self.line = gpiod.Chip(os.environ[‘FAN_CHIP’]).get_line(int(os.environ[‘FAN_LINE’]))
Sep 11 21:09:57 zomv python3[3418105]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The errors i am getting quite different. i also, did take another SD card, perform a fresh install of bookworm, and tried to load everything. still did not work. So i have switched back to my original to resolve.
I use the latest system.
cat /proc/version
Linux version 6.6.31+rpt-rpi-2712 (serge@raspberrypi.com) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29)
But it works.
Can you tell me the version of your system.
By the way you can change the file in /etc/rockpi-penta.env.
I’m using DietPi 9.6.1.
Linux version 6.6.47+rpt-rpi-2712 (serge@raspberrypi.com) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT Debian 1:6.6.47-1+rpt1 (2024-09-02)
I tried changing the rpi5.env and rockpi-penta.env with effect on fan, but no effect on OLED and key.
Disclaimer: This demonstrates only a temporary workaround.
Taking the journalctl of post above, it points to two failures.
The trace is going down from main.py to oled.py to … to libgpiod_pin_1_x.py
and indicates the file and with ^^^ the line which failed.
self._chip = gpiod.Chip('0', gpiod.Chip.OPEN_BY_NUMBER)
For the second failure (the one from thread start)
self.line = gpiod.Chip('0').get_line(int(os.environ['FAN_LINE']))
Likely there is as a third one to solve
Can be workaround with
/usr/bin/rockpi-penta/misc.py, line 110
chip = gpiod.Chip('0')
Everything you do - you do so at your own risk
Run sudo apt update
and sudo apt full-upgrade
will fix this error.
You need to restart after the update, remember to save and back up your important data.
Thank you for pointing to the interesting thread.
The OLED issue remains after upgrade and even with envs on 0 or on 4.
Sep 13 08:54:50 pi5 python3[387]: File "/usr/local/lib/python3.11/dist-packages/adafruit_blinka/microcontroller/generic_linux/libgpiod/libgpiod_pin_1_x.py", line 30, in __init__ Sep 13 08:54:50 pi5 python3[387]: self._chip = gpiod.Chip(str(pin_id[0]), gpiod.Chip.OPEN_BY_NUMBER)
rpi@raspberrypi:~ $ ls -l /dev/gpiochip*
crw-rw----+ 1 root gpio 254, 0 Sep 13 04:33 /dev/gpiochip0
crw-rw----+ 1 root gpio 254, 10 Sep 13 04:33 /dev/gpiochip10
crw-rw----+ 1 root gpio 254, 11 Sep 13 04:33 /dev/gpiochip11
crw-rw----+ 1 root gpio 254, 12 Sep 13 04:33 /dev/gpiochip12
crw-rw----+ 1 root gpio 254, 13 Sep 13 04:33 /dev/gpiochip13
lrwxrwxrwx 1 root root 9 Sep 13 04:33 /dev/gpiochip4 -> gpiochip0
rpi@raspberrypi:~ $ sudo journalctl -u rockpi-penta
Sep 13 04:36:08 raspberrypi systemd[1]: Started rockpi-penta.service - Rockpi SATA Hat.
-- Boot f430a839bc5d4fbc9f90dabba851f8f2 --
Sep 13 04:53:30 raspberrypi systemd[1]: Started rockpi-penta.service - Rockpi SATA Hat.
rpi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.6.47+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.47-1+rpt1 (2024-09-02) aarch64 GNU/Linux
It works on my side. Have you modified anything?
crw-rw---- 1 root gpio 254, 0 Sep 13 09:08 /dev/gpiochip0
crw-rw---- 1 root gpio 254, 10 Sep 13 09:08 /dev/gpiochip10
crw-rw---- 1 root gpio 254, 11 Sep 13 09:08 /dev/gpiochip11
crw-rw---- 1 root gpio 254, 12 Sep 13 09:08 /dev/gpiochip12
crw-rw---- 1 root gpio 254, 13 Sep 13 09:08 /dev/gpiochip13
pi@pi5:~$ sudo journalctl -u rockpi-penta
Sep 13 09:32:06 pi5 systemd[1]: Started rockpi-penta.service - Rockpi SATA Hat.
Sep 13 09:32:06 pi5 python3[2328]: Traceback (most recent call last):
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/bin/rockpi-penta/main.py", line 10, in <module>
Sep 13 09:32:06 pi5 python3[2328]: import oled
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/bin/rockpi-penta/oled.py", line 5, in <module>
Sep 13 09:32:06 pi5 python3[2328]: import adafruit_ssd1306
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/local/lib/python3.11/dist-packages/adafruit_ssd1306.py", line 17, in <module>
Sep 13 09:32:06 pi5 python3[2328]: from adafruit_bus_device import i2c_device, spi_device
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/local/lib/python3.11/dist-packages/adafruit_bus_device/spi_device.py", line 20, in <module>
Sep 13 09:32:06 pi5 python3[2328]: from digitalio import DigitalInOut
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/local/lib/python3.11/dist-packages/digitalio.py", line 27, in <module>
Sep 13 09:32:06 pi5 python3[2328]: from adafruit_blinka.microcontroller.bcm2712.pin import *
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/local/lib/python3.11/dist-packages/adafruit_blinka/microcontroller/bcm2712/pin.py", line 8, in <module>
Sep 13 09:32:06 pi5 python3[2328]: D0 = Pin((4, 0))
Sep 13 09:32:06 pi5 python3[2328]: ^^^^^^^^^^^
Sep 13 09:32:06 pi5 python3[2328]: File "/usr/local/lib/python3.11/dist-packages/adafruit_blinka/microcontroller/generic_linux/libgpiod/libgpiod_pin_1_x.py", line 30, in __init__
Sep 13 09:32:06 pi5 python3[2328]: self._chip = gpiod.Chip(str(pin_id[0]), gpiod.Chip.OPEN_BY_NUMBER)
Sep 13 09:32:06 pi5 python3[2328]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 13 09:32:06 pi5 python3[2328]: FileNotFoundError: [Errno 2] No such file or directory
pi@pi5:~$ uname -a
Linux pi5 6.6.47+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.47-1+rpt1 (2024-09-02) aarch64 GNU/Linux
To me it seems at least the expected link to gpiochip0 is missing.
My recent base is DietPi 9.6.1, no modifications.
I noticed during “apt install -y ./rockpi-penta-0.2.2.deb” some messages looking quite similiar to the ones I recorded before on a non DietPi full Debian installion attempt
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager.
It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Created symlink /etc/systemd/system/multi-user.target.wants/rockpi-penta.service → /lib/systemd/system/rockpi-penta.service.
N: Download is performed unsandboxed as root as file '/home/pi/rockpi-penta-v0.2.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
You might create a symlink yourself, or wait for DietPi to update.
rpi@raspberrypi:~ $ sudo ln -s /dev/gpiochip0 /dev/gpiochip4
rpi@raspberrypi:~ $ sudo systemctl restart rockpi-penta.service
Thanks again.
With symlink created no more workarouds needed.
But after reboot the symlink is lost, how to make it persitent?
Here is a temporary solution
sudo sed -i "2iimport os\ntry: os.symlink(\"/dev/gpiochip0\", \"/dev/gpiochip4\")\nexcept FileExistsError: pass" /usr/bin/rockpi-penta/main.py
Add a symlink when the program starts.
I’m sure DietPi will be updated soon. You may need to reinstall or delete these lines.
I am using
Linux version 6.6.47-v8-16k+ (dom@buildbot) (aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1794 SMP PREEMPT Thu Aug 29 16:30:28 BST 2024
i think cat /etc/os-release might show more correctly
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
Quick update. full-upgrade fixed it. working now.
It looks like they fixed it in wiring-pi about 4 days ago.
Apparently i just needed to wait… lol.
Thank you.
Hello, Im running Rpi5 with Ubuntu V25 and I have similar issue. Fan goes 100% evena fter the shutdown command, I have no OLED whatsoever.
However Im at the very beginning of Linux journey, so I will need more simplified help.
I did all upgrade, no updates available at the moment
sudo systemctl status rockpi-penta.service
○ rockpi-penta.service - Rockpi SATA Hat
Loaded: loaded (/usr/lib/systemd/system/rockpi-penta.service; enabled; preset: enabled)
Active: inactive (dead) since Wed 2025-06-04 00:01:37 CEST; 8min ago
Duration: 1.003s
Invocation: f11092d7840d43a4a1a31edc385ba14c
Main PID: 1546 (code=exited, status=0/SUCCESS)
CPU: 251msJun 04 00:01:37 pi python3[1546]: File “/usr/bin/rockpi-penta/fan.py”, line 101, in running
Jun 04 00:01:37 pi python3[1546]: pin = Gpio(0.025)
Jun 04 00:01:37 pi python3[1546]: File “/usr/bin/rockpi-penta/fan.py”, line 58, in init
Jun 04 00:01:37 pi python3[1546]: self.line = gpiod.Chip(os.environ[‘FAN_CHIP’]).get_line(int(os.environ[‘FAN_LINE’>
Jun 04 00:01:37 pi python3[1546]: ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
Jun 04 00:01:37 pi python3[1546]: File “/usr/lib/python3/dist-packages/gpiod/chip.py”, line 58, in init
Jun 04 00:01:37 pi python3[1546]: self._chip = _ext.Chip(path)
Jun 04 00:01:37 pi python3[1546]: ~~~~~~~~~^^^^^^
Jun 04 00:01:37 pi python3[1546]: FileNotFoundError: [Errno 2] No such file or directory
Jun 04 00:01:37 pi systemd[1]: rockpi-penta.service: Deactivated successfully.
For instance. “/usr/bin/rockpi-penta/fan.py”, line 58, is in my case
self.line = gpiod.Chip(os.environ[‘FAN_CHIP’]).get_line(int(os.environ[‘FAN_LINE’]))
Did I get it right that I need to replace the line with line
self.line = gpiod.Chip(‘0’).get_line(int(os.environ[‘FAN_LINE’]))
If yes, then how? sudo nano?
what about the other errors. like row 58 in Chip.py. how this should be fixed? in a same manner and fan.py?
And the last bit, Im bit confused about what the first error means on line 101. It says running, so is it an error?
thank you and your help will be much appreciated.
There is no way to control what happens after the shutdown, depending on the default configuration of the soc.
It seems that ubuntu does not have a software connection from /dev/gpiochip0 to /dev/gpiochip4 configured, which may cause problems. It is recommended to use the official Raspberry PI system.
I was trying to work on it and maybe I, or more precisely, ChatGPT is up to something.
this is pure speculation, as I dont know python at all, so please do take it with shovel of salt
Maybe it is because the program is written for gpiod library v1.x, but I have the the latest version 2.x. Chatgpt claims that the API changed and thus gpiod library doesn know how to handle get line.
Can someone who actually knows python confirm this?
If proven correct, options are to rewrite whole code for the new API, or use python’s virtual environment and downgrade that library to 1.x
You’re right. I did encounter this problem during the process of using the latest ubuntu, and downgrade gpiod is a very difficult thing. It requires the python version to be less than 3.12. Even the third-party library Adafruit we use has this problem. So this problem is difficult to solve in a short time. You can only roll back to a lower version of ubuntu.
We have already planned to refactor the entire program, but this cannot be accomplished in a short period of time.
Thank you Shawn for reply. It isn’t a reply I was hoping for, but it is what it is. I’ll disconnect the board for now and wait for an update.
Out of curiosity, could a community assist somehow with refactoring the app and thus help to expedite the update?