[Snap][Service]Service in snap can not work, because there is no default path of config file
yangyankui opened this issue · 16 comments
there is no default path of config file,
therefore i can not use
snap start shadowsocks-rust.ssserver-daemon
debian 10,
snap,
shadowsocks-rust edge v1.11.2.r34.gf717984
You can use arguments as a temporary solution. Ref #617.
shadowsocks-rust.ssserver -s "0.0.0.0:8388" -m "aes-256-gcm" -k "********"
Thank you!
Now, I am using
shadowsocks-rust.ssserver -c config.json
Is there any plan to support the default path?
Hope to add the function of the default path of config file.
Is there any plan to support the default path?
Hope to add the function of the default path of config file.
Unfortunately, I don't have a build environment for snap.
If you keep this issue open, other collaborators may be able to fix it.
Ok, Thank you!
I recommend to set the default path to ~/.config/shadowsocks-rust
.
shadowsocks-libev default path is /etc/shadowsocks-libev/config.json
Why snap's daemon couldn't start with command line arguments?
shadowsocks-libev default path is
/etc/shadowsocks-libev/config.json
The snap default only allow application to access path under $HOME
, unless the application is installed using the --classic
parameter.
Same problem here. It seems snap version can't automatically read configure file via a default or designated path as in Shadowsocks-libev. Neither can it pass parameters to its daemon service when invoking systemctl. Both of these methods are not currently working in the snap store version.
It should already supported in the latest version:
shadowsocks-rust/bin/common/config.rs
Lines 7 to 44 in 1eff9b1
ref #688
The issue still exists with channels like stable and edge, but I can't see the snapcraft build logs. If edge is the latest image, then this issue may still be unresolved.
kallydev@ubuntu:~$ sudo snap install shadowsocks-rust --edge
shadowsocks-rust (edge) v1.12.2.r12.g1eff9b1 from DuckSoft installed
kallydev@ubuntu:~$ shadowsocks-rust.ssserver --version
shadowsocks 1.12.3
kallydev@ubuntu:~$ cat .config/shadowsocks-rust/config.json
{
"server": "127.0.0.1",
"server_port": 8388,
"password": "password",
"method": "aes-256-gcm"
}
kallydev@ubuntu:~$ shadowsocks-rust.ssserver
missing proxy servers, consider specifying it by --server-addr, --encrypt-method, --password command line option, or configuration file, check more details in https://shadowsocks.org/en/config/quick-guide.html
USAGE:
ssserver [FLAGS] [OPTIONS]
Please try again with the global configuration path /etc/shadowsocks-rust/config.json
Please try again with the global configuration path
/etc/shadowsocks-rust/config.json
kallydev@ubuntu:~$ sudo vim /etc/shadowsocks-rust/config.json
kallydev@ubuntu:~$ shadowsocks-rust.ssserver
missing proxy servers, consider specifying it by --server-addr, --encrypt-method, --password command line option, or configuration file, check more details in https://shadowsocks.org/en/config/quick-guide.html
USAGE:
ssserver [FLAGS] [OPTIONS]
This should be because the image does not have permission to read these configuration files.
kallydev@ubuntu:~$ shadowsocks-rust.ssserver -c .config/shadowsocks-rust/config.json
loading config ".config/shadowsocks-rust/config.json", error while reading file, Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
kallydev@ubuntu:~$ shadowsocks-rust.ssserver -c /etc/
Display all 230 possibilities? (y or n)
kallydev@ubuntu:~$ shadowsocks-rust.ssserver -c /etc/shadowsocks-rust/config.json
loading config "/etc/shadowsocks-rust/config.json", error while reading file, Os { code: 2, kind: NotFound, message: "No such file or directory" }
I don't understand why snap's home
permissions can't access $HOME/.config/shadowsocks-rust/config.json
, but it can access $HOME/config.json
.
Ref https://snapcraft.io/docs/home-interface, only "non-hidden files" can be accessed.
The home interface allows access to non-hidden files owned by the user in the user’s home ($HOME) directory where a user normally stores their personal files and documents.
kallydev@ubuntu:~$ shadowsocks-rust.ssserver -c ~/config.json
2021-11-25T17:37:52.484976149-08:00 INFO shadowsocks server 1.12.3 build 2021-11-25T16:55:04.297088322+00:00
2021-11-25T17:37:52.486770036-08:00 INFO shadowsocks tcp server listening on 127.0.0.1:8388, inbound address 127.0.0.1:8388
It's OK.
shadowsock-rust v1.12.2.r12.g1eff9b1 edge
config.json :
{
"address": "0.0.0.0",
"port": 8388,
"password": "password",
"method": "chacha20-ietf-poly1305"
}
root@localhost:~#snap install shadowsocks-rust --edge
root@localhost:~#cp config.json /var/snap/shadowsocks-rust/common/etc/shadowsocks-rust/config.json
root@localhost:~#snap start --enable shadowsocks-rust.ssserver-daemon
We can completely resolve the $HOME/.config/shadowsocks-rust
permissions issue using https://snapcraft.io/docs/personal-files-interface, but this needs to be done via https://snapcraft.io/docs/process-for-aliases-auto-connections-and-tracks.
So, I just reviewed qv2ray's solution, then replaced $HOME/.config/shadowsocks-rust/config.json
with $HOME/snap/shadowsocks-rust/common/.config/shadowsocks-rust/config.json
, which successfully bypasses the issue.
kallydev@ubuntu:~$ shadowsocks-rust.ssserver -c ./snap/shadowsocks-rust/common/.config/shadowsocks-rust/config.json
2021-11-25T18:30:58.789058481-08:00 INFO shadowsocks server 1.12.3 build 2021-11-25T16:55:04.297088322+00:00
2021-11-25T18:30:58.790422140-08:00 INFO shadowsocks tcp server listening on 127.0.0.1:8388, inbound address 127.0.0.1:8388
Of course, I think /var/snap/shadowsocks-rust/common/etc/shadowsocks-rust/config.json
is also good, because fa3a2a8 makes managing profiles much easier than before.