(2025-04-16, 06:41 PM)ukabroad Wrote: Thanks for the prompt response Mate, I will stay tuned
Cheers
Malcolm
Malcolm,
Could I ask you to confirm a couple things. After making the modifications to the lgpio.py, instead of rebooting could you restart the openplotter-i2c-read service with the following command.
Code:
sudo systemctl restart openplotter-i2c-read
Then confirm that the read service is running with the Openplotter Check System. Also confirm that Signalk is getting data from your BME688 sensor.
I have not been able to repeat the loss of the lgpio.py changes to my systems after shutdowns and reboots. I'm thinking that maybe your changes to the lgpio.py are not being saved. After making the changes the read service should work without rebooting.
Still investigating.
Jay
S/V Priority
Hi Jay, After making the modifications to the lgpio.py I closed the terminal window, opened another and tried sudo systemctl restart openplotter-i2c-read. I got zero response to that command. I tried 3 times - same. I closed that terminal window, opened new and navigated through the commands to arrive at line 504 to see that the red comment # was missing. So changed it again and saved but left the terminal window open. tried sudo systemctl restart openplotter-i2c-read but zero response. then closed all terminal windows - opened terminal and made modifications to lgpio and saved but left window open. opened a second terminal and repeated the process to open - at this point it stated the lgpio.py was under root modification (or words to that effect) and did I still want to open - replied Y - navigated to line 504 and no sign of red#. so obviously it is not saving before a reboot
I'm at total newbee at this so I really do appreciate your clear precise instructions so please do not hesitate to let me know if i am making some mistakes.
Cheers Mate, really appreciate your help
Malcolm
S/Y Freya
ps What is your boat? (just curious, so no need to answer if you don't want to)
(2025-04-16, 06:41 PM)ukabroad Wrote: Thanks for the prompt response Mate, I will stay tuned
Cheers
Malcolm
Malcolm,
Could I ask you to confirm a couple things. After making the modifications to the lgpio.py, instead of rebooting could you restart the openplotter-i2c-read service with the following command.
Code:
sudo systemctl restart openplotter-i2c-read
Then confirm that the read service is running with the Openplotter Check System. Also confirm that Signalk is getting data from your BME688 sensor.
I have not been able to repeat the loss of the lgpio.py changes to my systems after shutdowns and reboots. I'm thinking that maybe your changes to the lgpio.py are not being saved. After making the changes the read service should work without rebooting.
Still investigating.
Jay
S/V Priority
Hi Jay, After making the modifications to the lgpio.py I closed the terminal window, opened another and tried sudo systemctl restart openplotter-i2c-read. I got zero response to that command. I tried 3 times - same. I closed that terminal window, opened new and navigated through the commands to arrive at line 504 to see that the red comment # was missing. So changed it again and saved but left the terminal window open. tried sudo systemctl restart openplotter-i2c-read but zero response. then closed all terminal windows - opened terminal and made modifications to lgpio and saved but left window open. opened a second terminal and repeated the process to open - at this point it stated the lgpio.py was under root modification (or words to that effect) and did I still want to open - replied Y - navigated to line 504 and no sign of red#. so obviously it is not saving before a reboot
I'm at total newbee at this so I really do appreciate your clear precise instructions so please do not hesitate to let me know if i am making some mistakes.
Cheers Mate, really appreciate your help
Malcolm
S/Y Freya
ps What is your boat? (just curious, so no need to answer if you don't want to)
Malcolm,
Sorry for the less than clear instructions. I wrongfully assumed you were good with linux.
First, what hardware are you using. I asume a Raspberrry Pi 5.
Second, the sudo systemctl restart openplotter-i2c-read command will not return any information. To see the status of the read service after restart enter the following in a terminal,
Code:
sudo systemctl status openplotter-i2c-read
This will show the service is "active (running)" if all is good. There are somes messages about "attributes" but these are not causing "Failure".
Third, How are you exiting the nano editor? To save your changes, you have two options. One is to enter a CTRL + o (letter) and it will prompt you for "File Name to write: lgpio.py". Just hit ENTER. This will save the changes. Then CTRL + x to exit. OR, you can enter CTRL + x and nano will prompt you "Save modified buffer?" hit Y to save.
I assume you are using "sudo", (ie: sudo nano lgpio.py). And I assume you have sudo privileges. If you enter the following in a terminal it will show you what groups you're in, sudo should be in the list;
Code:
groups
It shouldn't make any difference whether you close the terminal or not. If the changes are saved all should work.
Try running the Openplotter Check System to see if the i2c read service is running.. It will show in red "service not running" under i2c if the read service is not running.
We have to get your lgpio.py changes saved to get the read service working.
Cheers to you,
Jay
S/V Priority is a Cape Dory 33. My family grew up sailing this boat (purchased new in 1982) mostly on the Chesapeake Bay (USA). Have sailed it to the southern Bahamas and up to northern Maine. Getting ready for spring cruise for the month of May.
Fantastic Jay, I got it working using - One is to enter a CTRL + o (letter) and it will prompt you for "File Name to write: lgpio.py". Just hit ENTER. This will save the changes.
All readings showing up in signalk - Thank you so much for helping an old Sailor (who's trying to keep his mind from going senile lol)
S/Y Freya is a 1990 Beneteau Oceanis 500 - I bought her in Sweden 2009, sailed her to UK and spent 12 months fitting her out for Blue water sailing.
Left UK in 2010 and spent 3 years cruising the Med and crossed the Atlantic in 2013 - She has been in the Caribbean ever since - Currently on the hard in Curacao where I'm trying to complete a major re-fit (including an engine rebuild lol) Currently I'm home in Arkansas playing with electronics (much to my American Wife's annoyance.)
Thanks again for your help Mate
Cheers
Malcolm
S/Y Freya
2025-04-18, 10:24 PM (This post was last modified: 2025-04-18, 10:31 PM by Jay_cd33.)
(2025-04-18, 07:28 PM)ukabroad Wrote: Fantastic Jay, I got it working using - One is to enter a CTRL + o (letter) and it will prompt you for "File Name to write: lgpio.py". Just hit ENTER. This will save the changes.
All readings showing up in signalk - Thank you so much for helping an old Sailor (who's trying to keep his mind from going senile lol)
S/Y Freya is a 1990 Beneteau Oceanis 500 - I bought her in Sweden 2009, sailed her to UK and spent 12 months fitting her out for Blue water sailing.
Left UK in 2010 and spent 3 years cruising the Med and crossed the Atlantic in 2013 - She has been in the Caribbean ever since - Currently on the hard in Curacao where I'm trying to complete a major re-fit (including an engine rebuild lol) Currently I'm home in Arkansas playing with electronics (much to my American Wife's annoyance.)
Thanks again for your help Mate
Cheers
Malcolm
S/Y Freya
Wow that's great Malcolm. Hopefully it will stay changed for reboots. Let me know.
I'm familiar with the Beneteau Oceanis'. Our swiss friend in the Bahamas had one. Great boat. Sounds like you have allot of sailing experience with it. My wife and I have done several trips to Bermuda and back on other peoples boat. Also chartered in BVI and Belize but that's all.
Perhaps a bit late to this discussion, but I just had the same problem, but I think I found a different solution, for those who do not want to modify the lgpio.py file.
The problem in lgpio is that it is trying to open a "named pipe", not a file. It uses this pipe to communicate with other processes. For everything to work as intended, you may want to allow it to create that pipe. The issue is that the directory that it tries to make this pipe is not a location it is allowed to write the file. You want it to write the file in /tmp.
Here is what worked for me:
Check if in /tmp there is a file called ".lgd-nfy0" (Do "ls -al /tmp") If the file is there, delete it, since it may have the wrong ownership or permissions.
Set the environment variable "LG_WD" to "/tmp" for every bash process. Best way to do this is to create a file in /etc/profile.d/ called lgpio.sh, which sets the variable. (Do "sudo nano /etc/profile.d/lgpio.sh", then in the editor window type "export LG_WD=/tmp", then save the file with control-o, followed by return, then close the window with control-x
Reboot.
This will allow the lgpio processes to work correctly. For me the i2c process now functions correctly.
(2025-04-22, 08:08 AM)Sailing.Skog Wrote: Perhaps a bit late to this discussion, but I just had the same problem, but I think I found a different solution, for those who do not want to modify the lgpio.py file.
The problem in lgpio is that it is trying to open a "named pipe", not a file. It uses this pipe to communicate with other processes. For everything to work as intended, you may want to allow it to create that pipe. The issue is that the directory that it tries to make this pipe is not a location it is allowed to write the file. You want it to write the file in /tmp.
Here is what worked for me:
Check if in /tmp there is a file called ".lgd-nfy0" (Do "ls -al /tmp") If the file is there, delete it, since it may have the wrong ownership or permissions.
Set the environment variable "LG_WD" to "/tmp" for every bash process. Best way to do this is to create a file in /etc/profile.d/ called lgpio.sh, which sets the variable. (Do "sudo nano /etc/profile.d/lgpio.sh", then in the editor window type "export LG_WD=/tmp", then save the file with control-o, followed by return, then close the window with control-x
Reboot.
This will allow the lgpio processes to work correctly. For me the i2c process now functions correctly.
Cheers!
Sailing.Skog,
Thanks for sharing. Your work around is much better. I knew lgpio.py was trying to create a pipe but I couldn't figure out where and why it couldn't create it.
Hopefully readers will read to the end of the thread and find your work around.
(2025-04-15, 11:27 AM)Jay_cd33 Wrote: SOLUTION FOR ME!!! But it's a HACK!
DISCLAIMER: I'm not a programmer/developer. What I'm detailing here is a pure hack. It may break other things on your system and will probably not survive reinstalls or software updates. This did work for me and has not caused any other problems with my openplotter setup. I'm only trying to help others in this community. Your mileage may vary.
Using the following command in a terminal shows the messages from systemd on starting the openplotter-i2c-read service.
Code:
journalctl -u openplotter-i2c-read.service -f
Use ctrl c to stop the output. The openplotter-i2c-read service will try to restart every 3 sec. Here's the output for a single restart.
Of particaular interest is this message:
The lgpio.py library is trying to access a file that doesn't exist. This file is associated with notifications which I don't believe are used in our applications.
So my solution was to comment out this line of the lgpio.py library (I know it's a hack!). But it works.
So do this.
Code:
cd /usr/lib/python3/dist-packages
sudo cp lgpio.py lgpio.org
sudo nano lgpio.py
Show line numbers with Alt+Shift+3.
Navigate to line number 504 with Ctrl+/
Comment out line 504 with # as show in this screenshot
Save changes with Ctrl+x and y.
Then reboot system.
If you need to change back to the original setup:
Code:
cd /usr/lib/python3/dist-packages
sudo rm lgpio.py
sudo mv lgpio.org lgpio.py
This worked for me. Hope it helps you
Jay
S/V Priority
Absolute life saver, many thanks Jay, it worked for me!