Initcontainer crash: mkdir Permission denied #210

Closed
opened 2021-08-06 08:12:29 +00:00 by viceice · 3 comments
viceice commented 2021-08-06 08:12:29 +00:00 (Migrated from gitea.com)

I get the following error while upgrading (replace gitea container):

+ mkdir -p /data/git/.ssh
+ chmod -R 700 /data/git/.ssh
+ mkdir -p /data/gitea/conf
mkdir: can't create directory '/data/gitea/conf': Permission denied
> ls -la /data/gitea
total 4
dr-x------ 6 1000       1000  82 Feb  4  2021 .
drwxrwx--- 8 1000       1000 102 Aug  6 10:10 ..
drwxrwxr-x 2 1000       1000  21 Aug  6 10:10 conf
-rw-r--r-- 1 1000       1000 106 Jan 27  2021 internal_token
drwxrwxr-x 2 1000       1000   6 Dec  8  2020 log
drwxr-xr-x 3 1000 4294967294  16 Feb  4  2021 public
drwxr-xr-x 3 1000 4294967294  20 Feb  4  2021 templates

It seems gitea removed writable flag from /data/gitea directory, so on next start it can't create existing /data/gitea/conf directory

I get the following error while upgrading (replace gitea container): ``` + mkdir -p /data/git/.ssh + chmod -R 700 /data/git/.ssh + mkdir -p /data/gitea/conf mkdir: can't create directory '/data/gitea/conf': Permission denied ``` ``` > ls -la /data/gitea total 4 dr-x------ 6 1000 1000 82 Feb 4 2021 . drwxrwx--- 8 1000 1000 102 Aug 6 10:10 .. drwxrwxr-x 2 1000 1000 21 Aug 6 10:10 conf -rw-r--r-- 1 1000 1000 106 Jan 27 2021 internal_token drwxrwxr-x 2 1000 1000 6 Dec 8 2020 log drwxr-xr-x 3 1000 4294967294 16 Feb 4 2021 public drwxr-xr-x 3 1000 4294967294 20 Feb 4 2021 templates ``` It seems gitea removed writable flag from `/data/gitea` directory, so on next start it can't create existing `/data/gitea/conf` directory
viceice commented 2021-08-06 08:14:22 +00:00 (Migrated from gitea.com)
Happens here: https://gitea.com/gitea/helm-chart/src/branch/master/templates/gitea/init.yaml#L29
viceice commented 2021-08-06 08:31:29 +00:00 (Migrated from gitea.com)

Ha, gitea entrypoint modifies GITEA_CUSTOM

# Prepare custom folder
mkdir -p ${GITEA_CUSTOM} && chmod 0500 ${GITEA_CUSTOM}

067d82b5a6/docker/rootless/usr/local/bin/docker-setup.sh (L8)

Ha, gitea entrypoint modifies `GITEA_CUSTOM` ```bash # Prepare custom folder mkdir -p ${GITEA_CUSTOM} && chmod 0500 ${GITEA_CUSTOM} ``` https://github.com/go-gitea/gitea/blob/067d82b5a6eb223ff6f6bfa1755e0a2c5bab1d3f/docker/rootless/usr/local/bin/docker-setup.sh#L8
viceice commented 2021-08-06 09:09:08 +00:00 (Migrated from gitea.com)

Workaround:

initPreScript: |
  [ -d /data/gitea ] && chmod 700 /data/gitea
Workaround: ```yaml initPreScript: | [ -d /data/gitea ] && chmod 700 /data/gitea ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lunny/helm-chart#210
No description provided.