mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-26 01:45:54 +03:00
[GH-ISSUE #4205] Container will not restart due to chmod operation not permitted. Only works after a fresh install. #2722
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#2722
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AlvaroMartinezB on GitHub (Dec 3, 2024).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/4205
Checklist
jc21/nginx-proxy-manager:latestdocker image?Describe the bug
The NPM container will not start after restarting the docker engine for any reason. It works fine on a fresh install, but fails to start after any restart. The error happens during "Setting ownership ..."
2.12.1 (lastest)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
NPM should start with no issues.
Screenshots
Operating System
Ubuntu 24.04.1
Additional context
Here are the terminal logs:
npm-app-1 | ❯ Configuring npm user ...
npm-app-1 | 0
npm-app-1 | usermod: no changes
npm-app-1 | ❯ Configuring npm group ...
npm-app-1 | ❯ Checking paths ...
npm-app-1 | ❯ Setting ownership ...
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-1/cert.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-1/chain.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-1/fullchain.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-1/privkey.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-2/cert.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-2/chain.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-2/fullchain.pem': Operation not permitted
npm-app-1 | chown: changing ownership of '/etc/letsencrypt/live/npm-2/privkey.pem': Operation not permitted
npm-app-1 | s6-rc: warning: unable to start service prepare: command exited 1
npm-app-1 | /run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
@VividDocument7 commented on GitHub (Dec 3, 2024):
Same issue here except I can't even install it. It just won't run at all
@suprexus commented on GitHub (Dec 5, 2024):
Same here.
Work around for me was to change permissions of the letsencrypt/live directory on the host itself.
sudo chmod -R 775 letsencrypt_dir/live
Survives container restarts after that.
@sonpeter88 commented on GitHub (Dec 16, 2024):
I have the same issue.
sudo chmopd -R 775 /livedoesn't seem to work for me
@suprexus commented on GitHub (Dec 16, 2024):
Check your path - /live doesn't seem correct. Check your docker config to see where you're saving the letsencrypt files.
sudo chmod -R 775 letsencrypt_dir/live
@sonpeter88 commented on GitHub (Dec 16, 2024):
The path seems correct. I just ommitted putting in letsencrypt_dir since it's different for everyone. the live folder has the application folder with pem files within it.
the files have rwx permissions
@suprexus commented on GitHub (Dec 16, 2024):
Gotcha - What user owns the directory? If you're specifying a PUID in your docker compose file, it should be the same user.
@sonpeter88 commented on GitHub (Dec 16, 2024):
I actually tried specifying user/group (1000:1000) in my docker compose but it got angry that it has to run as root so i assume my docker is already running as root.
ls -al in letsencrypt_dir/live/npm-3 folder shows
lrwxrwxrwx1 peter peter
which is uid=1000 and gid=1000
@jaysee260 commented on GitHub (Dec 17, 2024):
In the same boat as @sonpeter88 ...
sudo chmod -R 775 /path/to/letsencrypt/livein my host machine doesn't seem to work either 😞 .@sonpeter88 commented on GitHub (Dec 18, 2024):
okay I figured out a way to get it to work. The files in live folder are symlinks to the ../../archive/ folders and aren't happy when you try to chmod them on my ubuntu machine. I deleted all the symlinks in the live folder, and directly copied the pem files from the archive folder. Once I've done that and gave the files the correct permission, the container was able to restart fine.
Thanks for the tip @suprexus
@jaysee260 commented on GitHub (Dec 19, 2024):
heh, really nice catch @sonpeter88 ... thanks, I tried it and this works!
@jaysee260 commented on GitHub (Dec 20, 2024):
Hate to report this, but this doesn't really seem to be a stable/lasting solution...
*.pemfiles.I'm sure I was using the right credentials, I have them written down. Would straight up just fail authentication. I got so frustrated I just restarted everything from scratch. If it happens again, I'll capture logs and share.
Anyway, this seems like a temporary workaround at best.
@suprexus commented on GitHub (Dec 20, 2024):
I didn't change the symlinks - What I probably did do was change the permissions on the entire npm directory to include the ../../archive/. Try recreating the symlinks and chmod the entire directory.
@jaysee260 commented on GitHub (Dec 21, 2024):
@suprexus -sigh- that doesn't seem to work, still getting
Even went as far as making sure I set the proper permissions to the entire
letsencryptdirectory withsudo chmod -R 775 /path/to/letsencrypt.The only thing that's "worked" so far is @sonpeter88's suggestion to remove the symlinks and copy the
*.pemfiles from../../archive, but as pointed out earlier, that solution is unstable, and causes other issues.Will keep digging...
@suprexus commented on GitHub (Dec 21, 2024):
What permissions are set on ../../archive/npm-1/
ls -la archive/npm-1/
are you running the container as a certain user?
@jaysee260 commented on GitHub (Dec 22, 2024):
not another user than the one I usually use... as far as I'm aware?
same user I am running
docker compose up -dwith.I ran
docker inspect $(docker ps -q), and under theConfigsection of this container, I see the following for"User"@jaysee260 commented on GitHub (Dec 22, 2024):
So, I was able to confirm this ONLY happens if you generate an SSL certificate. Otherwise, you can restart, destroy/recreate the container all day long, and it runs fine.
I can't quite figure out what it is about the container restarting or getting recreated that causes the cert files to become inaccessible...
Line 13 of this script is what changes the permissions of the
letsencryptdirectory (inside the container) on container start up... Why does it only work the first time? 🤔@mr-prez commented on GitHub (Jan 1, 2025):
I was able to "solve the issue" by simply using jlesage/docker-nginx-proxy-manager. Apparently the only real differences are using ports 8080, 8181, and 4443, GUID/UID support that predates the main branch, and nginx runs as non root on non privileged ports.
@dshizntpdt commented on GitHub (Jan 24, 2025):
So in order to get this to work for me i had to edit the file referenced above and comment out the chmod. once i did that it came up normally and i was able to renew a cert without issue.
@dmorsberger commented on GitHub (Mar 29, 2025):
Was this resolved? I changed the symbolic links "ln -s" to hard links "ln". It starts now and not sure if it will work through a cert renewal.
@mateus-werneck commented on GitHub (Jun 11, 2025):
Had the same problem after running
docker system pruneand the only way to fix it was@dmorsberger commented on GitHub (Jun 11, 2025):
I was able to get around the error by modifying and overriding /etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh
Make a local copy by extracting from the Docker container
30-ownership.sh: Use the 'find' command to skip symbolic links when changing ownership
docker-compose.yaml: Overwrite 30-ownership.sh with the bind command
@AlvaroMartinezB commented on GitHub (Jun 13, 2025):
Any chance of this getting merged onto the main branch? I have no idea how to do what you described haha
@AlvaroMartinezB commented on GitHub (Aug 1, 2025):
IT HAS BEEN FIXED!!! Just updated to v2.12.6, because I saw in the changelog that they skipped the Certbot thing... I just updated and my container was able to start again and it's working. Thank you to whoever fixed it!!!