The issue here appears to be related to the docker image used for mattermost and a limitation of how juju is allowed to exec into the mattermost container.
The mattermost docker image used by he charm sets up a non-root default user. However, when juju execs into the container as a result of upgrade charm, in order to unpack the new charm so actions are updated, the non-root user does not have permission to access the charm files, hence the permission error.
The only solution at the moment is to not have a default non-root user in the workload container.
The issue here appears to be related to the docker image used for mattermost and a limitation of how juju is allowed to exec into the mattermost container.
There's this k8s bug
https:/ /github. com/kubernetes/ kubernetes/ issues/ 30656
The mattermost docker image used by he charm sets up a non-root default user. However, when juju execs into the container as a result of upgrade charm, in order to unpack the new charm so actions are updated, the non-root user does not have permission to access the charm files, hence the permission error.
The only solution at the moment is to not have a default non-root user in the workload container.