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
#32
Aitonos,
Many thanks for the reply.......I've followed your code (twice) and so far it seems to have cleared the error. The first time it seemed to survive a couple of reboots before the "service not running" error came back.
I ran the code again and for now I2C is working as expected and i have data coming across to Signal K :-)

I'll run a few more reboots and will report back if it continues to work ok..

Thanks again for the support, I can now complete the install of the various sensors and close the project.
Reply
#33
(2026-01-10, 06:05 PM)Mitch C Wrote: Aitonos,
Many thanks for the reply.......I've followed your code (twice) and so far it seems to have cleared the error. The first time it seemed to survive a couple of reboots before the "service not running" error came back.
I ran the code again and for now I2C is working as expected and i have data coming across to Signal K :-)

I'll run a few more reboots and will report back if it continues to work ok..

Thanks again for the support, I can now complete the install of the various sensors and close the project.

Glad that it has been useful for you, Mitch. IA is very useful for code fixing, for non programmers like me it has been a great advance.

?
Reply
#34
[quote pid="35654" dateline="1768070957"]

Glad that it has been useful for you, Mitch. IA is very useful for code fixing, for non programmers like me it has been a great advance.

?
[/quote]
I've just started using AI for code fixing too and so far Perplexity has worked really well....and I'm learning too!!
Reply
#35
(2026-01-10, 06:05 PM)Mitch C Wrote: Aitonos,
Many thanks for the reply.......I've followed your code (twice) and so far it seems to have cleared the error. The first time it seemed to survive a couple of reboots before the "service not running" error came back.
I ran the code again and for now I2C is working as expected and i have data coming across to Signal K :-)

I'll run a few more reboots and will report back if it continues to work ok..

Thanks again for the support, I can now complete the install of the various sensors and close the project.

One further update - several days later and several reboots - I2C service still running :-)
Great work Aitonos!!
Reply
#36
(2026-01-15, 09:55 AM)Mitch C Wrote:
(2026-01-10, 06:05 PM)Mitch C Wrote: Aitonos,
Many thanks for the reply.......I've followed your code (twice) and so far it seems to have cleared the error. The first time it seemed to survive a couple of reboots before the "service not running" error came back.
I ran the code again and for now I2C is working as expected and i have data coming across to Signal K :-)

I'll run a few more reboots and will report back if it continues to work ok..

Thanks again for the support, I can now complete the install of the various sensors and close the project.

One further update - several days later and several reboots - I2C service still running :-)
Great work Aitonos!!
Great news, in my system, the fix remains too...
Reply
#37
I appear to have the same problem with the 12C service not running on my RPi5 using Op4. I was hoping the detailed instructions from Aitonos would work. After implementing the instructions I checked the service.
sudo systemctl status openplotter-i2c-read.service --no-pager -l returned the following
openplotter-i2c-read.service
Loaded: loaded (/etc/systemd/system/openplotter-i2c-read.service; enabled; preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2026-04-01 13:39:51 AWST; 881ms ago
Process: 4825 ExecStart=openplotter-i2c-read $OPrescue (code=exited, status=1/FAILURE)
Main PID: 4825 (code=exited, status=1/FAILURE)
CPU: 416ms
AND
systemctl show -p NRestarts --value openplotter-i2c-read.service returned the following
pi@openplotter:~ $ systemctl show -p NRestarts --value openplotter-i2c-read.service
190
pi@openplotter:~ $

My BME280 is recognised in the i2C setting on 0x68

My knowledge of Linux is very very basic so I'm now stuck. Perhaps I should try another BME280 sensor
Reply
#38
Well I've purchased a new BME280 sensor and fitted it to the GPIO pins.  It's recognised at address 0x76 and shows pressure & humidity.  However it's still greyed out on the Signalk Dashboard.   
A new sensor hasn't solved the problem.  I'm not sure where to go from here?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)