Need help on getting ping to run under wine on Ubuntu 16.04

Questions about Wine on Linux
Locked
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Need help on getting ping to run under wine on Ubuntu 16.04

Post by ipkpjersi »

Hi,

I need help getting ping to work under wine on Ubuntu 16.04. I am trying to run a Battlefield Bad Company 2 server for testing (I might be doing some development on a mod at some point) and I am unable to get it to a playable state. I can run mase_bc2 and Frost.Game.Main_Win32_Final.exe and even connect to the LAN server in game - but, when loading a map, it does not continue loading and instead the game freezes.

Here is the error that I need to solve to get the server playable: `0049:err:winediag:IcmpCreateFile Failed to use ICMP (network ping), this requires special permissions.`

Here is what I have tried:

`sudo chmod 4755 /bin/ping` to allow wine to access ping. This did not help.

I then tried this:
`sudo setcap cap_net_raw+epi "$(readlink -f "/usr/bin/wine")"`

which results in this error:
`wine: error while loading shared libraries: libwine.so.1: cannot open shared object file: No such file or directory`

and then separately after running `sudo setcap -r "$(readlink -f "/usr/bin/wine")"` to remove the shared libraries error, I also ran this:
`sudo setcap 'cap_net_bind_service=+ep' "$(readlink -f "/usr/bin/wine-preloader")"`

Both `setcap` commands result in the same shared libraries error.

I'm decent at Linux but it seems this is beyond my level and I need help with this. I have searched thread after thread online and I came up empty. If someone can solve this for me, this may be one of the only sources of fixing this issue (bug??) on the Internet.

I see there is someone else having this issue here: viewtopic.php?f=8&t=30704 and he even gets the same error as me after using `setcap` however he did not get this issue solved.

Thanks.
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by ipkpjersi »

Since I seem to be unable to edit my post, I should probably mention that I am running Wine Stable 3.0.2.
User avatar
dimesio
Moderator
Moderator
Posts: 13204
Joined: Tue Mar 25, 2008 10:30 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by dimesio »

If you're using the WineHQ packages, Wine would be installed in /opt/wine-stable, not /usr/bin.
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by ipkpjersi »

dimesio wrote:If you're using the WineHQ packages, Wine would be installed in /opt/wine-stable, not /usr/bin.
which wine shows /usr/bin/wine which makes me think that it's symlinked to /opt/wine-stable/bin/wine - wouldn't /usr/bin/wine work fine for setcap or am I mistaken?

Thanks for taking the time to respond, I appreciate it. :)
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by ipkpjersi »

My apologizes for the double post but I can no longer edit my previous comment. I have just tried sudo setcap cap_net_raw+epi "$(readlink -f "/opt/wine-stable/bin/wine")" and I still get the same error: wine: error while loading shared libraries: libwine.so.1: cannot open shared object file: No such file or directory.

However, I have symlinked to /usr/lib/libwine.so.1 and the shared libraries error is now gone. However, ping still does not work under wine.

Does anyone have any other ideas of things I can try?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by Bob Wya »

@ipkpjersi

New users (and less new ones!), of Wine, are expected to have read the WineHQ FAQ before posting on these forums...

The FAQ already has an entry for how to get network ping working under Wine. See: WineHQ FAQ: 10.3.4 Failed to use ICMP (network ping), this requires special permissions.

Please use the forum code tags when posting terminal commands and output:

Code: Select all

sudo setcap cap_net_raw+epi "$(readlink -f "/usr/bin/wine-preloader")"
Note: you'll have to unwind the permissions mess you've made as well... :roll:

Bob
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by ipkpjersi »

Bob Wya wrote:@ipkpjersi

New users (and less new ones!), of Wine, are expected to have read the WineHQ FAQ before posting on these forums...

The FAQ already has an entry for how to get network ping working under Wine. See: WineHQ FAQ: 10.3.4 Failed to use ICMP (network ping), this requires special permissions.

Please use the forum code tags when posting terminal commands and output:

Code: Select all

sudo setcap cap_net_raw+epi "$(readlink -f "/usr/bin/wine-preloader")"
Note: you'll have to unwind the permissions mess you've made as well... :roll:

Bob
Hi,

I did actually remove absolutely all of the permissions mess I made. I tried that exact command, it did not help. I also tried it on /opt/wine-stable/bin/wine as well (instead of making it use the symlink). Nothing has worked thus far.

Here is the output:

Code: Select all

Z:\home\user> ping google.com
0075:fixme:ping:main this command currently just sleeps based on -n parameter
Cheers.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by Bob Wya »

ipkpjersi wrote: Here is the output:

Code: Select all

Z:\home\user> ping google.com
0075:fixme:ping:main this command currently just sleeps based on -n parameter
Cheers.
@ipkpjersi

That ping command is actually working for you now.

However your Wine version is too old to support the ping command.

Isira Seneviratne added it to the development branch months ago (February 2018).
But you need at least Wine Development version 3.14 - due to Bug 43252 - IcmpSendEcho doesn't work with a ReplySize<56 - a fix by Zhiyi Zhang.

ping works find for me with Wine Development version 3.15, after running the setcap command on the wine-preloader.

Code: Select all

wine cmd.exe
> ping 8.8.8.8
Pinging 8.8.8.8 [8.8.8.8] with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=12ms TTL=123
Reply from 8.8.8.8: bytes=32 time=10ms TTL=123
...
Tested on my Gentoo install.

Bob
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by ipkpjersi »

Bob Wya wrote:
ipkpjersi wrote: Here is the output:

Code: Select all

Z:\home\user> ping google.com
0075:fixme:ping:main this command currently just sleeps based on -n parameter
Cheers.
@ipkpjersi

That ping command is actually working for you now.

However your Wine version is too old to support the ping command.

Isira Seneviratne added it to the development branch months ago (February 2018).
But you need at least Wine Development version 3.14 - due to Bug 43252 - IcmpSendEcho doesn't work with a ReplySize<56 - a fix by Zhiyi Zhang.

ping works find for me with Wine Development version 3.15, after running the setcap command on the wine-preloader.

Code: Select all

wine cmd.exe
> ping 8.8.8.8
Pinging 8.8.8.8 [8.8.8.8] with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=12ms TTL=123
Reply from 8.8.8.8: bytes=32 time=10ms TTL=123
...
Tested on my Gentoo install.

Bob
That is EXACTLY the information I am looking for, thank you! Any idea if/when the fix will be back-ported to Wine Stable? Like, for example, should I expect it in the next version, or is it possible it won't be back-ported for at least a few versions away or possibly never backported to Wine Stable? I am a little bit weary of running Wine Staging simply because I don't know how stable it is, or how many regressions I should expect or if it's generally quite stable.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by Bob Wya »

ipkpjersi wrote:...
That is EXACTLY the information I am looking for, thank you! Any idea if/when the fix will be back-ported to Wine Stable? Like, for example, should I expect it in the next version, or is it possible it won't be back-ported for at least a few versions away or possibly never backported to Wine Stable? I am a little bit weary of running Wine Staging simply because I don't know how stable it is, or how many regressions I should expect or if it's generally quite stable.
@ipkpjersi


Wine Stable
is basically: "my application already works under Wine, I want to keep it working"...
Wine Development is essentially where all the bug fixes and improvements land.
This is the recommended package for end-users to run.
I never stated that you should or need to run Wine Staging (which is primarily targeted at gamers)...
In fact I didn't even mention Wine Staging...

I doubt Wine Stable will pick up the ping implementation anytime soon.
It's already omitted from the next release (3.0.3).

You can install the WineHQ Wine Stable and Wine Development packages in parallel.
One of the packages will need to be installed out-of-tree i.e. in /opt/... only.

You basically just don't install the winehq-... meta-package for the out-of-tree Wine package(s).
These contain the /usr/bin compatibility symlinks.
Just install the wine-... packages variant.


Bob
ipkpjersi
Level 2
Level 2
Posts: 16
Joined: Thu Sep 06, 2018 8:19 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by ipkpjersi »

Bob Wya wrote:
ipkpjersi wrote:...
That is EXACTLY the information I am looking for, thank you! Any idea if/when the fix will be back-ported to Wine Stable? Like, for example, should I expect it in the next version, or is it possible it won't be back-ported for at least a few versions away or possibly never backported to Wine Stable? I am a little bit weary of running Wine Staging simply because I don't know how stable it is, or how many regressions I should expect or if it's generally quite stable.
@ipkpjersi


Wine Stable
is basically: "my application already works under Wine, I want to keep it working"...
Wine Development is essentially where all the bug fixes and improvements land.
This is the recommended package for end-users to run.
I never stated that you should or need to run Wine Staging (which is primarily targeted at gamers)...
In fact I didn't even mention Wine Staging...

I doubt Wine Stable will pick up the ping implementation anytime soon.
It's already omitted from the next release (3.0.3).

You can install the WineHQ Wine Stable and Wine Development packages in parallel.
One of the packages will need to be installed out-of-tree i.e. in /opt/... only.

You basically just don't install the winehq-... meta-package for the out-of-tree Wine package(s).
These contain the /usr/bin compatibility symlinks.
Just install the wine-... packages variant.


Bob
Hi,

I actually installed winehq-staging because I knew it was newer than stable and I wasn't sure if I was supposed to install wine-devel or wine-development. However, I ran the command:

Code: Select all

sudo apt-cache show wine-development | more
and the command:

Code: Select all

sudo apt-cache show wine-devel | more
and it seems that wine-devel is newer (3.15 vs 1.9.6). I now have winehq-stable and wine-devel installed, and I have symlinked wine-devel with:

Code: Select all

sudo ln -s /opt/wine-devel/bin/wine /usr/bin/wine-devel
so I can now specify wine or wine-devel depending on which version I want to use.

Since I do like games, I might go ahead and install wine-staging in addition to wine-devel.

Do you have any recommendations on whether to use wine or wine64 in general?

edit: symlinks don't seem to actually work, so instead I just use aliases for zsh in my .zshrc now:

Code: Select all

alias wine="WINEPREFIX=~/.wine wine"
alias wine-devel="WINEPREFIX=~/.wine-devel /opt/wine-devel/bin/wine"
alias wine-staging="WINEPREFIX=~/.wine-staging /opt/wine-staging/bin/wine"
edit 2: turns out wine-devel does NOT work for ping, it returns this error message:

Code: Select all

PING: transmit failed. General failure.
I needed to use wine-staging for it to successfully get a reply.:

Code: Select all

Reply from 8.8.8.8: bytes=32 time=29ms TTL=121
I guess wine-staging has more patches than just for gaming.

Thanks again!
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by Bob Wya »

np 8)
orbitbus
Newbie
Newbie
Posts: 1
Joined: Sat Mar 16, 2019 3:45 pm

Re: Need help on getting ping to run under wine on Ubuntu 16

Post by orbitbus »

How is this a useful answer? On my Ubuntu 18.04 and latest wine-devel I get the same missing libwine.so.1 error after
setting permissions as indicated by clockwork orange here. That's not addressed in the FAQ. I guess I'm supposed to figure out how to locate libwine.so.1, and where to symlink it to so wine can find it. In my case, wine was looking at /lib/i386-linux-gnu so I symlinked to there.
arent
Newbie
Newbie
Posts: 4
Joined: Fri Dec 11, 2020 5:29 am

Re: Need help on getting ping to run under wine on Ubuntu 16.04

Post by arent »

Running wine-5.5 (Ubuntu 5.5-3ubuntu1) it looks that 'ping' is available. However...

Code: Select all

$wine ping localhost
Pinging localhost [127.0.0.1] with 32 bytes of data:
Request timed out.
whereas

Code: Select all

$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.057 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.046 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2083ms
rtt min/avg/max/mdev = 0.035/0.046/0.057/0.009 ms
Ubuntu 20.04.1, ufw is inactive
Is wine doing firewalling on its own?
User avatar
dimesio
Moderator
Moderator
Posts: 13204
Joined: Tue Mar 25, 2008 10:30 pm

Re: Need help on getting ping to run under wine on Ubuntu 16.04

Post by dimesio »

arent wrote: Fri Dec 11, 2020 9:47 am Running wine-5.5 (Ubuntu 5.5-3ubuntu1) it looks that 'ping' is available. However...

Code: Select all

$wine ping localhost
Pinging localhost [127.0.0.1] with 32 bytes of data:
Request timed out.
Are you running with WINEDEBUG=-all, or have you edited out most of the console output? Normally there should be a lot more than what you've posted.

Specifically, you need to look for this line:

Code: Select all

0024:err:winediag:IcmpCreateFile Failed to use ICMP (network ping), this requires special permissions.
If you see that, follow the instructions in https://wiki.winehq.org/FAQ#Failed_to_u ... ermissions to fix it.
arent
Newbie
Newbie
Posts: 4
Joined: Fri Dec 11, 2020 5:29 am

Re: Need help on getting ping to run under wine on Ubuntu 16.04

Post by arent »

This is all I got...

Code: Select all

$ WINEDEBUG=-all
$ echo $WINEDEBUG
-all
$ wine ping localhost
Pinging localhost [127.0.0.1] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 127.0.0.1
	Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
Tried once more:

Code: Select all

$ sudo su
# wine ping localhost
wine: created the configuration directory '/root/.wine'
0012:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
0012:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
0012:err:ole:get_local_server_stream Failed: 80004002
0014:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
0014:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
0014:err:ole:get_local_server_stream Failed: 80004002
Could not find Wine Gecko. HTML rendering will be disabled.
Could not find Wine Gecko. HTML rendering will be disabled.
wine: configuration in L"/root/.wine" has been updated.
Pinging localhost [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64

Ping statistics for 127.0.0.1
	Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
Approximate round trip times in milli-seconds:
	Minimum = 0ms, Maximum = 0ms, Average = 0ms
#
Locked