This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I2C service not running ...Work Around
#31
FInally , after many trials and errors with Chat GPT ( Tried Perplexity and found it useless at least for this issue), this is a resume of steps taken, I hope they are valid to others  as I can't replicate by myself all the things we ( GPT and me) did with success until get the service working again.

None of the solutions in this thread worked for me; I also have Maiana running and it was a fresh install, so no idea why this happens; what it's true is that now works and survives restarts:

What we did + copy/paste steps:

Context: 

On RPi5/OpenPlotter, openplotter-i2c-read.service was failing because Adafruit Blinka was importing "lgpio" , but the system only had the compiled "_lgpio" module. We installed the proper lgpio Python wrapper (with the API Blinka expects) and then adjusted the systemd service to run in a writable runtime directory so lgpioncan create its notify files. After that, the service stayed running and survived reboot.

0) Check the error (optional)

Code:
sudo systemctl status openplotter-i2c-read.service --no-pager -l
journalctl -u openplotter-i2c-read.service -n 80 --no-pager

1) Confirm what’s installed (you’ll usually see only _lgpio )

Code:
python3 -c "import pkgutil; print([m.name for m in pkgutil.iter_modules() if 'lgpio' in m.name])"
python3 -c "import _lgpio; print(_lgpio.__file__)"

2) Install the PyPI  lgpio wrapper system-wide (this is the key step) This forces installing the wrapper into /usr/local/... even if Debian says “already installed”.

Code:
sudo apt install -y python3-pip
sudo python3 -m pip install --break-system-packages --upgrade --ignore-installed lgpio

3) Verify 

Code:
lgpio
imports and exposes the API Blinka needs
Run from a writable directory (important):
Code:
cd /tmp
python3 -c "import lgpio; print(lgpio.__file__); print('gpiochip_open?', hasattr(lgpio,'gpiochip_open'))"
Expected:
Code:
gpiochip_open? True

4) Fix systemd service working directory (so lgpio can create its notify files) 

Edit the service:

Code:
sudo nano /etc/systemd/system/openplotter-i2c-read.service

Use this [Service] block (adjust only if your system differs):

Code:
[Service]

Environment=OPrescue=0
WorkingDirectory=/run/openplotter-i2c
RuntimeDirectory=openplotter-i2c
RuntimeDirectoryMode=0700
EnvironmentFile=/boot/firmware/config.txt
ExecStart=/usr/bin/openplotter-i2c-read $OPrescue
User=pi
Restart=always
RestartSec=3

Reload + restart:

Code:
sudo systemctl daemon-reload
sudo systemctl restart openplotter-i2c-read.service

5) Confirm it’s stable (and survives reboot)

Code:
sudo systemctl status openplotter-i2c-read.service --no-pager -l
systemctl show -p NRestarts --value openplotter-i2c-read.service
Expected: Active: active (running)
and NRestarts=0

Reboot test:

Code:
sudo reboot

After reboot:

Code:
sudo systemctl status openplotter-i2c-read.service --no-pager -l



Hope it helps someone... (desperate as I was)  Smile

Have a good weekend!
Reply


Messages In This Thread
RE: I2C service not running ...Work Around - by aitonos - 2026-01-09, 09:57 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)