Skip to content

python3-rpi-lgpio and python3-rpi.gpio flip flopping on emonhp #223

@reedy

Description

@reedy

The same package shouldn't be repeatedly installed and uninstalled...

emonhub/install.sh

Lines 91 to 103 in 78f92f2

# Remove RPi.GPIO if it is installed, as it conflicts with rpi-lgpio
if [ "$rpi_lgpio_available" -eq 1 ]; then
if [ "$rpi_gpio_installed" -eq 1 ]; then
echo "- Removing python3-rpi-gpio"
sudo apt remove -y python3-rpi.gpio
fi
# Install rpi-lgpio if it is not already installed
if [ "$rpi_lgpio_installed" -eq 0 ]; then
echo "- Installing rpi-lgpio"
sudo apt install -y python3-rpi-lgpio
pip3 install rpi-lgpio
fi

https://github.com/openenergymonitor/emonPiLCD/blob/a3427ab5271f22f4bd541137ba899e2b5436dbe0/install.sh#L12

LAST ENTRIES ON THE LOG FILE
Starting update via service-runner-update.sh (v3.0) >
Filesystem Size Used Avail Use% Mounted on
udev 192M 0 192M 0% /dev
tmpfs 91M 9.6M 82M 11% /run
/dev/mmcblk0p2 4.4G 3.6G 623M 86% /
tmpfs 455M 0 455M 0% /dev/shm
tmpfs 5.0M 16K 5.0M 1% /run/lock
tmpfs 30M 28K 30M 1% /tmp
tmpfs 1.0M 8.0K 1016K 1% /var/lib/php/sessions
tmpfs 128M 0 128M 0% /var/tmp
/dev/mmcblk0p1 510M 93M 418M 19% /boot/firmware
/dev/mmcblk0p3 9.7G 19K 9.2G 1% /var/opt/emoncms
log2ram 50M 4.7M 46M 10% /var/log
- emonSD version: emonSD-01Feb24
- supported images: emonSD-03Jul25 emonSD-01Feb24 emonSD-20Nov23 emonSD-10Nov22 emonSD-21Jul21 emonSD-08May21 emonSD-24Jul20 emonSD-02Oct19 emonSD-17Oct19
- emonSD base image check passed...continue update
git pull /opt/openenergymonitor/EmonScripts
master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.

Untracked files:
(use "git add ..." to include in what will be committed)
install/Mosquitto-PHP/
install/phpredis/

nothing added to commit but untracked files present (use "git add" to track)
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Thu 4 Sep 01:26:27 BST 2025
EUID: 1000
openenergymonitor_dir: /opt/openenergymonitor
type: all
serial_port: ttyAMA0
firmware: none
Hardware detected: rfm2pi
Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (23.0.1+dfsg-1+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 210 not upgraded.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: redis in /usr/local/lib/python3.11/dist-packages (5.0.1)
Requirement already satisfied: async-timeout>=4.0.2 in /usr/local/lib/python3.11/dist-packages (from redis) (4.0.3)
Running apt-get update
Hit:1 http://raspbian.raspberrypi.com/raspbian bookworm InRelease
Hit:2 http://archive.raspberrypi.com/debian bookworm InRelease
Hit:3 https://packages.sury.org/php bookworm InRelease
Hit:4 https://download.docker.com/linux/raspbian bookworm InRelease
Reading package lists...
W: http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
git pull /opt/openenergymonitor/RFM2Pi
* master
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
Already up to date.
git pull /opt/openenergymonitor/emonPiLCD
* emonhp
stable
On branch emonhp
Your branch is up to date with 'origin/emonhp'.

Untracked files:
(use "git add ..." to include in what will be committed)
__pycache__/
emonhp/

nothing added to commit but untracked files present (use "git add" to track)
Already up to date.
Start emonhub update script:
-------------------------------------------------------------
emonHub update
-------------------------------------------------------------
Updating /opt/openenergymonitor/emonhub
- current branch: master
- local changes: no
- git fetch:
Already on 'master'
- git checkout: Your branch is up to date with 'origin/master'.
- git pull: Already up to date.
- database update: no changes
- running module install/update script (user=pi)
EmonHub directory: /opt/openenergymonitor/emonhub
emonSD_pi_env provided in arg = 1
user provided as arg = pi
installing or updating emonhub dependencies
Reading package lists...
Building dependency tree...
Reading state information...
python3-serial is already the newest version (3.5-1.1).
python3-configobj is already the newest version (5.0.8-1).
python3-pip is already the newest version (23.0.1+dfsg-1+rpt1).
python3-pymodbus is already the newest version (3.0.0-7).
bluetooth is already the newest version (5.66-1+rpt1+deb12u2).
python3-spidev is already the newest version (20200602~200721-1+bookworm).
0 upgraded, 0 newly installed, 0 to remove and 210 not upgraded.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: paho-mqtt==1.6.1 in /home/pi/.local/lib/python3.11/site-packages (1.6.1)
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.28.1)
Requirement already satisfied: py-sds011 in /home/pi/.local/lib/python3.11/site-packages (0.9)
Requirement already satisfied: sdm_modbus in /home/pi/.local/lib/python3.11/site-packages (0.7.0)
Requirement already satisfied: minimalmodbus in /home/pi/.local/lib/python3.11/site-packages (2.1.1)
Requirement already satisfied: pyserial in /usr/lib/python3/dist-packages (from py-sds011) (3.5)
Requirement already satisfied: pymodbus>=3.5.0 in /home/pi/.local/lib/python3.11/site-packages (from sdm_modbus) (3.6.3)
Requirement already satisfied: pyserial-asyncio>=0.6.0 in /usr/lib/python3/dist-packages (from sdm_modbus) (0.6)
- Removing python3-rpi-gpio

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
python3-rpi.gpio
0 upgraded, 0 newly installed, 1 to remove and 210 not upgraded.
After this operation, 162 kB disk space will be freed.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 100767 files and directories currently installed.)
Removing python3-rpi.gpio (0.7.1~a4-1+b2) ...
- Installing rpi-lgpio

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
rpi.gpio-common
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
python3-rpi-lgpio
0 upgraded, 1 newly installed, 0 to remove and 210 not upgraded.
Need to get 14.3 kB of archives.
After this operation, 59.4 kB of additional disk space will be used.
Get:1 http://archive.raspberrypi.com/debian bookworm/main armhf python3-rpi-lgpio all 0.6-0~rpt1 [14.3 kB]
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Fetched 14.3 kB in 0s (191 kB/s)
Selecting previously unselected package python3-rpi-lgpio.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 100756 files and directories currently installed.)
Preparing to unpack .../python3-rpi-lgpio_0.6-0~rpt1_all.deb ...
Unpacking python3-rpi-lgpio (0.6-0~rpt1) ...
Setting up python3-rpi-lgpio (0.6-0~rpt1) ...
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: rpi-lgpio in /usr/lib/python3/dist-packages (0.6)
Remove console from /boot/cmdline.txt
Stop and disable serial service
Unit /etc/systemd/system/serial-getty@ttyAMA0.service is masked, ignoring.
/etc/emonhub directory already exists
Setting ownership of /var/log/emonhub to pi
Setting ownership of /var/log/emonhub/emonhub.log to pi and permissions to 644
Installing /usr/local/bin/emonhub symlink
emonhub.service already installed
- Service ActiveState=active
- component updated

Start emoncms update:
-------------------------------------------------------------
Update Emoncms Core
-------------------------------------------------------------
Updating /var/www/emoncms
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
-------------------------------------------------------------
Update Emoncms Services
-------------------------------------------------------------
emoncms_mqtt.service already installed
feedwriter.service already installed
service-runner.service already installed

Reloading systemctl deamon
Restarting Services...
- sudo systemctl restart feedwriter.service
--- ActiveState=active ---
- sudo systemctl restart emoncms_mqtt.service
--- ActiveState=active ---
- sudo systemctl restart emonhub.service
--- ActiveState=active ---
/opt/openenergymonitor/EmonScripts/sudoers.d/emoncms-rebootbutton: parsed OK
emonPi emoncms admin reboot button sudoers updated

-------------------------------------------------------------
Update Emoncms Modules
-------------------------------------------------------------
Updating /var/www/emoncms/Modules/app
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/config
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/dashboard
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/device
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/graph
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/setup
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /opt/emoncms/modules/backup
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- running module install/update script (user=pi)
- config.cfg already exists, left unmodified
- creating /etc/php/8.1/mods-available/emoncmsbackup.ini
post_max_size = 3G
upload_max_filesize = 3G
upload_tmp_dir = /var/opt/emoncms/backup/uploads
- phpenmod emoncmsbackup
- restarting apache
- component updated
Updating /opt/emoncms/modules/network
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- running module install/update script (user=pi)
This script must be run as root
Try "sudo /opt/emoncms/modules/network/install.sh"
- component updated
Updating /opt/emoncms/modules/postprocess
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- component updated
Updating /opt/emoncms/modules/sync
- current branch: stable
- local changes: no
- git fetch:
Already on 'stable'
- git checkout: Your branch is up to date with 'origin/stable'.
- git pull: Already up to date.
- database update: no changes
- running module install/update script (user=pi)
[]
- reinstalling emoncms_sync.service
Removed "/etc/systemd/system/multi-user.target.wants/emoncms_sync.service".
Created symlink /etc/systemd/system/multi-user.target.wants/emoncms_sync.service → /lib/systemd/system/emoncms_sync.service.
- Service ActiveState=active
- component updated
Updating /opt/emoncms/modules/usefulscripts
- current branch: master
- local changes: no
- git fetch:
Already on 'master'
- git checkout: Your branch is up to date with 'origin/master'.
- git pull: Already up to date.
- database update: no changes
- component updated

-------------------------------------------------------------
EmonPi LCD Update
-------------------------------------------------------------
Reading package lists...
Building dependency tree...
Reading state information...
python3-smbus is already the newest version (4.3-2+b2).
i2c-tools is already the newest version (4.3-2+b2).
python3-gpiozero is already the newest version (2.0.1-0+rpt1).
The following packages will be REMOVED:
python3-rpi-lgpio
The following NEW packages will be installed:
python3-rpi.gpio
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
0 upgraded, 1 newly installed, 1 to remove and 210 not upgraded.
Need to get 0 B/21.2 kB of archives.
After this operation, 102 kB of additional disk space will be used.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 100771 files and directories currently installed.)
Removing python3-rpi-lgpio (0.6-0~rpt1) ...
Selecting previously unselected package python3-rpi.gpio.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 100756 files and directories currently installed.)
Preparing to unpack .../python3-rpi.gpio_0.7.1~a4-1+b2_armhf.deb ...
Unpacking python3-rpi.gpio (0.7.1~a4-1+b2) ...
Setting up python3-rpi.gpio (0.7.1~a4-1+b2) ...
Reading package lists...
Building dependency tree...
Reading state information...
libopenjp2-7 is already the newest version (2.5.0-2).
0 upgraded, 0 newly installed, 0 to remove and 210 not upgraded.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: redis in /usr/local/lib/python3.11/dist-packages (5.0.1)
Requirement already satisfied: paho-mqtt in /home/pi/.local/lib/python3.11/site-packages (1.6.1)
Requirement already satisfied: xmltodict in /home/pi/.local/lib/python3.11/site-packages (0.13.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.28.1)
Requirement already satisfied: adafruit-circuitpython-ssd1306 in /home/pi/.local/lib/python3.11/site-packages (2.12.16)
Requirement already satisfied: Pillow in /home/pi/.local/lib/python3.11/site-packages (10.2.0)
Requirement already satisfied: async-timeout>=4.0.2 in /usr/local/lib/python3.11/dist-packages (from redis) (4.0.3)
Requirement already satisfied: Adafruit-Blinka in /home/pi/.local/lib/python3.11/site-packages (from adafruit-circuitpython-ssd1306) (8.31.0)
Requirement already satisfied: adafruit-circuitpython-busdevice in /home/pi/.local/lib/python3.11/site-packages (from adafruit-circuitpython-ssd1306) (5.2.6)
Requirement already satisfied: adafruit-circuitpython-framebuf in /home/pi/.local/lib/python3.11/site-packages (from adafruit-circuitpython-ssd1306) (1.6.5)
Requirement already satisfied: Adafruit-PlatformDetect>=3.53.0 in /home/pi/.local/lib/python3.11/site-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (3.59.0)
Requirement already satisfied: Adafruit-PureIO>=1.1.7 in /home/pi/.local/lib/python3.11/site-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (1.1.11)
Requirement already satisfied: pyftdi>=0.40.0 in /home/pi/.local/lib/python3.11/site-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (0.55.0)
Requirement already satisfied: adafruit-circuitpython-typing in /home/pi/.local/lib/python3.11/site-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (1.9.6)
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (0.7.1a4)
Requirement already satisfied: rpi-ws281x>=4.0.0 in /home/pi/.local/lib/python3.11/site-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (5.0.0)
Requirement already satisfied: sysv-ipc>=1.1.0 in /home/pi/.local/lib/python3.11/site-packages (from Adafruit-Blinka->adafruit-circuitpython-ssd1306) (1.1.0)
Requirement already satisfied: pyusb!=1.2.0,>=1.0.0 in /home/pi/.local/lib/python3.11/site-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-ssd1306) (1.2.1)
Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit-circuitpython-ssd1306) (3.5)
Requirement already satisfied: adafruit-circuitpython-requests in /home/pi/.local/lib/python3.11/site-packages (from adafruit-circuitpython-typing->Adafruit-Blinka->adafruit-circuitpython-ssd1306) (2.0.4)
Requirement already satisfied: typing-extensions~=4.0 in /home/pi/.local/lib/python3.11/site-packages (from adafruit-circuitpython-typing->Adafruit-Blinka->adafruit-circuitpython-ssd1306) (4.9.0)
- reinstalling emonPiLCD.service
Removed "/etc/systemd/system/emonPiLCD.service".
Removed "/etc/systemd/system/multi-user.target.wants/emonPiLCD.service".
- installing emonPiLCD.service
Created symlink /etc/systemd/system/emonPiLCD.service → /opt/openenergymonitor/emonPiLCD/emonPiLCD.service.
Created symlink /etc/systemd/system/multi-user.target.wants/emonPiLCD.service → /opt/openenergymonitor/emonPiLCD/emonPiLCD.service.
- Service ActiveState=active
Stopping emonPiLCD service
service-runner will be restarted at the end

-------------------------------------------------------------
System update done: Thu 4 Sep 01:27:45 BST 2025
-------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions