Cannot ping from your new Raspberry Pi with Raspbian PIXEL?

1 minute read

My newest Raspberry Pi 3 got a shiny new FLIRC case and therefore is now allowed to leave the home office and start a new career as a guest internet station in our living room. Thanks to the Wifi this was easier than expected, only one small problem came up:

Problem with ping command

I could not ping any IP address, whether outside or in our home. I got a strange message like this:

tobias@rpi06:~ $ ping abarbanell.de
ping: icmp open socket: Operation not permitted

However I could browse the internet, log in from remote, and many other things, so what could be wrong?

Investigation showed that I could ping under root account or sudo:

tobias@rpi01 ~ $ sudo ping abarbanell.de
PING abarbanell.de (81.169.145.164) 56(84) bytes of data.

but also from my other Raspberry Pi’s it worked fine - all of them running older versions of Raspbian.

tobias@rpi01 ~ $ ping abarbanell.de
PING abarbanell.de (81.169.145.164) 56(84) bytes of data.
64 bytes from wa4.rzone.de (81.169.145.164): icmp_req=1 ttl=245 time=27.6 ms
64 bytes from wa4.rzone.de (81.169.145.164): icmp_req=2 ttl=245 time=27.5 ms

Investigation

Looked like something different with the permissions, so I quickly investigated the difference. Found out that the working Raspberry had the Set-UID bit switched on for the ping command:

Old, working ok:

tobias@rpi01 ~ $ ls -l `which ping`
-rwsr-xr-x 1 root root 33220 Mar 30  2012 /bin/ping

Raspbian Pixel, not working:

tobias@rpi06:~ $ ls -l `which ping`
-rwxr-xr-x 1 root root 38844 Feb 12  2014 /bin/ping

Then the fix was as easy as

tobias@rpi06:~ $ sudo chmod u+s `which ping`

and it was looking better after that:

tobias@rpi06:~ $ ls -l which ping -rwsr-xr-x 1 root root 38844 Feb 12 2014 /bin/ping

And of coursse it also worked:

tobias@rpi06:~ $ ping abarbanell.de
PING abarbanell.de (81.169.145.164) 56(84) bytes of data.
64 bytes from wa4.rzone.de (81.169.145.164): icmp_seq=1 ttl=245 time=35.0 ms
64 bytes from wa4.rzone.de (81.169.145.164): icmp_seq=2 ttl=245 time=36.2 ms

Conclusion

I hope this may be of help for some people out in the Internet, at least this note will serve as a reminder to myself when I get the next Raspberry Pi.

Meanwhile, feel free to let me know what you think in the comments below, or enjoy some of my cat videos

Think cat videos are bullshit? Then try this: Cowshit is the new Bullshit

Comments