dokku / dokku-postgres

a postgres plugin for dokku

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

got permission denied message while using dokku:apps create xxx

Anonymous6214 opened this issue · comments

Same from: #176

Description of problem

dokku always have no permission create folder in /var/lib/dokku/xxx
even when using sudo or root account

How reproducible

Steps to Reproduce

1.use os: manjaro
2.install dokku
3.execute dokku:apps create xxx

Actual Results

 !     Unable to create network config directory for ledokku: mkdir /var/lib/dokku/config/network: permission denied
 !     Unable to create ps config directory for ledokku: mkdir /var/lib/dokku/config/ps: permission denied

And here is the output while typing ls -lah /var/lib/dokku:

drwxr-xr-x  6 root  root  4.0K  1/ 12 18:41 .
drwxr-xr-x 44 root  root  4.0K  1/ 12 18:35 ..
drwxr-xr-x  2 root  root  4.0K  1/ 12 18:41 config
drwxr-xr-x  4 dokku dokku 4.0K  1/ 12 17:54 core-plugins
drwxr-xr-x  3 dokku dokku 4.0K  1/ 12 18:48 data
drwxr-xr-x  4 dokku dokku 4.0K  1/ 12 17:54 plugins
-rw-r--r--  1 root  root     7  1/ 12 17:53 VERSION

Expected Results

it should create the folder

Environment Information

see dokku report

dokku report output

This is required! Issues missing this information may be closed.

-----> uname: Linux server 5.15.12-1-MANJARO #1 SMP PREEMPT Wed Dec 29 18:08:07 UTC 2021 x86_64 GNU/Linux
-----> memory: 
                      total        used        free      shared  buff/cache   available
       Mem:            2964        1261         226          52        1477        1463
       Swap:           6522         170        6351
-----> docker version: 
       Client:
        Version:           20.10.12
        API version:       1.41
        Go version:        go1.17.5
        Git commit:        e91ed5707e
        Built:             Mon Dec 13 22:31:40 2021
        OS/Arch:           linux/amd64
        Context:           default
        Experimental:      true
       
       Server:
        Engine:
         Version:          20.10.12
         API version:      1.41 (minimum version 1.12)
         Go version:       go1.17.5
         Git commit:       459d0dfbbb
         Built:            Mon Dec 13 22:30:43 2021
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          v1.5.8
         GitCommit:        1e5ef943eb76627a6d3b6de8cd1ef6537f393a71.m
        runc:
         Version:          1.0.3
         GitCommit:        v1.0.3-0-gf46b6ba2
        docker-init:
         Version:          0.19.0
         GitCommit:        de40ad0
-----> docker daemon info: 
       Client:
        Context:    default
        Debug Mode: true
        Plugins:
         buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
         scan: Docker Scan (Docker Inc., v0.1.0-225-ge13563704f)
       
       Server:
        Containers: 0
         Running: 0
         Paused: 0
         Stopped: 0
        Images: 2
        Server Version: 20.10.12
        Storage Driver: overlay2
         Backing Filesystem: extfs
         Supports d_type: true
         Native Overlay Diff: false
         userxattr: false
        Logging Driver: json-file
        Cgroup Driver: systemd
        Cgroup Version: 2
        Plugins:
         Volume: local
         Network: bridge host ipvlan macvlan null overlay
         Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
        Swarm: inactive
        Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: 1e5ef943eb76627a6d3b6de8cd1ef6537f393a71.m
        runc version: v1.0.3-0-gf46b6ba2
        init version: de40ad0
        Security Options:
         apparmor
         seccomp
          Profile: default
         cgroupns
        Kernel Version: 5.15.12-1-MANJARO
        Operating System: Manjaro Linux
        OSType: linux
        Architecture: x86_64
        CPUs: 2
        Total Memory: 2.895GiB
        Name: server
        ID: HBJX:SSVV:5BLX:6Z3H:4YQU:2TAN:5NLB:4C3F:GFJW:G4GO:4FCM:CSTB
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
        Registry: https://index.docker.io/v1/
        Labels:
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false
       
-----> git version: git version 2.34.1
-----> sigil version: 0.7.1build+1ec3006
-----> herokuish version: 
       herokuish: 0.5.33
       buildpacks:
         heroku-buildpack-multi     v1.0.0
         heroku-buildpack-ruby      v232
         heroku-buildpack-nodejs    v189
         heroku-buildpack-clojure   v87
         heroku-buildpack-python    v204
         heroku-buildpack-java      v69
         heroku-buildpack-gradle    v35
         heroku-buildpack-scala     v91
         heroku-buildpack-play      v26
         heroku-buildpack-php       v201
         heroku-buildpack-go        v157
         heroku-buildpack-nginx     v15
         buildpack-null             v3
-----> dokku version: dokku version 0.26.5
-----> plugn version: plugn: 0.7.1build+9bf216b
-----> dokku plugins: 
         00_dokku-standard    0.26.5 enabled    dokku core standard plugin
         20_events            0.26.5 enabled    dokku core events logging plugin
         app-json             0.26.5 enabled    dokku core app-json plugin
         apps                 0.26.5 enabled    dokku core apps plugin
         builder              0.26.5 enabled    dokku core builder plugin
         builder-dockerfile   0.26.5 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.26.5 enabled    dokku core builder-herokuish plugin
         builder-null         0.26.5 enabled    dokku core builder-null plugin
         builder-pack         0.26.5 enabled    dokku core builder-pack plugin
         buildpacks           0.26.5 enabled    dokku core buildpacks plugin
         certs                0.26.5 enabled    dokku core certificate management plugin
         checks               0.26.5 enabled    dokku core checks plugin
         common               0.26.5 enabled    dokku core common plugin
         config               0.26.5 enabled    dokku core config plugin
         cron                 0.26.5 enabled    dokku core cron plugin
         docker-options       0.26.5 enabled    dokku core docker-options plugin
         domains              0.26.5 enabled    dokku core domains plugin
         enter                0.26.5 enabled    dokku core enter plugin
         git                  0.26.5 enabled    dokku core git plugin
         logs                 0.26.5 enabled    dokku core logs plugin
         network              0.26.5 enabled    dokku core network plugin
         nginx-vhosts         0.26.5 enabled    dokku core nginx-vhosts plugin
         plugin               0.26.5 enabled    dokku core plugin plugin
         proxy                0.26.5 enabled    dokku core proxy plugin
         ps                   0.26.5 enabled    dokku core ps plugin
         registry             0.26.5 enabled    dokku core registry plugin
         repo                 0.26.5 enabled    dokku core repo plugin
         resource             0.26.5 enabled    dokku core resource plugin
         run                  0.26.5 enabled    dokku core run plugin
         scheduler            0.25.6 enabled    dokku core scheduler plugin
         scheduler-docker-local 0.26.5 enabled    dokku core scheduler-docker-local plugin
         scheduler-null       0.26.5 enabled    dokku core scheduler-null plugin
         shell                0.26.5 enabled    dokku core shell plugin
         ssh-keys             0.26.5 enabled    dokku core ssh-keys plugin
         storage              0.26.5 enabled    dokku core storage plugin
         trace                0.26.5 enabled    dokku core trace plugin

For problems affecting all applications, the report output for a broken application is useful for our debugging.
In these cases, you may run dokku report without any arguments to display the top-level reporting information.

How (deb/make/rpm) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:

using yay -S dokku and installed on manjaro's pc(my pc)

Additional information

ls -lah /var/lib/dokku output:

drwxr-xr-x  6 root  root  4.0K  1/ 12 18:41 .
drwxr-xr-x 44 root  root  4.0K  1/ 12 18:35 ..
drwxr-xr-x  2 root  root  4.0K  1/ 12 18:41 config
drwxr-xr-x  4 dokku dokku 4.0K  1/ 12 17:54 core-plugins
drwxr-xr-x  3 dokku dokku 4.0K  1/ 12 18:48 data
drwxr-xr-x  4 dokku dokku 4.0K  1/ 12 17:54 plugins
-rw-r--r--  1 root  root     7  1/ 12 17:53 VERSION

dokku trace:on output:

+ export DOKKU_HOST_ROOT=/home/dokku
+ DOKKU_HOST_ROOT=/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo manjaro
+ DOKKU_DISTRO=manjaro
+ export DOCKER_BIN=docker
+ DOCKER_BIN=docker
+ export DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ DOKKU_IMAGE=gliderlabs/herokuish:latest-20
+ export DOKKU_CNB_BUILDER=heroku/buildpacks
+ DOKKU_CNB_BUILDER=heroku/buildpacks
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_SYSTEM_GROUP=dokku
+ DOKKU_SYSTEM_GROUP=dokku
+ export DOKKU_SYSTEM_USER=dokku
+ DOKKU_SYSTEM_USER=dokku
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_PID=203747
+ DOKKU_PID=203747
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export 'DOKKU_GLOBAL_BUILD_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_BUILD_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ export 'DOKKU_GLOBAL_RUN_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_RUN_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args apps:create ledokku
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=('apps:create' 'ledokku')
+ local args
+ local flags
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ apps:create == \-\-\a\p\p ]]
+ [[ apps:create =~ ^--.* ]]
+ next_index=2
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ ledokku == \-\-\a\p\p ]]
+ [[ ledokku =~ ^--.* ]]
+ next_index=3
+ [[ -z '' ]]
++ sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
++ echo -e ''
+ export DOKKU_GLOBAL_FLAGS=
+ DOKKU_GLOBAL_FLAGS=
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ apps:create =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
+ [[ '' == \t\r\u\e ]]
++ LC_ALL=C
++ /usr/bin/tty
+ [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ apps:create =~ ^plugin:.* ]]
+ [[ apps:create == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ apps:create == \s\s\h\-\k\e\y\s\:\r\e\m\o\v\e ]]
+ [[ -n '' ]]
+ dokku_auth apps:create ledokku
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=admin
+ SSH_USER=admin
+ export SSH_NAME=default
+ SSH_NAME=default
++ wc -l
++ find /var/lib/dokku/plugins/enabled/20_events/user-auth
+ local user_auth_count=1
+ [[ 1 == 0 ]]
+ [[ 1 == 1 ]]
+ [[ -f /var/lib/dokku/plugins/enabled/20_events/user-auth ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd apps:create ledokku
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=apps:create
+ local PLUGIN_CMD=apps:create
+ local implemented=0
+ local script
+ argv=('apps:create' 'ledokku')
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/apps
+ [[ /var/lib/dokku/core-plugins/available/apps == *core-plugins* ]]
+ [[ apps:create == \a\p\p\s\:\c\r\e\a\t\e ]]
+ shift 1
+ [[ -n '' ]]
+ set -- apps:create ledokku
+ [[ -x /var/lib/dokku/plugins/enabled/apps:create/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/apps:create/subcommands/apps:create ]]
+ [[ -x /var/lib/dokku/plugins/enabled/apps/subcommands/create ]]
+ [[ -n create ]]
+ /var/lib/dokku/plugins/enabled/apps/subcommands/create apps:create ledokku
-----> Creating ledokku...
 ?     plugn trigger post-create [ledokku]
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
++ source /var/lib/dokku/core-plugins/available/common/property-functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ set -eo pipefail
+ [[ -n 1 ]]
+ set -x
+ trigger-git-post-create ledokku
+ declare 'desc=initializes an app with the correct git repository structure'
+ declare trigger=post-create
+ declare APP=ledokku
+ fn-git-create-hook ledokku
+ declare APP=ledokku
+ local APP_PATH=/home/dokku/ledokku
+ local PRERECEIVE_HOOK=/home/dokku/ledokku/hooks/pre-receive
+ [[ ! -d /home/dokku/ledokku/refs ]]
+ suppress_output git init -q --bare /home/dokku/ledokku
+ declare 'desc=suppress all output from a given command unless there is an error'
+ local TMP_COMMAND_OUTPUT
++ mktemp /tmp/dokku-203747-suppress_output.XXXXXX
+ TMP_COMMAND_OUTPUT=/tmp/dokku-203747-suppress_output.dfOWSD
+ trap 'rm -rf '\''/tmp/dokku-203747-suppress_output.dfOWSD'\'' >/dev/null' RETURN
+ git init -q --bare /home/dokku/ledokku
+ return 0
++ rm -rf /tmp/dokku-203747-suppress_output.dfOWSD
+ cat
+ chmod +x /home/dokku/ledokku/hooks/pre-receive
++ rm -rf /tmp/dokku-203747-suppress_output.dfOWSD
++ rm -rf /tmp/dokku-203747-suppress_output.dfOWSD
 !     Unable to create network config directory for ledokku: mkdir /var/lib/dokku/config/network: permission denied
 !     Unable to create ps config directory for ledokku: mkdir /var/lib/dokku/config/ps: permission denied
2022/01/12 19:09:52 exit status 1
 !     exit status 1

Dunno how you got it into this state, but the config directory should be recursively owned by dokku.

sudo chown -R dokku:dokku /var/lib/dokku/config