I can't run a game server as a systemd user unit

Questions about Wine on Linux
Post Reply
markk
Newbie
Newbie
Posts: 3
Joined: Thu Aug 18, 2022 6:41 pm

I can't run a game server as a systemd user unit

Post by markk »

Hello,
I am trying to run a game server that is only compiled for windows.
When I run it manually, it runs and stays running smoothly.
When I try to run it as a service (user unit systemd) it runs but crashes when a client tries to connect to the server.
I am using Ubuntu 20.4 and Wine 7.0
Below are the relevant logs:

Log of when I run the server manually:
user@machine:~/rtrserver$ wine C:\\users\\user\\Documents\\rtrserver\\Server3000.exe
0050:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0050:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
0050:err:systray:initialize_systray Could not create tray window
2022 / 08 / 19 - 1:9:27 :: Checking version
0100:err:winediag:ntlm_check_version ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
0100:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems
2022 / 08 / 19 - 1:9:27 :: You appear not to be running the latest version of the RTR server. Clients using another vers
ion will not be able to connect.
2022 / 08 / 19 - 1:9:27 :: Reading config.dat...
2022 / 08 / 19 - 1:9:27 :: Server name is Rami's Server
2022 / 08 / 19 - 1:9:27 :: Server MOTD is set to
2022 / 08 / 19 - 1:9:27 :: Game mode is 1
2022 / 08 / 19 - 1:9:27 :: Echo is set to 1
2022 / 08 / 19 - 1:9:27 :: Port is 6969
2022 / 08 / 19 - 1:9:27 :: MaxPlayers is 10
2022 / 08 / 19 - 1:9:27 :: Frags till map change is 5
2022 / 08 / 19 - 1:9:27 :: Time till map change: 5000
2022 / 08 / 19 - 1:9:27 :: Sounds are set to 1
2022 / 08 / 19 - 1:9:27 :: Cheats are set to 0
2022 / 08 / 19 - 1:9:27 :: Logging is 1
2022 / 08 / 19 - 1:9:27 :: Map sending is 0
2022 / 08 / 19 - 1:9:27 :: Password is Adminpassword
2022 / 08 / 19 - 1:9:27 :: Announce Camping is 0,30000,10000
2022 / 08 / 19 - 1:9:27 :: Announce To Server List is 0
2022 / 08 / 19 - 1:9:27 :: Done!
2022 / 08 / 19 - 1:9:27 :: Reading map list
2022 / 08 / 19 - 1:9:27 :: Read housemap
2022 / 08 / 19 - 1:9:27 :: 1 maps found
2022 / 08 / 19 - 1:9:27 :: Reading banned IP's
2022 / 08 / 19 - 1:9:27 :: Reading map housemap
2022 / 08 / 19 - 1:9:27 :: 31458144
2022 / 08 / 19 - 1:9:27 :: Map is The House of ... Someone
2022 / 08 / 19 - 1:9:27 :: x: 199, y: 199
2022 / 08 / 19 - 1:9:27 :: Num Obj: 5
2022 / 08 / 19 - 1:9:27 :: Done
2022 / 08 / 19 - 1:9:27 :: Server initialized.
2022 / 08 / 19 - 1:9:57 :: Incoming Connection: Client 1 ID 31397392 IP xxx.xx.xx.xxx
2022 / 08 / 19 - 1:9:58 :: Server: Player 1 is now known As player1
2022 / 08 / 19 - 1:11:56 :: Server :: Player1 left with 0 kills and 0 deaths
0110:fixme:console:default_ctrl_handler Terminating process fc on event 0

This is how it should work when running as a service. Here is the systemctl and journalctl log:
After running systemctl --user start rtr:
user@machine:~$ systemctl --user status rtr
● rtr.service - Persisent RTR Server
Loaded: loaded (/home/user/.config/systemd/user/rtr.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2022-08-19 00:58:00 CEST; 3min 26s ago
Main PID: 3173 (start.exe)
CGroup: /user.slice/user-1004.slice/user@1004.service/rtr.service
├─3173 start.exe /exec
├─3175 /opt/wine-stable/bin/wineserver
├─3181 C:\windows\system32\services.exe
├─3184 C:\windows\system32\winedevice.exe
├─3186 C:\windows\system32\explorer.exe /desktop
├─3195 C:\windows\system32\winedevice.exe
├─3209 C:\windows\system32\plugplay.exe
├─3215 C:\windows\system32\svchost.exe -k LocalServiceNetworkRestricted
├─3221 C:\windows\system32\rpcss.exe
└─3230 C:\users\user\Documents\rtrserver\Server3000.exe

Everything seems fine there, however when a client tries to connect, the server crashes:
user@machine:~$ systemctl --user status rtr
● rtr.service - Persisent RTR Server
Loaded: loaded (/home/user/.config/systemd/user/rtr.service; disabled; vendor preset: enabled)
Active: deactivating (stop-sigterm) (Result: exit-code) since Fri 2022-08-19 01:03:20 CEST; 11s ago
Process: 3173 ExecStart=/usr/bin/wine ${RTR_EXECUTABLE} (code=exited, status=5)
Main PID: 3173 (code=exited, status=5)
CGroup: /user.slice/user-1004.slice/user@1004.service/rtr.service
└─3195 C:\windows\system32\winedevice.exe

It remains in the deactivating status for a few seconds, until it is restarted, and returns to the runing status until a client tries to connect again.

the journalctl log is as follows:
user@machine:~$ sudo journalctl _SYSTEMD_USER_UNIT=rtr.service --follow
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3106]: 0050:err:winediag:nodrv_CreateWindow Application tried to create
a window, but no driver could be loaded.
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3106]: 0050:err:winediag:nodrv_CreateWindow Make sure that your X serve
r is running and that $DISPLAY is set correctly.
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3106]: 0050:err:systray:initialize_systray Could not create tray window
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3152]: 0104:err:winediag:nodrv_CreateWindow Application tried to create
a window, but no driver could be loaded.
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3152]: 0104:err:winediag:nodrv_CreateWindow Make sure that your X serve
r is running and that $DISPLAY is set correctly.
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3150]: 00fc:err:winediag:ntlm_check_version ntlm_auth was not found or
is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your
distribution.
Aug 19 00:54:39 vmi964106.contaboserver.net wine[3150]: 00fc:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expec
t problems
Aug 19 00:56:28 vmi964106.contaboserver.net wine[3150]: wine: Unhandled page fault on write access to FFFFFFFFFFFFE012 a
t address 000000014001AB6B (thread 0108), starting debugger...
Aug 19 00:56:28 vmi964106.contaboserver.net wine[3157]: 0110:err:winediag:nodrv_CreateWindow Application tried to create
a window, but no driver could be loaded.
Aug 19 00:56:28 vmi964106.contaboserver.net wine[3157]: 0110:err:winediag:nodrv_CreateWindow Make sure that your X serve
r is running and that $DISPLAY is set correctly.

the rtr.service file is as follows:
user@machine:~/.config/systemd/user$ cat rtr.service
[Unit]
Description=Persisent RTR Server
BindsTo=network.target
After=network.target

[Service]
# Set the full Windows path to your Server3000.EXE executable here...
Environment="RTR_EXECUTABLE=C:\\users\\user\\Documents\\rtrserver\\Server3000.exe"
WorkingDirectory=/home/user/rtrserver
ExecStart=wine ${RTR_EXECUTABLE}
Restart=on-failure
RestartSec=2s

[Install]
WantedBy=default.target

Any idea why it might be failing? why it works fine if i run it manually but fails if i run it as a service?
Here is the game, with its client and server compiled, in case you need it for testing, although being an audio game the client can be difficult to run without a screen reader
https://iamtalon.me/games/rtr_ultimate.zip

thank you very much in advance and apologies for my bad english, it is not my native language
invisible kid
Level 4
Level 4
Posts: 209
Joined: Tue Dec 24, 2019 3:23 pm

Re: I can't run a game server as a systemd user unit

Post by invisible kid »

0100:err:winediag:ntlm_check_version ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
0100:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems
I don't know if this is all of your issues, but you will need to fix this or it won't be able to initiate or authenticate secure internet connections. I don't remember if you said, if you are using debian, or a similar package manager, install "winbind."
markk
Newbie
Newbie
Posts: 3
Joined: Thu Aug 18, 2022 6:41 pm

Re: I can't run a game server as a systemd user unit

Post by markk »

I have fixed the winbind error, but still the same thing happens.
I think the problem is in the following error:
Aug 20 22:40:51 vmi964106.contaboserver.net wine[13032]: wine: Unhandled page fault on write access to FFFFFFFFFFFFE000
at address 000000014001AB6B (thread 0100), starting debugger...

I don't know how to fix it or why it appears, since it only appears when I run the server from the systemd unit
markk
Newbie
Newbie
Posts: 3
Joined: Thu Aug 18, 2022 6:41 pm

Re: I can't run a game server as a systemd user unit

Post by markk »

Ok, I have solved that error, and also the one of
Aug 19 00:56:28 vmi964106.contaboserver.net wine[3150]: wine: Unhandled page fault on write access to FFFFFFFFFFFFE012 a
t address 000000014001AB6B (thread 0108), starting debugger...

I understand that now the problem is in the following errors:
wine[3106]: 0050:err:winediag:nodrv_CreateWindow Application tried to create
a window, but no driver could be loaded.
wine[3106]: 0050:err:winediag:nodrv_CreateWindow Make sure that your X serve
r is running and that $DISPLAY is set correctly.
wine[3106]: 0050:err:systray:initialize_systray Could not create tray window.

Honestly, I have no idea how to fix them, considering that it is a VPS server that does not have a screen, and if I run wine Server3000.exe it works perfectly, even when those errors appear, I guess because the output of the application is redirected to the bash console.

How could I fix this so that it runs correctly from a systemd drive?
pga256
Level 2
Level 2
Posts: 29
Joined: Mon Aug 24, 2015 10:36 am

Re: I can't run a game server as a systemd user unit

Post by pga256 »

It looks like the process can't grab the X display that is already in use by the logged in user.
Try changing the command that starts the process to something like:
env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY wine C:\\users\\user\\Documents\\rtrserver\\Server3000.exe
pga256
Level 2
Level 2
Posts: 29
Joined: Mon Aug 24, 2015 10:36 am

Re: I can't run a game server as a systemd user unit

Post by pga256 »

Just re-read this and I see its a VPS server so maybe there's no way to get it to work.
Post Reply