Навигационная цепочка

WireGuard conflicts with NeosVR headless-server on Linux

By ValkaTR, 12 мая, 2023
neosvr linux

WireGuard is running and starting NeosVR headless-server with the command "mono Neos.exe" segfaults with following error message:

mono_w32socket_convert_error: no translation into winsock error for (126) "Требуемый ключ недоступен"

It turns out, that segfault happens in mono, not in Neos.exe, and the reason because I had WireGuard running. When I disable WireGuard virtual network interface wg0, then Neos.exe starts working perfectly fine.

I have tried playing around with capabilities (tried CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_SYS_ADMIN), run from root, running through Steam Proton temporarily.

I found this bug mentioned on github:

https://github.com/mono/mono/issues/20503

https://github.com/mono/mono/commit/1547af6a278321d5dbc56a63f18b2380c757608e

The trouble is that it should be fixed long time ago, but it's not. This fix activated only if environment variable ENOKEY is set. Seems like my Manjaro binaries don't have it enabled, so I downloaded mono source, activated the code by commenting environment variable check, compiled and installed to /usr/local/bin/mono:

$ git clone https://github.com/mono/mono.git

$ mcedit ./mono/mono/metadata/w32socket-unix.c

(somewhere around line 1500)

$ ./autogen.sh --prefix=/usr/local

$ make

$ sudo make install

As a Bonus, here's user-space systemd .service-file for running NeosVR headless server with autorestart and autostartup:

$ mkdir -pv ~/.config/systemd/user/

$ touch ~/.config/systemd/user/neosvr-server.service

$ mcedit ~/.config/systemd/user/neosvr-server.service

Text-version:

[Unit]
Description=NeosVR Server
[Service]
Type=simple
WorkingDirectory=/home/user/.steam/steam/steamapps/common/NeosVR
ExecStart=/usr/local/bin/mono Neos.exe -c Config/Config.json
Restart=always
RestartSec=5000ms
[Install]
WantedBy=default.target

Now reload daemons in user-space:

$ systemctl --user daemon-reload

To run the service, type:

$ systemctl --user start neosvr-server.service

To enable autostartup after restart of the computer, type:

$ systemctl --user enable neosvr-server.service

Check status of NeosVR server service:

$ systemctl --user status neosvr-server.service

Live log can be viewed with:

$ journalctl --user --follow --unit neosvr-server.service


* mcedit - is the Midnight Commander Text Editor I use. It is my favorite ^^. You can use any other favorite text editor you like: nano, vim, mousepad, etc.

Comments