openenergymonitor / EmonScripts

Emoncms Stack Installation and Update scripts
16 stars 30 forks source link

Package install fails when apt is in use #103

Open borpin opened 4 years ago

borpin commented 4 years ago

'apt' may be in use when the scripts wish to install a package. No check is made to ensure it has installed sucessfully or if apt is in use. This may be why there have been issues with emonhub updates.

https://community.openenergymonitor.org/t/emonpi-update-jammed-at-sudo-apt-install-python3-pip/14817/7?u=borpin

background

https://itsfoss.com/could-not-get-lock-error/

borpin commented 4 years ago

One solution might be to check if the apt update services are running and if not, stop them. If they are running, need to wait until they have finished.

systemctl status {apt-daily-upgrade.timer,apt-daily.timer}

However, several different things can start apt so it isn't robust (https://saveriomiroddi.github.io/Handling-the-apt-lock-on-ubuntu-server-installations/).