If I run my updates via the CLI, it runs well with no real issue.
➜ ~ /opt/openenergymonitor/EmonScripts/update/service-runner-update.sh all
Starting update via service-runner-update.sh (v3.0) >
Filesystem Size Used Avail Use% Mounted on
/dev/loop1 9.8G 3.0G 6.3G 32% /
none 492K 4.0K 488K 1% /dev
tmpfs 48G 0 48G 0% /dev/shm
tmpfs 19G 164K 19G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 9.5G 0 9.5G 0% /run/user/1000
tmpfs 9.5G 0 9.5G 0% /run/user/1001
- Could not find emonSD version file
git pull /opt/openenergymonitor/EmonScripts
On branch stable
Your branch is up to date with 'origin/stable'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
install/phpredis/
nothing added to commit but untracked files present (use "git add" to track)
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Mon Nov 11 10:34:52 GMT 2024
EUID: 1001
openenergymonitor_dir: /opt/openenergymonitor
type: all
serial_port: ttyAMA0
firmware: emonPi_discrete_jeelib
Traceback (most recent call last):
File "/opt/openenergymonitor/EmonScripts/other/i2cdetect.py", line 4, in <module>
bus = smbus.SMBus(1)
FileNotFoundError: [Errno 2] No such file or directory
Hardware detected: rfm2pi
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pip is already the newest version (22.0.2+dfsg-1ubuntu0.5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: redis in /usr/local/lib/python3.10/dist-packages (5.0.4)
Requirement already satisfied: async-timeout>=4.0.3 in /usr/local/lib/python3.10/dist-packages (from redis) (4.0.3)
Running apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Get:4 https://pkgs.tailscale.com/stable/ubuntu jammy InRelease
Hit:5 https://packagecloud.io/ookla/speedtest-cli/ubuntu jammy InRelease
Fetched 6578 B in 1s (8857 B/s)
Reading package lists... Done
Start emonhub update script:
-------------------------------------------------------------
emonHub update
-------------------------------------------------------------
Enabling SPI for RFM69SPI
Updating /opt/openenergymonitor/emonhub
- current branch: stable
WARNING local changes in /opt/openenergymonitor/emonhub - Module not updated
- git status: On branch stable
Your branch is up to date with 'origin/stable'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: conf/emonhub.conf
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/src
no changes added to commit (use "git add" and/or "git commit -a")
Start emoncms update:
-------------------------------------------------------------
Update Emoncms Core
-------------------------------------------------------------
Updating /var/www/emoncms
- current branch: stable
WARNING local changes in /var/www/emoncms - Module not updated
- git status: On branch stable
Your branch is up to date with 'origin/stable'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Modules/admin/admin_model.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
emoncms
no changes added to commit (use "git add" and/or "git commit -a")
-------------------------------------------------------------
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 ---
-------------------------------------------------------------
Update Emoncms Modules
-------------------------------------------------------------
Updating /var/www/emoncms/Modules/app
- current branch: stable
- local changes: no
- git fetch: Fetching origin
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: master
- local changes: no
- git fetch: Fetching origin
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
Updating /var/www/emoncms/Modules/dashboard
- current branch: stable
- local changes: no
- git fetch: Fetching origin
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: Fetching origin
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: Fetching origin
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: Fetching origin
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: master
- local changes: no
- git fetch: Fetching origin
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)
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: Fetching origin
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: master
- local changes: no
- git fetch: Fetching origin
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)
[]
- installing 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: stable
- local changes: no
- git fetch: Fetching origin
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
-------------------------------------------------------------
System update done: Mon Nov 11 10:35:02 GMT 2024
-------------------------------------------------------------
restarting service-runner
However, if I run “Full Update” from the GUI, I get a bunch of Permission Denied errors.
➜ ~ cat /var/log/emoncms/update.log
Starting update via service-runner-update.sh (v3.0) >
Filesystem Size Used Avail Use% Mounted on
/dev/loop1 9.8G 3.0G 6.3G 32% /
none 492K 4.0K 488K 1% /dev
tmpfs 48G 0 48G 0% /dev/shm
tmpfs 19G 168K 19G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 9.5G 0 9.5G 0% /run/user/1000
tmpfs 9.5G 0 9.5G 0% /run/user/1001
- Could not find emonSD version file
git pull /opt/openenergymonitor/EmonScripts
master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
install/phpredis/
nothing added to commit but untracked files present (use "git add" to track)
error: cannot open .git/FETCH_HEAD: Permission denied
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Mon Nov 11 10:36:44 GMT 2024
EUID: 1000
openenergymonitor_dir: /opt/openenergymonitor
type: all
serial_port: ttyUSB0
firmware: none
Traceback (most recent call last):
File "/opt/openenergymonitor/EmonScripts/other/i2cdetect.py", line 2, in <module>
import smbus
ModuleNotFoundError: No module named 'smbus'
Hardware detected: rfm2pi
Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (22.0.2+dfsg-1ubuntu0.5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: redis in /usr/local/lib/python3.10/dist-packages (5.0.4)
Requirement already satisfied: async-timeout>=4.0.3 in /usr/local/lib/python3.10/dist-packages (from redis) (4.0.3)
Running apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Get:4 https://pkgs.tailscale.com/stable/ubuntu jammy InRelease
Hit:5 https://packagecloud.io/ookla/speedtest-cli/ubuntu jammy InRelease
Fetched 6578 B in 1s (4900 B/s)
Reading package lists...
Start emonhub update script:
-------------------------------------------------------------
emonHub update
-------------------------------------------------------------
Enabling SPI for RFM69SPI
Updating /opt/openenergymonitor/emonhub
- current branch: stable
WARNING local changes in /opt/openenergymonitor/emonhub - Module not updated
- git status: On branch stable
Your branch is up to date with 'origin/stable'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: conf/emonhub.conf
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/src
no changes added to commit (use "git add" and/or "git commit -a")
Start emoncms update:
-------------------------------------------------------------
Update Emoncms Core
-------------------------------------------------------------
Updating /var/www/emoncms
- current branch: stable
WARNING local changes in /var/www/emoncms - Module not updated
- git status: On branch stable
Your branch is up to date with 'origin/stable'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Modules/admin/admin_model.php
Untracked files:
(use "git add <file>..." to include in what will be committed)
emoncms
no changes added to commit (use "git add" and/or "git commit -a")
-------------------------------------------------------------
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 ---
-------------------------------------------------------------
Update Emoncms Modules
-------------------------------------------------------------
Updating /var/www/emoncms/Modules/app
- current branch: stable
- local changes: no
- git fetch: Fetching origin
fatal: Unable to create '/var/www/emoncms/Modules/app/.git/index.lock': Permission denied
- git checkout:
fatal: update_ref failed for ref 'ORIG_HEAD': cannot lock ref 'ORIG_HEAD': Unable to create '/var/www/emoncms/Modules/app/.git/ORIG_HEAD.lock': Permission denied
- git pull:
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/config
- current branch: master
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/var/www/emoncms/Modules/config/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/dashboard
- current branch: stable
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/var/www/emoncms/Modules/dashboard/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/device
- current branch: stable
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/var/www/emoncms/Modules/device/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- component updated
Updating /var/www/emoncms/Modules/graph
- current branch: stable
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/var/www/emoncms/Modules/graph/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- component updated
Updating /opt/emoncms/modules/backup
- current branch: stable
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/opt/emoncms/modules/backup/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- 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: master
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/opt/emoncms/modules/network/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- 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
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/opt/emoncms/modules/postprocess/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- component updated
Updating /opt/emoncms/modules/sync
- current branch: master
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/opt/emoncms/modules/sync/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- running module install/update script (user=pi)
[]
/opt/emoncms/modules/sync/install.sh: line 9: /opt/emoncms/modules/sync/emoncms_sync.service: Permission denied
- reinstalling emoncms_sync.service
Removed /etc/systemd/system/multi-user.target.wants/emoncms_sync.service.
mv: cannot stat '/opt/emoncms/modules/sync/emoncms_sync.service': No such file or directory
Failed to enable unit: Unit file emoncms_sync.service does not exist.
Failed to restart emoncms_sync.service: Unit emoncms_sync.service not found.
- Service ActiveState=inactive
- component updated
Updating /opt/emoncms/modules/usefulscripts
- current branch: stable
- local changes: no
error: cannot open .git/FETCH_HEAD: Permission denied
- git fetch:
fatal: Unable to create '/opt/emoncms/modules/usefulscripts/.git/index.lock': Permission denied
- git checkout:
error: cannot open .git/FETCH_HEAD: Permission denied
- git pull:
- database update: no changes
- component updated
-------------------------------------------------------------
System update done: Mon Nov 11 10:36:49 GMT 2024
-------------------------------------------------------------
restarting service-runner
➜ ~
When I installed (onto Ubuntu 22.04 LXC running on Proxmox) I ran the below per the instructions so that pi doesnt need a password for sudo.
sudo echo $USER' ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/$USER && sudo chmod 0440 /etc/sudoers.d/$USER
The update scripts appear to be owned by pi, and seem to have reasonable permissions.
➜ update git:(stable) ✗ ls -al /opt/openenergymonitor/EmonScripts/update/
total 596
drwxrwxr-x 2 pi pi 4096 Oct 18 20:19 .
drwxrwxr-x 10 pi pi 4096 Oct 12 21:34 ..
-rwxrwxr-x 1 pi pi 4283 Oct 12 21:34 atmega_firmware_upload.sh
-rw-rw-r-- 1 pi pi 544276 Oct 12 21:34 avrdude.conf
-rwxrwxr-x 1 pi pi 2657 Oct 12 21:34 emoncms.sh
-rwxrwxr-x 1 pi pi 772 Oct 12 21:34 emonhub.sh
-rwxrwxr-x 1 pi pi 989 Oct 12 21:34 emonsd.sh
-rwxrwxr-x 1 pi pi 1356 Oct 12 21:34 firstbootupdate
-rwxrwxr-x 1 pi pi 767 Oct 12 21:34 get_firmware_download_url.py
-rw-rw-r-- 1 pi pi 386 Oct 12 21:34 load_config.sh
-rwxrwxr-x 1 pi pi 4279 Oct 12 21:34 main.sh
-rw-rw-r-- 1 pi pi 1667 Oct 12 21:34 readme.md
-rwxrwxr-x 1 pi pi 2616 Oct 12 21:34 service-runner-update.sh
-rwxrwxr-x 1 pi pi 764 Oct 12 21:34 update_all_components.sh
-rwxrwxr-x 1 pi pi 1590 Oct 12 21:34 update_component.sh
➜ update git:(stable) ✗
I know from previous questions that sometimes the web elements should run as www-data … is this the case here and does anyone happen to know which permissions / file ownership I have wrong please?
Thank you!!