I am struggling with permissions problems not running my syncthing docker container under root. When I go in the container as user abc (the user starting my docker container) it gives me below error when I start syncthing in the container:
[monitor] 2023/02/22 14:40:32 WARNING: Error starting the main Syncthing process: open /dev/null: permission denied
panic: Error starting the main Syncthing process
Checking per missions for /dev/null it is root/root. So with that syncthing does not get started when the container is not started under the root account on the host.
/dev/null is used for redirecting unwanted output. It’s normally group readable and writable so the “permission denied” is odd (why the container and/or Syncthing is trying to change the permissions is also curious).
What is your docker-compose .yaml file or command-line parameters look like?
It is now started with root and runs with no issues. But when I start it with another user, user 1000. Then it does not start correctly. When I go into the container and start syncthing manually (with user account 1000). It immediately give below error message
[monitor] 2023/02/22 14:40:32 WARNING: Error starting the main Syncthing process: open /dev/null: permission denied panic: Error starting the main Syncthing process
When I do into the container as root I can start Syncthing manually with no problem.
Now it runs fine with root. But when I start it with user 1000 then it doe sniot start. When I go into the contrainer with user 1000 and start Syncthing manually it gives below error:
[monitor] 2023/02/22 14:40:32 WARNING: Error starting the main Syncthing process: open /dev/null: permission denied panic: Error starting the main Syncthing process
I can start Syncthing manually in the container with root.
There’s lots of hits on the internet for “docker permission denied /dev/null”. Maybe look into this; this looks like a Docker or system problem, not really a Syncthing issue. Also, the linuxserver/syncthing image does a lot of magic on startup, maybe try our image instead to see if it makes a difference (though honestly I don’t think that’s the problem).
I have now started this Syncthing docker container in privileged mode. And then it runs nicely. So the container is now not started as root anymore but in privileged mode in docker.
So this was a docker issue and not a Syncthing issue.