shadowsocks: Fix shadowsocks service not starting
This is a continuation of fix by @nektarioskatakis-guest in !1743 (closed). I found an additional problem that directory /var/lib/shadowsocks-libev/freedombox is getting created in Buster because we set StateDirectory= without setting DynamicUser=yes.
This MR include fix for that, some changes to original MR and yet another fix.
Tests performed:
- On Unstable:
- Install fresh using changes. Daemon is running after install. Server is 127.0.0.1. Password is 12 chars in length.
- /var/lib/shadowsocks-libev/freedombox is not a directory but a symlink to /var/lib/private/shadosocks-libev/freedombox.
- Update the configuration. Configuration changes are reflected and shadowsocks is still running.
- Disable shadowsocks. Update the configuration. shadowsocks is not running.
- Shadowsocks is not running a root but with a large UID.
- Install from master. Shadowsocks is running but configuration changes fail. Upgrade to changes in the branch. Configuration can be set and shadowsocks is restarted.
- Install from v20.3.
- On stable:
- Fresh install using master. Shadowsocks is not running. Updating configuration results in 500 error. /var/lib/shadowsocks-libev/freedombox is a directory. Update to changes in the branch. /var/lib/shadowsocks-libev/freedombox is not a directory but a symlink to /var/lib/private/shadosocks-libev/freedombox. Shadowsocks is not running a root but with a large UID. Update the configuration. Configuration changes are reflected and shadowsocks is still running.
- Fresh install using v20.3. Shadowsocks is running. Updating configuration works. Update to the changes in the branch. Configuration is retained. /var/lib/shadowsocks-libev/freedombox is not a directory but a symlink to /var/lib/private/shadosocks-libev/freedombox. Shadowsocks is not running a root but with a large UID. Update the configuration. Configuration changes are reflected and shadowsocks is still running.
- Enable preference for installing shadowsocks-libev from backports. Run unattended upgrades. Latest shadowsocks is running after a restart.
- Fresh install using changes in the branch. /var/lib/shadowsocks-libev/freedombox is not a directory but a symlink to /var/lib/private/shadosocks-libev/freedombox. Shadowsocks is not running a root but with a large UID. Update the configuration. Configuration changes are reflected and shadowsocks is still running.