Forum archive
Syncthing doesn't start after adding LXC id mapping
I'm using the Syncthing image as an LXC container.
As soon as I add an lxc.idmap - like, any mapping - the container starts, but the webui is erroring out with 502. I'm trying to idmap the syncthing user, but basically setting any kind of idmap causes this.
The weird thing is, that running the syncthing command seemingly starts the app normally, but the webui is still not available and syncing doesn't happen. Id mapping shouldn't have any effect on the container itself...
Is there any error log I can look at?
lxc.idmap = u 0 100000 999 lxc.idmap = g 0 100000 999 lxc.idmap = u 999 1000 1 lxc.idmap = g 999 1000 1 lxc.idmap = u 1000 101000 64535 lxc.idmap = g 1000 101000 64535
It seems like perhaps the user ID mapping is not working as it should? I recommend checking the UID of the 'syncthing' user within the container both with the UID mapping and without. In theory, it shouldn't change within the container, but perhaps it is somehow/has for some reason? Perhaps a bug in LXC?
I.e. double check permissions of /home/syncthing/.config/:
Check to see who owns it. Then double check that against the UID noted for the syncthing user:
[update] I've had a closer look at lxd.idmap and TBH, I'm more confused... Without knowing about exactly what you are trying to achieve, I can't be sure whether it's working as intended or not?! Also I'm not super familiar with the inner working of LXC. Perhaps you could share what you are actually trying to do with the user remapping? Understanding that and the UIDs within and outside the container might make it clearer? IIRC the syncthing user is a "system" user so should have a UID somewhere between ~100 - 999. So let's lay out what I think your conf is meant to do. To simplify, let's just look at your user mapping (note my understanding is from the lxc.container.conf man page so perhaps I've misunderstood something?).
So the first line is mapping container UIDs from 0-999 to host UIDs 100000-100999. Then the next line is mapping container UID 999 to host UID 1000. Then the final line is mapping container UIDs 1000-65535 to host UIDs 101000-166535. I wonder if the internal UID 999 being mapped twice is causing the issue? I would expect the later mapping would overwrite the former, but perhaps not?