Permission denied errors when updating via GUI

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!! :beer:

As what user?

Even though you added the user, did you install as the logged in user (i.e. changed the user in the install script config file) or pi?

For some reason a permission error

@TrystanLea - have you changed anything re permissions or ownership in the EmonScripts recently? I wonder if there are any changes in the behaviour of git to cause this?

I also note these warnings. Not sure if you know you have changes in these or not.

Sorry @borpin Brian - should have been clearer, thanks for your help.

I’m running cli updates as pi.
I installed (and reinstalled) Emoncms via scripts as pi.

Also, I ran this so that Pi shouldnt 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

And logged in as pi to do so?

I don’t think that sudo is the problem. It is the ownership/permissions on the git repositories (such as /var/www/emoncms/Modules/config) that is the issue.

Correct, ssh’d in as pi to run cli.

Did you add the pi user to the sudo group?

Yes he did :slight_smile:

It shouldn’t matter though, as the git commands are not sudo commands.

I meant to do the install?

Can you do an ls -la on one of the directories that failed (plus it’s parent(s)).

@TrystanLea

I note that there is a chown on the top-level folder, but not one on the Modules folder

I wonder if git has become a bit more insistent on permissions.

@jamespreedy to test this theory, can you remove the local changes to the main emoncms repo (Modules/admin/admin_model.php) and try to run from the UI again?

-------------------------------------------------------------
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")

Permissions as requested.

➜  ~ cd /var/www/emoncms/Modules/app
➜  app git:(stable) ls -al
total 124
drwxrwxr-x  8 pi pi  4096 Oct 12 20:22 .
drwxrwxr-x 16 pi pi  4096 Oct 12 19:42 ..
drwxrwxr-x  8 pi pi  4096 Nov 11 10:34 .git
-rw-rw-r--  1 pi pi   148 May 18 20:51 .gitignore
-rw-rw-r--  1 pi pi   167 May 18 20:51 .travis.yml
-rw-rw-r--  1 pi pi 32386 May 18 20:51 LICENSE.txt
drwxrwxr-x  2 pi pi  4096 Oct 12 20:22 Lib
-rw-rw-r--  1 pi pi  1104 May 18 20:51 Readme.md
drwxrwxr-x  4 pi pi  4096 May 18 20:51 Views
-rw-rw-r--  1 pi pi  9546 Oct 12 20:22 app_controller.php
-rw-rw-r--  1 pi pi  2316 Oct 12 20:22 app_menu.php
-rw-rw-r--  1 pi pi 16620 Oct 12 20:22 app_model.php
-rw-rw-r--  1 pi pi   803 Oct 12 20:22 app_schema.php
drwxrwxr-x  5 pi pi  4096 May 18 20:51 apps
-rw-rw-r--  1 pi pi   372 May 18 20:51 composer.json
drwxrwxr-x  2 pi pi  4096 May 18 20:51 fonts
drwxrwxr-x  2 pi pi  4096 May 18 20:51 images
-rw-rw-r--  1 pi pi   157 Oct 12 20:22 module.json
➜  app git:(stable) cd .git
➜  .git git:(stable) ls -al
total 72
drwxrwxr-x  8 pi pi  4096 Nov 11 10:34 .
drwxrwxr-x  8 pi pi  4096 Oct 12 20:22 ..
-rw-rw-rw-  1 pi pi  1698 Nov 11 10:36 FETCH_HEAD
-rw-rw-r--  1 pi pi    23 Nov 11 10:34 HEAD
-rw-rw-r--  1 pi pi    41 Oct 12 20:24 ORIG_HEAD
drwxrwxr-x  2 pi pi  4096 May 18 20:51 branches
-rw-rw-r--  1 pi pi   259 May 18 20:51 config
-rw-rw-r--  1 pi pi    73 May 18 20:51 description
drwxrwxr-x  2 pi pi  4096 May 18 20:51 hooks
-rw-rw-r--  1 pi pi 11118 Nov 11 10:34 index
drwxrwxr-x  2 pi pi  4096 May 18 20:51 info
drwxrwxr-x  3 pi pi  4096 May 18 20:51 logs
drwxrwxr-x 51 pi pi  4096 Nov 11 10:34 objects
-rw-rw-r--  1 pi pi  4994 May 18 20:51 packed-refs
drwxrwxr-x  5 pi pi  4096 May 18 20:51 refs
➜  .git git:(stable) cd ..
➜  app git:(stable) cd ..
➜  Modules git:(stable) ✗ pwd
/var/www/emoncms/Modules
➜  Modules git:(stable) ✗ ls -al
total 64
drwxrwxr-x 16 pi pi 4096 Oct 12 19:42 .
drwxrwxr-x 10 pi pi 4096 Nov  8 20:54 ..
drwxrwxr-x  5 pi pi 4096 Nov  8 20:58 admin
drwxrwxr-x  8 pi pi 4096 Oct 12 20:22 app
lrwxrwxrwx  1 pi pi   41 May 18 20:51 backup -> /opt/emoncms/modules/backup/backup-module
drwxrwxr-x  4 pi pi 4096 Oct 12 19:42 config
drwxrwxr-x  7 pi pi 4096 Nov  8 20:54 dashboard
drwxrwxr-x  7 pi pi 4096 May 18 20:51 device
drwxrwxr-x  3 pi pi 4096 May 18 20:51 eventp
drwxrwxr-x  5 pi pi 4096 Jul 20 13:34 feed
drwxrwxr-x  8 pi pi 4096 Jul 20 13:34 graph
drwxrwxr-x  4 pi pi 4096 May 18 20:51 input
lrwxrwxrwx  1 pi pi   43 May 18 20:51 network -> /opt/emoncms/modules/network/network-module
lrwxrwxrwx  1 pi pi   51 May 18 20:51 postprocess -> /opt/emoncms/modules/postprocess/postprocess-module
drwxrwxr-x  4 pi pi 4096 May 18 20:51 process
drwxrwxr-x  4 pi pi 4096 May 18 20:51 schedule
lrwxrwxrwx  1 pi pi   37 May 18 20:51 sync -> /opt/emoncms/modules/sync/sync-module
drwxrwxr-x  2 pi pi 4096 May 18 20:51 time
drwxrwxr-x  5 pi pi 4096 Jul 14 08:00 user
drwxrwxr-x  7 pi pi 4096 Jul 14 08:00 vis
➜  Modules git:(stable) ✗

I changed this again …
/var/www/emoncms/Modules/admin/admin_model.php
(public, back to private, line 213)

Update from GUI doesn’t work again, no output to /var/log/emoncms/update.log

Changed it back again …
/var/www/emoncms/Modules/admin/admin_model.php
(private, back to public, line 213)

Update from GUI works immediately, output to /var/log/emoncms/update.log includes the same permission denied errors again.

➜  ~ 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  140K   19G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
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: Tue Nov 12 10:21:13 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
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:3 https://pkgs.tailscale.com/stable/ubuntu jammy InRelease
Get:4 http://archive.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2149 kB]
Hit:6 https://packagecloud.io/ookla/speedtest-cli/ubuntu jammy InRelease
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [367 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [455 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1932 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-security/main Translation-en [309 kB]
Get:11 http://archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2573 kB]
Get:12 http://archive.ubuntu.com/ubuntu jammy-security/restricted Translation-en [444 kB]
Get:13 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [913 kB]
Get:14 http://archive.ubuntu.com/ubuntu jammy-security/universe Translation-en [181 kB]
Fetched 9587 kB in 2s (5647 kB/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
- installing 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: Tue Nov 12 10:21:20 GMT 2024
-------------------------------------------------------------
restarting service-runner
➜  ~