[GH-ISSUE #21] SS fails to bind ipv6 and adding user problem #15

Closed
opened 2026-02-26 12:33:43 +03:00 by kerem · 4 comments
Owner

Originally created by @NAVrasZ on GitHub (Mar 22, 2019).
Original GitHub issue: https://github.com/cbeuw/Cloak/issues/21

  • Upon reboot: ERROR: [udp] bind: Cannot assign requested address
    • (root user systemctl restart shadowsock-libev temporarily resolves this)
  • Does Enter the UID in your ckclient.json as the prompted UID mean the newly generated UID instead?
  • What equals "unlimited" when entering UpRate:DownRate etc.?

System info: Ubuntu 19.04 amd64; Shadowsocks-libev 3.2.5; ipv4+ipv6

What I did:

  1. Made shadowsocks startup daemon run as root: I copied shadowsocks-libev.service from /lib/systemd/system into /etc/systemd/system, changed both User and Group to root. I also added "user": "root" to /etc/shadowsocks-libev/config.json.
    ss-server says "INFO: running from root user" but fails to bind my ipv6 address to udp port 443. It works fine after systemctl restart shadowsock-libev as root user.
  2. Add another user: ( I tried to use AdminUID for both of my pcs, but the second pc soon became unable to connect with status saying "session closed" ) I followed the instructions and entered UID in my ckclient.json at step 4 which is AdminUID, entered all 0 or 0:0:0 for those caps and credits assuming it means unlimited.
    The second pc couldn't connect so I entered the newly generated UID at step 4 instead.
    ...I remember it says something like "connection reset by peer" in the status, but after messing around for a while now it keeps crashing until I turn off shadowsocks on my second pc.
    I set Up/DownCredit for the second UID to 999999999999999 but it still crashes.
root@vultr:~# systemctl status shadowsocks-libev
● shadowsocks-libev.service - Shadowsocks-libev Default Server Service
   Loaded: loaded (/etc/systemd/system/shadowsocks-libev.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2019-03-22 17:53:03 UTC; 1s ago
     Docs: man:shadowsocks-libev(8)
  Process: 1660 ExecStart=/usr/bin/ss-server -c $CONFFILE $DAEMON_ARGS (code=exited, status=255/EXCEPTION)
 Main PID: 1660 (code=exited, status=255/EXCEPTION)

Mar 22 17:53:03 vultr.guest ss-server[1660]:         /home/andy/go/src/github.com/cbeuw/Cloak/internal/server/usermanager/user.go:40 +0x4e
Mar 22 17:53:03 vultr.guest ss-server[1660]: github.com/cbeuw/Cloak/internal/server/usermanager.(*Userpanel).GetAndActivateUser(0xc00004c100, 0xc0000165a0, 0x20, 0x24, 0x20, 0x21, 0xe0c28000)
Mar 22 17:53:03 vultr.guest ss-server[1660]:         /home/andy/go/src/github.com/cbeuw/Cloak/internal/server/usermanager/userpanel.go:158 +0x1cb
Mar 22 17:53:03 vultr.guest ss-server[1660]: main.dispatchConnection(0x5d8c00, 0xc00000e090, 0xc00008c000)
Mar 22 17:53:03 vultr.guest ss-server[1660]:         /home/andy/go/src/github.com/cbeuw/Cloak/cmd/ck-server/ck-server.go:133 +0xcdb
Mar 22 17:53:03 vultr.guest ss-server[1660]: created by main.main.func1
Mar 22 17:53:03 vultr.guest ss-server[1660]:         /home/andy/go/src/github.com/cbeuw/Cloak/cmd/ck-server/ck-server.go:271 +0x2dc
Mar 22 17:53:03 vultr.guest ss-server[1660]:  2019-03-22 17:53:03 ERROR: plugin service exit unexpectedly
Mar 22 17:53:03 vultr.guest systemd[1]: shadowsocks-libev.service: Main process exited, code=exited, status=255/EXCEPTION
Mar 22 17:53:03 vultr.guest systemd[1]: shadowsocks-libev.service: Failed with result 'exit-code'.

Thx

Originally created by @NAVrasZ on GitHub (Mar 22, 2019). Original GitHub issue: https://github.com/cbeuw/Cloak/issues/21 - Upon reboot: `ERROR: [udp] bind: Cannot assign requested address` - (root user `systemctl restart shadowsock-libev` temporarily resolves this) - Does `Enter the UID in your ckclient.json as the prompted UID` mean the newly generated UID instead? - What equals "unlimited" when entering UpRate:DownRate etc.? System info: Ubuntu 19.04 amd64; Shadowsocks-libev 3.2.5; ipv4+ipv6 What I did: 1. Made shadowsocks startup daemon run as root: I copied `shadowsocks-libev.service` from `/lib/systemd/system` into `/etc/systemd/system`, changed both `User` and `Group` to `root`. I also added `"user": "root"` to `/etc/shadowsocks-libev/config.json`. ss-server says "INFO: running from root user" but fails to bind my ipv6 address to udp port 443. It works fine after `systemctl restart shadowsock-libev` as root user. 2. Add another user: ( I tried to use AdminUID for both of my pcs, but the second pc soon became unable to connect with status saying "session closed" ) I followed the instructions and entered UID in my ckclient.json at step 4 which is AdminUID, entered all 0 or 0:0:0 for those caps and credits assuming it means unlimited. The second pc couldn't connect so I entered the newly generated UID at step 4 instead. ...I remember it says something like "connection reset by peer" in the status, but after messing around for a while now it keeps crashing until I turn off shadowsocks on my second pc. I set Up/DownCredit for the second UID to 999999999999999 but it still crashes. ``` root@vultr:~# systemctl status shadowsocks-libev ● shadowsocks-libev.service - Shadowsocks-libev Default Server Service Loaded: loaded (/etc/systemd/system/shadowsocks-libev.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2019-03-22 17:53:03 UTC; 1s ago Docs: man:shadowsocks-libev(8) Process: 1660 ExecStart=/usr/bin/ss-server -c $CONFFILE $DAEMON_ARGS (code=exited, status=255/EXCEPTION) Main PID: 1660 (code=exited, status=255/EXCEPTION) Mar 22 17:53:03 vultr.guest ss-server[1660]: /home/andy/go/src/github.com/cbeuw/Cloak/internal/server/usermanager/user.go:40 +0x4e Mar 22 17:53:03 vultr.guest ss-server[1660]: github.com/cbeuw/Cloak/internal/server/usermanager.(*Userpanel).GetAndActivateUser(0xc00004c100, 0xc0000165a0, 0x20, 0x24, 0x20, 0x21, 0xe0c28000) Mar 22 17:53:03 vultr.guest ss-server[1660]: /home/andy/go/src/github.com/cbeuw/Cloak/internal/server/usermanager/userpanel.go:158 +0x1cb Mar 22 17:53:03 vultr.guest ss-server[1660]: main.dispatchConnection(0x5d8c00, 0xc00000e090, 0xc00008c000) Mar 22 17:53:03 vultr.guest ss-server[1660]: /home/andy/go/src/github.com/cbeuw/Cloak/cmd/ck-server/ck-server.go:133 +0xcdb Mar 22 17:53:03 vultr.guest ss-server[1660]: created by main.main.func1 Mar 22 17:53:03 vultr.guest ss-server[1660]: /home/andy/go/src/github.com/cbeuw/Cloak/cmd/ck-server/ck-server.go:271 +0x2dc Mar 22 17:53:03 vultr.guest ss-server[1660]: 2019-03-22 17:53:03 ERROR: plugin service exit unexpectedly Mar 22 17:53:03 vultr.guest systemd[1]: shadowsocks-libev.service: Main process exited, code=exited, status=255/EXCEPTION Mar 22 17:53:03 vultr.guest systemd[1]: shadowsocks-libev.service: Failed with result 'exit-code'. ``` Thx
kerem closed this issue 2026-02-26 12:33:43 +03:00
Author
Owner

@cbeuw commented on GitHub (Mar 23, 2019):

  1. I'm not quite sure about the binding to UDP bit. Cloak doesn't listen to any UDP port and relies entirely on Shadowsocks for any UDP relay. Maybe you tried to bind to a protected UDP port as a non-root user, and since systemctl gives root privilege it solves the permission issue?
  2. Yes it means the newly generated UID. It was worded weirdly. I'll fix that.
  3. In the code I arbitrarily made UNLIMITED equal to 1e12 in ck-client so that the rate limiter will not do anything on the client side (this may be a bit too small now I think about it). In ck-server I think I made admin server to have 1e15 bytes of up and down credits. Again this is just arbitrary. When you are adding a new user, 0 is interpreted literally as 0 so you'll just have to put in a very big number that's smaller than 2^63-1.

It failed to bind to an IPv6 address because it's not properly square-bracketed. I mentioned it here. v1.1.0 has fixed this.

I'm not sure why it crashed since the log was incomplete, but it shouldn't have crashed because of some dubious input. I'll try to reproduce this.

<!-- gh-comment-id:475870575 --> @cbeuw commented on GitHub (Mar 23, 2019): 1. I'm not quite sure about the binding to UDP bit. Cloak doesn't listen to any UDP port and relies entirely on Shadowsocks for any UDP relay. Maybe you tried to bind to a protected UDP port as a non-root user, and since systemctl gives root privilege it solves the permission issue? 2. Yes it means the newly generated UID. It was worded weirdly. I'll fix that. 3. In the code I arbitrarily made UNLIMITED equal to 1e12 in ck-client so that the rate limiter will not do anything on the client side (this may be a bit too small now I think about it). In ck-server I think I made admin server to have 1e15 bytes of up and down credits. Again this is just arbitrary. When you are adding a new user, 0 is interpreted literally as 0 so you'll just have to put in a very big number that's smaller than 2^63-1. It failed to bind to an IPv6 address because it's not properly square-bracketed. I mentioned it [here]( https://github.com/cbeuw/Cloak/issues/20). v1.1.0 has fixed this. I'm not sure why it crashed since the log was incomplete, but it shouldn't have crashed because of some dubious input. I'll try to reproduce this.
Author
Owner

@malikshi commented on GitHub (Mar 23, 2019):

as you mention it did you already fixed this?

<!-- gh-comment-id:475895012 --> @malikshi commented on GitHub (Mar 23, 2019): as you mention it did you already fixed this?
Author
Owner

@NAVrasZ commented on GitHub (Mar 23, 2019):

@malikshi Me? Kinda... I set those to 10^9 or 10^12 or 10^15 and it worked, ipv6 also works now in v1.1.0.
Binding error is not Cloak's problem, I tried reverting my config and service files to vanilla but still got it. I'm so confused... xD It seems that putting public ipv6 address in config.json causes it.
Yesterday after setting up Cloak I found out about this error, so I upgraded from Ubuntu 18.10 to 19.04 to get ss-libev 3.2.5 from Ubuntu packages. Maybe it's because of the development version Ubuntu.
Anyway I don't reboot often but I'll keep looking.

<!-- gh-comment-id:475906852 --> @NAVrasZ commented on GitHub (Mar 23, 2019): @malikshi Me? Kinda... I set those to 10^9 or 10^12 or 10^15 and it worked, ipv6 also works now in v1.1.0. Binding error is not Cloak's problem, I tried reverting my config and service files to vanilla but still got it. I'm so confused... xD It seems that putting public ipv6 address in config.json causes it. Yesterday after setting up Cloak I found out about this error, so I upgraded from Ubuntu 18.10 to 19.04 to get ss-libev 3.2.5 from Ubuntu packages. Maybe it's because of the development version Ubuntu. Anyway I don't reboot often but I'll keep looking.
Author
Owner

@NAVrasZ commented on GitHub (Mar 24, 2019):

Update: bind: Cannot assign requested address
ipv6 is not available when ss-libev tries to bind
Only after adding net.ipv6.conf.eth0.accept_dad = 0 in sysctl.conf did {Wants,After}=network-online.target work correctly and solve it.
Systemd in Ubuntu 19.04 is v240, which is not supposed to have this problem... https://github.com/systemd/systemd/issues/2037#issuecomment-271388691
Update2: Aaand... the binding error has quietly disappeared.

<!-- gh-comment-id:475927868 --> @NAVrasZ commented on GitHub (Mar 24, 2019): Update: `bind: Cannot assign requested address` [ipv6 is not available when ss-libev tries to bind](https://serverfault.com/questions/766253/ensure-systemd-wait-for-ipv6-before-start-service-unit) Only after adding `net.ipv6.conf.eth0.accept_dad = 0` in `sysctl.conf` did `{Wants,After}=network-online.target` work correctly and solve it. Systemd in Ubuntu 19.04 is v240, which is not supposed to have this problem... https://github.com/systemd/systemd/issues/2037#issuecomment-271388691 Update2: Aaand... the binding error has quietly disappeared.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Cloak#15
No description provided.