Skip to content
This repository has been archived by the owner on Apr 10, 2022. It is now read-only.

[Question] Wine Mono & Space Engineers #2

Closed
tsuckow opened this issue Jun 27, 2020 · 6 comments
Closed

[Question] Wine Mono & Space Engineers #2

tsuckow opened this issue Jun 27, 2020 · 6 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@tsuckow
Copy link

tsuckow commented Jun 27, 2020

I've been trying to get space engineers dedicated server to function but have been having trouble with the experimental tag and am not sure if I am just doing something wrong or if some extra secret sauce is needed (If said sauce even exists).

Error:

se_1  | Handing startup over to /data/custom_server ...
se_1  | Starting server ...
se_1  | 002c:fixme:winediag:__wine_start_process Wine Staging 5.11 is a testing version containing experimental patches.
se_1  | 002c:fixme:winediag:__wine_start_process Please mention your exact version when filing bug reports on winehq.org.
se_1  | 0048:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
se_1  | 0048:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
se_1  | 0048:err:ole:get_local_server_stream Failed: 80004002
se_1  | 0050:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
se_1  | 0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
se_1  | 0050:err:ole:get_local_server_stream Failed: 80004002
se_1  | 0024:err:environ:run_wineboot boot event wait timed out
se_1  | 0024:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6.1" not implemented
se_1  | 0024:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6.1" not implemented
se_1  | 0024:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed
se_1  | XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":99"
se_1  |       after 79 requests (79 known processed) with 1 events remaining.
se_1  | XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":99"
se_1  |       after 195 requests (193 known processed) with 0 events remaining.
se_1  | XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":99"
se_1  |       after 161 requests (161 known processed) with 0 events remaining.
se_1  | XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":99"
se_1  |       after 78 requests (78 known processed) with 1 events remaining.
se_1  | Starting server ...
se_1  | No protocol specified
se_1  | 006c:err:user:load_desktop_driver failed to load L"C:\\windows\\system32\\winex11.drv"
se_1  | 006c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
se_1  | 006c:err:winediag:nodrv_CreateWindow The explorer process failed to start.
se_1  | Could not find Wine Gecko. HTML rendering will be disabled.
se_1  | XIO:  fatal IO error 25 (Inappropriate ioctl for device) on X server ":99"
se_1  |       after 143 requests (118 known processed) with 0 events remaining.
se_1  | 0064:err:environ:run_wineboot boot event wait timed out
se_1  | 0064:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6.1" not implemented
se_1  | 0064:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6.1" not implemented
se_1  | 0064:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed

From what limited google searching i've done it seems that .Net 4.6 /should/ generally work with Mono. So then the question is whether something isn't installed in this container and how might I go about that.

docker-compose.yaml:

version: "2"

services:
  se:
    image:             rpufky/steam:experimental
    restart:           unless-stopped
    ports:
      - '27015:27015'
      - '27015:27015/udp'
      - '27016:27016/udp'
      - '7777:7777/udp'
      - '7778:7778/udp'
    environment:
      - PUID=1000
      - PGID=1000
      - UPDATE_OS=1
      - UPDATE_STEAM=1
      - UPDATE_SERVER=1
      - PLATFORM=windows
      - STEAM_APP_ID=298740
      - TZ=America/Los_Angeles
    volumes:
      - /home/me/se_test/data:/data
      - /etc/localtime:/etc/localtime:ro

data/custom_server

#!/bin/bash
#
# Runs as root. Drop privileges.
#
# Capture kill/term signals and send SIGINT to gracefully shutdown conan server.
PROCESS_WAIT_TIME=25
WATCHDOG_TIME=300

function shutdown() {
  echo 'Shutting down server ...'
  if [ "$(pgrep -n Conan)" != '' ]; then
    echo "Sending SIGINT to server (max ${PROCESS_WAIT_TIME} secs) ..."
    kill -SIGINT `pgrep -n Conan`
    sleep ${PROCESS_WAIT_TIME}
  fi
  if [ "$(pgrep wine)" != '' ]; then
    echo "Sending SIGINT to wine processes (max ${PROCESS_WAIT_TIME} sec) ..."
    kill -SIGINT `pgrep wine`
    sleep ${PROCESS_WAIT_TIME}
  fi
  exit 0
}
trap shutdown SIGINT SIGKILL SIGTERM

function start_server() {
  su steam -c "xvfb-run --auto-servernum wine64 ${SERVER_DIR}/DedicatedServer64/SpaceEngineersDedicated.exe -noconsole -ignorelastsession -ip "0.0.0.0" -path ${SERVER_DIR}"
}

function watch_server() {
  if ps aux | grep [C]onanSandboxServer > /dev/null; then
    echo 'Server is running ...'
  else
    echo 'Starting server ...'
    start_server &
  fi
}

while true; do
  watch_server
  # background and using wait enables trap capture.
  sleep ${WATCHDOG_TIME} &
  wait
done
@r-pufky r-pufky self-assigned this Jun 28, 2020
@r-pufky r-pufky added the good first issue Good for newcomers label Jun 28, 2020
@r-pufky
Copy link
Owner

r-pufky commented Jun 28, 2020

I have a bit of time to look into this now.

@tsuckow
Copy link
Author

tsuckow commented Jun 28, 2020

I have been fiddling with this and got wine-mono to install and also setup a vnc server so I could see wine errors.

I created a docker file to extend this image

FROM rpufky/steam:experimental

#THis works
RUN wget https://dl.winehq.org/wine/wine-mono/5.1.0/wine-mono-5.1.0-x86.msi && \
su steam -c 'wine64 msiexec /i wine-mono-5.1.0-x86.msi' && \
rm wine-mono-5.1.0-x86.msi

#This does not, may or may not been needed, but wine will hang for a while with a gui prompt about it.
RUN wget http://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86.msi && \
su steam -c 'wine64 msiexec /i wine-gecko-2.47.1-x86.msi' && \
rm wine-gecko-2.47.1-x86.msi

RUN DEBIAN_FRONTEND="noninteractive" apt-get install --yes x11vnc && \
\
apt-get clean autoclean && \
apt-get autoremove --yes && \
rm -rfv /var/lib/{apt,dpkg} /var/lib/{cache,log} /tmp/* /var/tmp/* && \
mkdir -p /var/lib/dpkg/{alternatives,info,parts,updates} && \
touch /var/lib/dpkg/status

Changes to custom_server:

Xvfb :1 -screen 0 1024x768x16 &
sleep 2
x11vnc -display :1 -bg -nopw -listen 0.0.0.0 -xkb
su steam -c "wine64 ${SERVER_DIR}/DedicatedServer64/SpaceEngineersDedicated.exe -path ${SERVER_DIR}/SpaceEngineer% 32   

It is worth noting source is available: https://github.com/KeenSoftwareHouse/SpaceEngineers Though it reads like babies first video game with everything prefixed with "My"

@tsuckow
Copy link
Author

tsuckow commented Jun 28, 2020

I left off this evening trying to get it to load the GUI since maybe I could at least prove it runs that way. But I get CantStartFromCommandLine as an error so I'm not sure if there is something that needs to happen to trick it into thinking it is in an interactive setting. Rumor is there is a "-console" flag that who knows what it does.

@r-pufky
Copy link
Owner

r-pufky commented Jun 28, 2020

Thanks for the updates. Based on what I have been digging into, the space engineers binary was original 32bit and was able to run via Wine on Linux pretty easily. Update 01.133 forced the 64bit binary, requiring .NET 4.6.1+ VC 2013 and VC 2017 redistributables.

Most people closed up shop after this and just ran in a straight windows VM or virtualbox. Much of the material I've been able to find is pre 01.133.

References:

Some people have reported this working by using winetricks to workaround some issues.

I'm going to be adding winetricks to the base image so the tooling is available for usage; these should be built and pushed shortly.

Current State

Based on the dedicated server instructions above, I started the windows dedicated server, configured a test server, shut it down and copied those config files to /data/config. I updated the launch script to ensure dependencies are installed and linked to the configuration.

Unfortunately, that's as far as I've been able to progress it. Server doesn't crash anymore, but does not seem to be loading the world state on launch.

Per your mono comment: mono should not be installed if installing .NET, as mono is an opensource version of it. Not having mono installed is fine if the .NET packages are.

custom_server

#!/bin/bash
PROCESS_WAIT_TIME=25
WATCHDOG_TIME=300

# --- ADD required windows packages ---
su steam -c "winetricks dotnet472"
su steam -c "winetricks vcrun2013"
su steam -c "winetricks vcrun2017"

# --- Link to windows dedicated server location ---
ln -sf /data/config '/steam/.wine/drive_c/users/steam/Application Data/SpaceEngineersDedicated'

function shutdown() {
  echo 'Shutting down server ...'
  if [ "$(pgrep -n Conan)" != '' ]; then
    echo "Sending SIGINT to server (max ${PROCESS_WAIT_TIME} secs) ..."
    kill -SIGINT `pgrep -n Conan`
    sleep ${PROCESS_WAIT_TIME}
  fi
  if [ "$(pgrep wine)" != '' ]; then
    echo "Sending SIGINT to wine processes (max ${PROCESS_WAIT_TIME} sec) ..."
    kill -SIGINT `pgrep wine`
    sleep ${PROCESS_WAIT_TIME}
  fi
  exit 0
}
trap shutdown SIGINT SIGKILL SIGTERM

function start_server() {
  su steam -c "wine ${SERVER_DIR}/DedicatedServer64/SpaceEngineersDedicated.exe -console"
}

function watch_server() {
  if ps aux | grep [C]onanSandboxServer > /dev/null; then
    echo 'Server is running ...'
  else
    echo 'Starting server ...'
    start_server &
  fi
}

while true; do
  watch_server
  # background and using wait enables trap capture.
  sleep ${WATCHDOG_TIME} &
  wait
done

Then modifying /data/config/SpaceEngineers-Dedicated.cfg appropriately.

Conclusion

I'm absolutely willing to update the base image to make this server work, however, it looks like this might be a square peg/round hole problem; it might be better to get the dedicated server running on a standard Linux machine, then letting me know what was needed to get that working -- then I can apply changes to the image to make it work going forward. Fundamentally this seems to be an issue with running the Windows binary on Linux -- until that's solved and repeatable, the docker image will never work correctly.

Other references:
Official dedicated server useful posts
Space Engineers dedicated server configuration

@r-pufky
Copy link
Owner

r-pufky commented Jun 28, 2020

I left off this evening trying to get it to load the GUI since maybe I could at least prove it runs that way. But I get CantStartFromCommandLine as an error so I'm not sure if there is something that needs to happen to trick it into thinking it is in an interactive setting. Rumor is there is a "-console" flag that who knows what it does.

The -console flag launches the server going directly to the server console. See Space Engineers dedicated server configuration

r-pufky added a commit that referenced this issue Jun 28, 2020
@r-pufky
Copy link
Owner

r-pufky commented Feb 6, 2022

Closing issue due to lack of updates.

@r-pufky r-pufky closed this as completed Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants