cytopia / cytopia/devilbox

[Bug]: Cannot run nvm install due to /opt/nvm permissions

Open
#978 3 comments 2 reactions 1 assignee Claimed by @cytopia View on GitHub
bug triage
Dominant language
PHP
Stars
4.5k
Forks
652
PR merge metrics
No merged PRs in 30d

Description

### Have you already looked into this bug?

- [x] I have checked the [Troubleshooting Guide](https://devilbox.readthedocs.io/en/latest/support/troubleshooting.html)
- [x] I have checked [Release notes](https://github.com/cytopia/devilbox/releases) for potential migration steps
- [x] I have checked [existing issues](https://github.com/cytopia/devilbox/issues) for similar bugs
- [x] I have googled this bug already with no luck
- [ ] I have not done any of the above

### (Optional) Error message

mkdir: cannot create directory ‘/opt/nvm/.cache’: Permission denied

### What went wrong?

When I run `nvm install` in the container shell, it fails because of `/opt/nvm` permissions.

### Expected behaviour

I expect for the specified nvm version to be installed.

### How can we reproduce the bug?

1. Connect to container shell
2. Run `nvm install n` (where n is any version number)

### Host Operating System

Linux

### Host Platform (amd64, arm64, other)

amd64

### (Linux only) Is SELinux enabled?

Yes, SELinux is enabled

### Docker version

Docker version 20.10.23, build 7155243

### Docker Compose version

Docker Compose version v2.15.1

### Devilbox version

latest master

### Have you removed stopped containers before starting?

Yes

### Have you pulled latest Docker images before starting?

Yes

### Devilbox start command

docker-compose up

### Config: .env file

```shell
DEBUG_ENTRYPOINT=2
DOCKER_LOGS=0
DEVILBOX_PATH=.
LOCAL_LISTEN_ADDR=
TLD_SUFFIX=dvl.to
EXTRA_HOSTS=
NEW_UID=1000
NEW_GID=1000
TIMEZONE=UTC
DNS_CHECK_TIMEOUT=1
DEVILBOX_UI_SSL_CN=localhost,*.localhost,devilbox,*.devilbox,httpd
DEVILBOX_UI_PROTECT=0
DEVILBOX_UI_PASSWORD=password
DEVILBOX_UI_ENABLE=1
DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN=1
DEVILBOX_VENDOR_PHPPGADMIN_AUTOLOGIN=1
DEVILBOX_HTTPD_MGMT_USER=supervisord
DEVILBOX_HTTPD_MGMT_PASS=mypassword
PHP_SERVER=8.1
HTTPD_FLAVOUR=alpine
HTTPD_SERVER=nginx-stable
MYSQL_SERVER=mariadb-10.6
PGSQL_SERVER=14-alpine
REDIS_SERVER=6.2-alpine
MEMCD_SERVER=1.6-alpine
MONGO_SERVER=5.0
MOUNT_OPTIONS=
HOST_PATH_HTTPD_DATADIR=./data/www
HOST_PATH_BACKUPDIR=./backups
HOST_PATH_SSH_DIR=~/.ssh
PHP_MODULES_ENABLE=
PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole,psr,phalcon
PHP_MAIL_CATCH_ALL=2
HOST_PORT_HTTPD=80
HOST_PORT_HTTPD_SSL=443
HTTPD_HTTP2_ENABLE=1
HTTPD_VHOST_SSL_TYPE=both
HTTPD_DOCROOT_DIR=htdocs
HTTPD_TEMPLATE_DIR=.devilbox
HTTPD_BACKEND_TIMEOUT=180
HTTPD_NGINX_WORKER_PROCESSES=auto
HTTPD_NGINX_WORKER_CONNECTIONS=1024
MYSQL_ROOT_PASSWORD=
HOST_PORT_MYSQL=3306
PGSQL_ROOT_USER=postgres
PGSQL_ROOT_PASSWORD=
PGSQL_HOST_AUTH_METHOD=trust
HOST_PORT_PGSQL=5432
HOST_PORT_REDIS=6379
REDIS_ARGS=
HOST_PORT_MEMCD=11211
HOST_PORT_MONGO=27017
HOST_PORT_BIND=1053
BIND_DNS_RESOLVER=8.8.8.8,8.8.4.4
BIND_DNSSEC_VALIDATE=no
BIND_TTL_TIME=
BIND_REFRESH_TIME=
BIND_RETRY_TIME=
BIND_EXPIRY_TIME=
BIND_MAX_CACHE_TIME=
BIND_LOG_DNS_QUERIES=0
```

### Config: docker-compose.override.yml

_No response_

### Config: ./check-config.sh

```shell
# ==============================================================================
# Checking git
# ==============================================================================
[SUCC] git is clean

# ==============================================================================
# Checking .env file
# ==============================================================================
[SUCC] .env file exists
[SUCC] .env file is readable
[SUCC] All variables are present in .env file
[SUCC] No variables is duplicated in .env file

# ==============================================================================
# Checking .env file values
# ==============================================================================
[SUCC] All .env file variables have correct values

# ==============================================================================
# Checking required Devilbox core directories exist
# ==============================================================================
[SUCC] All PHP cfg/ sub directories are present
[SUCC] All PHP log/ sub directories are present
[SUCC] All HTTPD cfg/ sub directories are present
[SUCC] All HTTPD log/ sub directories are present

# ==============================================================================
# Checking devilbox core directory permissions
# ==============================================================================
[SUCC] All devilbox directories have correct permissions
[SUCC] All devilbox directories have correct uid
[SUCC] All devilbox directories have correct gid

# ==============================================================================
# Checking devilbox core file permissions
# ==============================================================================
[SUCC] All devilbox files have correct permissions
[SUCC] All devilbox files have correct uid
[SUCC] All devilbox files have correct gid

# ==============================================================================
# Checking projects permissions
# ==============================================================================
[SUCC] All project dirs have correct permissions
[SUCC] All project dirs have correct uid
[SUCC] All project dirs have correct gid

# ==============================================================================
# Checking projects settings
# ==============================================================================
[SUCC] All projects have valid DNS records
[SUCC] All projects have valid HTTPD_DOCROOT_DIR

# ==============================================================================
# Checking customizations
# ==============================================================================
[INFO] No custom configurations applied

# ==============================================================================
# SUMMARY
# ==============================================================================
[SUCC] Found no errors
[INFO] No custom configurations applied
[INFO] Ensure to run 'docker-compose stop; docker-compose rm -f' on .env changes or custom configs
```

### Log: docker-compose logs

```shell
Couldn't submit bug due to output length. Please specify which portion is required.
```

### (Optional) Additional information

I found issue #499 and see that a fix was released, but the error is occurring regardless. The workaround from that issue thread (`sudo chmod -R 777 /opt/nvm`) works in this case.

In case it's relevant: the host OS is Windows 10 but Docker is running in WSL2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.