# Bug GPIO balenaOS 6.5.1+rev2

**URL:** <https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934>\
**Category:** Product support\
**Created:** [March 27, 2025, 10:31am UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934 "2025-03-27T10:31:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Firat](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/firat/32/8850_2.png) [@Firat](https://forums.balena.io/u/Firat)\
**Post date:** [March 27, 2025, 10:31am UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/1 "2025-03-27T10:31:21Z")

</div>

Hello,

I’m working on raspberry pi4 pinned on balenaOS 6.5.1+rev2  
I’m experiencing a potential issue with BalenaOS 6.5.1+rev2.  
When I upgrade to this version and include the following configuration parameters:

```auto
"18=op,dh"

"sc16is752-i2c,int_pin=17,addr=0x4d,xtal=1843200"

```

I’m unable to instantiate the SC16IS752 UART. In previous versions, this configuration worked as expected, and I could access **ttySC0** and **ttySC1**. However, with version **6.5.1+rev2** , no UART devices appear.

Is this related to a GPIO handling bug introduced in this release?  
It would also be very appreciated to add a feature to go back to the OS versions, especially in the event of a problem 🙂

BR  
Firat

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [March 27, 2025, 4:33pm UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/2 "2025-03-27T16:33:33Z")

</div>

Hello @Firat thanks for your message!

We are working actively to fix this. Looks like it’s related with this [Github Issue](https://github.com/raspberrypi/linux/issues/6037). Looks like the `gpio` it’s deprecated. You can read more [here](https://www.thegoodpenguin.co.uk/blog/stop-using-sys-class-gpio-its-deprecated/).

We will keep you posted, however let us know if you can fix this yourself as well!

---

<div class="post-metadata">

**Author:** ![yardstick1](https://avatars.discourse-cdn.com/v4/letter/y/e9a140/32.png) [@yardstick1](https://forums.balena.io/u/yardstick1)\
**Post date:** [March 27, 2025, 9:40pm UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/3 "2025-03-27T21:40:11Z")

</div>

@mpous can you clarify where this would have been introduced? I’m also seeing this issue starting in version 6.5.x. The affected section of code was working fine in v6.4.1 rev 1.  
The GitHub issue you linked is from a while ago, not clear why it would affect only new versions of Balena OS (and it’s not clear from the [changelog](https://github.com/balena-os/meta-balena/blob/master/CHANGELOG.md))?

I’m using gpiozero and RPi.GPIO

Like in the GitHub issue, my code also now crashes with:

```auto
 my-service File "/usr/local/lib/python3.9/site-packages/gpiozero/pins/pi.py", line 319, in _set_when_changed
 my-service self._enable_event_detect()
 my-service File "/usr/local/lib/python3.9/site-packages/gpiozero/pins/rpigpio.py", line 226, in _enable_event_detect
 my-service GPIO.add_event_detect(
 my-service RuntimeError: Failed to add edge detection

```

---

<div class="post-metadata">

**Author:** ![Firat](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/firat/32/8850_2.png) [@Firat](https://forums.balena.io/u/Firat)\
**Post date:** [March 28, 2025, 9:22am UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/4 "2025-03-28T09:22:01Z")

</div>

@mpous ,

What would be greatly appreciated from Balena would be the ability to roll back to a previous version of BalenaOS  
A very concrete example:  
After updating several machines to version 6.5, we are currently experiencing several issues in the GPIO system

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [March 31, 2025, 2:07pm UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/5 "2025-03-31T14:07:21Z")

</div>

@Firat @yardstick1 thanks for your messages!

Due to changes with the new Raspberry Pi OS, the RPi.GPIO library commonly used has been deprecated, so it is not compatible with the newer OS versions.

Check out [Raspberry Pi’s History of GPIO usage document](https://d2p0zs04.na1.hubspotlinksstarter.com/Ctc/5G+113/d2P0Zs04/VVzTqj1C2cLXW4hZlKC7h_5TTW3V7XmG5tGpzYN9h9bHq5kBVqW6N1X8z6lZ3q6W1MyFRY8N7zs1W71PQzZ13LBcpW1jY0vY3V9Z6vW49PpbC4JY2Y-W87DVJj5M1tL7W1RxlC55dMPVsW3v3Kzz3Xc4j7W3_Jyr61HT31dW1txPlw8sm8ggN1MgR-BpbKXkW1MyxSp6vqPQpW1D1dvW1q-TKqW6dQ8s17-KlK5W5mZZmm3x5tfRW5hNrCl2mBvxhW4cLcmR3xrXW8W3bB4g596dtyyW8BgVmW776psnW9kG1Rc6b2PrGW70mY_g6sFZ2yW857CSs3kBdy9W5nMVDM4NDbDYN21lmFkYxQYwW5YGM-N3JPBqnW6vYXlF2D246vN99nq1ynGhsyW38h8lR5sV_HTW2zgPrb7ZQ_CwW6dGVRb940By_W5k9mJ22Lg_dZW57l7DX488mzMW1MWXkC3dvfWcW3rhxx83FV2VBW1S7l0N7W_lDWW8906V024kQCRW7bNBNm2nNVz0W5G10mN20XshRW63Jjrx4Q4fJxf7f81RH04) (PDF) for tips on GPIO libraries compatible with the Raspberry Pi including libgpiod.

Is it possible to change the GPIO library from your projects?

---

<div class="post-metadata">

**Author:** ![Firat](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/firat/32/8850_2.png) [@Firat](https://forums.balena.io/u/Firat)\
**Post date:** [April 1, 2025, 10:20pm UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/6 "2025-04-01T22:20:05Z")

</div>

@mpous,  
Thanks for your reply.  
In our case, we want to pull up a GPIO at boot, not after in some sevice  
What solutions do you suggest?

---

<div class="post-metadata">

**Author:** ![moodgorning](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@moodgorning](https://forums.balena.io/u/moodgorning)\
**Post date:** [April 5, 2025, 10:21am UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/7 "2025-04-05T10:21:18Z")

</div>

We are facing issues with this as well, it would be really great if we could have a downgrade option for OS… Has anyone found a way to work around it?  
in our case this command is throwing an error:  
echo 7 \> /sys/class/gpio/export  
This prevents us from resetting our lora concentrator on startup at the moment.  
libgpiod doesn’t seem to be available either since gpiodetect is not available. Or do we have to install this ourselves in the container?

---

<div class="post-metadata">

**Author:** ![HakanL](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/hakanl/32/3674_2.png) [@HakanL](https://forums.balena.io/u/HakanL)\
**Post date:** [April 9, 2025, 12:32am UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/8 "2025-04-09T00:32:12Z")

</div>

The only way I’ve managed to “downgrade” is to switch to the previous boot partition by updating the file `/mnt/boot/resinOS_uEnv.txt` and changing `resin_root_part=2` to `resin_root_part=3` (or vice versa depending on which was the last working partition).

---

<div class="post-metadata">

**Author:** ![Firat](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/firat/32/8850_2.png) [@Firat](https://forums.balena.io/u/Firat)\
**Post date:** [March 13, 2026, 5:11pm UTC](https://forums.balena.io/t/bug-gpio-balenaos-6-5-1-rev2/373934/9 "2026-03-13T17:11:30Z")

</div>

**Update: Root cause found and workaround confirmed**

After extensive debugging, we’ve identified the root cause of the SC16IS752 (`/dev/ttySC*`) devices disappearing on newer balenaOS versions (kernel 6.x+).

**Root cause:**

Starting with Linux kernel ~6.8+, the `sc16is7xx` driver was **split into three separate kernel modules** :

| Module | Role |
| --- | --- |
| `sc16is7xx.ko` | Core driver (serial logic) |
| `sc16is7xx_i2c.ko` | I2C bus registration |
| `sc16is7xx_spi.ko` | SPI bus registration |

On older kernels (5.15 in balenaOS 6.1.24), the single `sc16is7xx.ko` module handled everything. On kernel 6.12 (balenaOS 6.10.24), the DT overlay `sc16is752-i2c` correctly loads `sc16is7xx.ko` via modalias matching, but **does not trigger loading of `sc16is7xx_i2c.ko`** , which is the module that actually registers the I2C driver.

The result: the device tree node is correctly populated (`/proc/device-tree/soc/i2c@7e804000/sc16is752@4d` exists), the I2C device is detected in sysfs (`/sys/bus/i2c/devices/1-004d` exists), the core module is loaded (`lsmod | grep sc16is` shows `sc16is7xx`), but **no I2C driver is registered** (`/sys/bus/i2c/drivers/sc16is7xx/` does not exist), so the device never gets probed and `/dev/ttySC*` never appears.

**Workaround:**

```bash
modprobe sc16is7xx_i2c

```

This immediately creates `/dev/ttySC0` and `/dev/ttySC1`. Confirmed on a Raspberry Pi 4 running balenaOS 6.10.24 (kernel 6.12.61-v8).

However this is volatile and lost on reboot. We’re currently looking for a way to make this persistent.

**Suggested fix for balenaOS:**

The `sc16is7xx_i2c.ko` (and `sc16is7xx_spi.ko`) modules should have proper `modules.dep` entries so that `modprobe sc16is7xx` automatically pulls in the bus-specific sub-modules, or the DT overlay modalias resolution should trigger loading of the correct sub-module. This seems like a module dependency / `depmod` issue that should be addressed at the OS level.

**Diagnostic comparison (same fleet, same DT overlay config):**

| | balenaOS 6.1.24 (works) | balenaOS 6.10.24 (broken) |
| --- | --- | --- |
| Kernel | 5.15.92-v8 | 6.12.61-v8 |
| `sc16is7xx.ko` | single module, registers I2C driver | core only, no bus registration |
| `sc16is7xx_i2c.ko` | does not exist | exists but not auto-loaded |
| `/dev/ttySC*` | present | missing |
| After `modprobe sc16is7xx_i2c` | n/a | **fixed** |

Could the balena team look into ensuring proper module dependency resolution for split kernel drivers in newer OS versions?

BR,

Firat.
