Closed
Description
On build 14955, installed pritunl/archlinux with @RoliSoft 's tool.
Ping works fine on the Ubuntu distros (ubuntu 16.04, 16.10, 17.06, etc), but it breaks in Arch.
It seems to be related to the failing UDP in IPV6, but I'm not sure so I'm attaching the strace -ff
strace.txt
If it's a duplicate, please close. Thanks.
Activity
RoliSoft commentedon Nov 1, 2016
Have you tried running it with root permissions? Have you tried running WSL as admin and then run ping with root?
Your strace has the line
getuid() = 1000
which means you are running it as your normal user. As far as I know, the ping binary should have thesuid
flag and run as root. However, it's possible that the suid flag might not have been set due to security concerns in the distribution.You can add the suid flag with:
However, on the Anniversary Update, at least, you still need to run WSL as admin to be able to ping.
fpqc commentedon Nov 1, 2016
Yeah, in 14955 you can ping without admin, but I will try as root.
Edit: Yeah Roli, it was the root thing. Setting +s doesn't work though.
fpqc commentedon Nov 2, 2016
Final comment, restarting WSL fixed it after setting the setuid permission. Maybe it was some weird thing from caching permissions.
fpqc commentedon Nov 2, 2016
Fwiw, on my real Arch install, I do not have to have setuid/setgid on ping. Maybe MS's implementation right now requires root for some reason. I guess I can try it out on an ubuntu VM and see if they do it there.
RoliSoft commentedon Nov 2, 2016
The practice of using setuid can be pretty dangerous, and so it is mostly discouraged. Linux has a "capabilities" system, where you can add only specific capabilities, instead of full system access. Ping most likely needs raw socket usage, in which case you'd run:
However, I'm not sure if the WSL kernel wrapper supports capabilities. It most likely does not.
I had an Arch VM laying around, and I was able to confirm this, ping does come with capabilities set:
fpqc commentedon Nov 2, 2016
Yeah, I found out it was capabilities independently, searching why Ubuntu uses setuid (apparently for backwards compatibility or something), found a bug report about it from 2014.
sunilmut commentedon Nov 2, 2016
WSL does support capabilities and so enforces the CAP_NET_RAW capability for raw sockets.
fpqc commentedon Nov 2, 2016
@sunilmut getcap and getfattr both die silently, and setcap dies with an error message
Here is the strace of
setcap cap_net_raw+ep /usr/sbin/ping
:and here is the strace of
getcap /usr/sbin/ping
[-]Arch Linux Ping fails[/-][+]Arch Linux Ping fails (capabilities problems)[/+]sunilmut commentedon Nov 2, 2016
Thanks @fpqc. Looks like the extended attributes for 'security.capability' is not supported, but we do enforce capability checks. Adding @stehufntdev to comment on the extended attribute part.
setxattr("/usr/sbin/ping", "security.capability", "\1\0\0\2\0 \0\0\0\0\0\0\0\0\0\0\0\0\0", 20, 0) = -1 EOPNOTSUPP (Operation not supported)
fpqc commentedon Nov 2, 2016
@sunilmut I'm guessing that whatever capability ping should have, it does actually have, but the
capget
is failing, so it's being detected as not having the capability.Also, I confirmed that getcap and setcap don't work on ubuntu either (but this is mitigated by the fact that ping is setuid in ubuntu, while it's not in Arch).
10 remaining items