GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.3k stars 819 forks source link

[FEATURE] Mod Integration Valheim Server #3287

Closed Tiberius1OOO closed 3 years ago

Tiberius1OOO commented 3 years ago

User Story

I want the LinuxGSM script to be able to start the Unity Mod Container/Wrapper that one can use to add Mods to the server.

Link to the container: // https://github.com/BepInEx/BepInEx //

Link to a mod that also integrates the correct version of the container

// https://github.com/nxPublic/ValheimPlus //

Basic info

Further Information

The above container is basically a standart tool to load mods into unity, this tool can be used to load a various amount of mods and integrate them into the binary via inject.

The binary loads the game server which is obviously not something linuxgsm would allow since GSM is a container in and on itself. It would be amazing if that would be added since this would change a lot and would lift LinuxGSM apart from any free hoster and maybe more people would not only use LinuxGSM but would also learn to understand how linux works.

Further Reading

Link to the container: // https://github.com/BepInEx/BepInEx //

Link to a mod that also integrates the correct version of the container

// https://github.com/nxPublic/ValheimPlus //

paddywaan commented 3 years ago

P.S atleast for valheim, it is required to replace the core library dll's with unstripped versions in order for bepinex to run correctly. They can be acquired via: https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/ under the corlib directory.

After attempting to get an lgsm instance to execute ~/run_bepinex.sh, which in turn was executing its patchers and chainloaders before finally executing valheim_server.x86_64 $@, i discovered that lgsm was unable to run the .sh directly. At this point I'm out of my depth with bash and would ideally wish for some form of official implementation by lgsm to incorporate the bepinex modloader for unity titles.

yolst commented 3 years ago

I would love to see this, too. For now, is there any workaround to load the bepinex mods with the steamCMD server?

Rsslone commented 3 years ago

So I think I figured out what block of script needs to be amended but I'm not sure where the actual startup of the server happens, anyone know where to paste this?


# NOTE: Do not edit unless you know what you are doing!
####
export DOORSTOP_ENABLE=TRUE
export DOORSTOP_INVOKE_DLL_PATH=./BepInEx/core/BepInEx.Preloader.dll
export DOORSTOP_CORLIB_OVERRIDE_PATH=./unstripped_corlib

export LD_LIBRARY_PATH=./doorstop_libs:$LD_LIBRARY_PATH
export LD_PRELOAD=libdoorstop_x64.so:$LD_PRELOAD
####
X3ph1s commented 3 years ago

The closest I could get it to running was by copying the contents of run_Bepinex.sh to the common.cfg in the lgsm config folder, or directing it to the bepinex.sh from there. I've gotten it to run even but no monitoring or interaction.

Rsslone commented 3 years ago

Yeah it seems like the best solution I've got is to just install the unix version of bepinex that is hosted on valheim plus mod page / github and run it from their own start script.

X3ph1s commented 3 years ago

The new version of V+ has a deprecated script that doesn't force executable, I'm still installing it but it looks like you can point it to the lgsm start.sh file

paulvilla commented 3 years ago

I would also like it to be implemented in the lgsm script by default because it is a very good way to add mods

Twanislas commented 3 years ago

Hi there !

I'm trying to do that too, to no avail, here's my progress so far, hope it helps ;)

lgs@games:~$ cd valheim/

lgs@games:~/valheim$ ll
total 68
drwxr-xr-x  5 lgs lgs     7 Feb 26 08:34 ./
drwxr-xr-x 12 lgs lgs    18 Feb 26 09:50 ../
drwxrwxr-x  8 lgs lgs     8 Feb 25 08:53 lgsm/
-rwxrwxr-x  1 lgs lgs 15934 Feb 25 08:53 linuxgsm.sh*
drwxrwxr-x  4 lgs lgs     5 Feb 26 10:24 log/
drwxrwxr-x  9 lgs lgs    23 Feb 26 10:49 serverfiles/
-rwxrwxr-x  1 lgs lgs 15936 Feb 25 08:53 vhserver*

lgs@games:~/valheim$ ll serverfiles/
total 64952
drwxrwxr-x 9 lgs lgs       23 Feb 26 10:49  ./
drwxr-xr-x 5 lgs lgs        7 Feb 26 08:34  ../
drwxrwxr-x 6 lgs lgs        6 Feb 26 10:49  BepInEx/
-rwxrwxr-x 1 lgs lgs     4728 Feb 25 08:54  LinuxPlayer_s.debug*
drwxrwxr-x 3 lgs lgs        3 Feb 25 08:53  Saved/
-rwxrwxr-x 1 lgs lgs 29484584 Feb 25 08:54  UnityPlayer.so*
-rwxrwxr-x 1 lgs lgs  7041000 Feb 25 08:54  UnityPlayer_s.debug*
-rwxrwxr-x 1 lgs lgs   131994 Feb 25 08:54 'Valheim Dedicated Server Manual.pdf'*
-rw-rw-r-- 1 lgs lgs      908 Feb 26 10:49  doorstop_config.ini
drwxrwxr-x 2 lgs lgs        6 Feb 26 10:49  doorstop_libs/
drwxrwxr-x 2 lgs lgs        3 Feb 25 08:54  linux64/
-rwxrwxr-x 1 lgs lgs        2 Feb 25 08:54  server_exit.drp*
-rw-rw-r-- 1 lgs lgs     1937 Feb 26 10:49  start_game_bepinex.sh
-rwxrwxr-x 1 lgs lgs      575 Feb 25 08:54  start_server.sh*
-rw-rw-r-- 1 lgs lgs      877 Feb 26 10:49  start_server_bepinex.sh
-rwxrwxr-x 1 lgs lgs       34 Feb 25 08:54  start_server_xterm.sh*
-rwxrwxr-x 1 lgs lgs        7 Feb 25 08:54  steam_appid.txt*
drwxrwxr-x 5 lgs lgs        7 Feb 25 08:54  steamapps/
-rwxrwxr-x 1 lgs lgs 29456421 Feb 25 08:54  steamclient.so*
drwxrwxr-x 2 lgs lgs       72 Feb 26 10:49  unstripped_corlib/
-rwxrwxr-x 1 lgs lgs     6344 Feb 25 08:54  valheim_server.x86_64*
drwxrwxr-x 6 lgs lgs       30 Feb 26 10:26  valheim_server_Data/
-rw-rw-r-- 1 lgs lgs    23040 Feb 26 10:49  winhttp.dll

lgs@games:~/valheim$ export DOORSTOP_ENABLE=TRUE
lgs@games:~/valheim$ export DOORSTOP_INVOKE_DLL_PATH=$HOME/valheim/serverfiles/BepInEx/core/BepInEx.Preloader.dll
lgs@games:~/valheim$ export DOORSTOP_CORLIB_OVERRIDE_PATH=$HOME/valheim/serverfiles/unstripped_corlib
lgs@games:~/valheim$ export LD_LIBRARY_PATH="$HOME/valheim/serverfiles/doorstop_libs:$LD_LIBRARY_PATH"
lgs@games:~/valheim$ export LD_PRELOAD="libdoorstop_x64.so:$LD_PRELOAD"
lgs@games:~/valheim$ export LD_LIBRARY_PATH="$HOME/valheim/serverfiles/linux64:$LD_LIBRARY_PATH"
lgs@games:~/valheim$ ./vhserver start
readlink: symbol lookup error: /home/lgs/valheim/serverfiles/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
dirname: symbol lookup error: /home/lgs/valheim/serverfiles/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
readlink: symbol lookup error: /home/lgs/valheim/serverfiles/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
basename: symbol lookup error: /home/lgs/valheim/serverfiles/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
cut: symbol lookup error: /home/lgs/valheim/serverfiles/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
whoami: symbol lookup error: /home/lgs/valheim/serverfiles/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
mkdir: cannot create directory '/lgsm': Permission denied
fetching GitHub core_functions.sh...ERROR
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
mkdir: cannot create directory '/lgsm': Permission denied
fetching Bitbucket core_functions.sh...FAIL
./vhserver: line 122: core_exit.sh: command not found
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
mkdir: cannot create directory '/lgsm': Permission denied
./vhserver: line 378: fn_fetch_config: command not found
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
mkdir: cannot create directory '/lgsm': Permission denied
copying _default.cfg...Failed to hook dlsym, ignoring it. Error: no such function: dlsym
cp: cannot stat '/lgsm/config-default/config-lgsm/vhserver/_default.cfg': No such file or directory
FAIL

Let me know if any other info would be useful.

Cheers, and thanks for LinuxGSM, it's awesome !

dertexaner85 commented 3 years ago

I can't test right now The only way I can think of that would make it work at the moment would be:

Twanislas commented 3 years ago

Oooooh thanks a lot @dertexaner85, I wonder why I did not think about doing it this way !?

1) Edit start_server_bepinex.sh and replace the arguments of Valheim executable with $@ so the last line looks like this : exec ./valheim_server.x86_64 $@ 2) Add executable="./start_server_bepinex.sh" to your your vhserver.cfg 3) Works like a charm :)

Rsslone commented 3 years ago

Indeed, the above solutions work, thank you!

Just to clarify a possible error, since I don't know if that is valid or not but the script works without the exec. I just commented out the arguments and added the modification as proposed. Example below for anyone reading.


#!/bin/sh
export templdpath=$LD_LIBRARY_PATH

# BepInEx-specific settings
# NOTE: Do not edit unless you know what you are doing!
####
export DOORSTOP_ENABLE=TRUE
export DOORSTOP_INVOKE_DLL_PATH=./BepInEx/core/BepInEx.Preloader.dll
export DOORSTOP_CORLIB_OVERRIDE_PATH=./unstripped_corlib

export LD_LIBRARY_PATH=./doorstop_libs:$LD_LIBRARY_PATH
export LD_PRELOAD=libdoorstop_x64.so:$LD_PRELOAD
####

export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970

echo "Starting server PRESS CTRL-C to exit"

# Tip: Make a local copy of this script to avoid it being overwritten by steam.
# NOTE: Minimum password length is 5 characters & Password cant be in the server name.
# NOTE: You need to make sure the ports 2456-2458 is being forwarded to your server through your local router & firewall.
./valheim_server.x86_64 $@
# -name "Valheim Server" -port 2456 -world "Dedicated" -password "secret"

export LD_LIBRARY_PATH=$templdpath
gOOvER commented 3 years ago

The Valheim Server is btw Steam App ID 896660 (https://steamdb.info/app/896660/) and not 892970

Rsslone commented 3 years ago

That AppID is correct, if you use 896660 the server will crash.

02/26/2021 15:18:15: Using environment steamid 896660
02/26/2021 15:18:15: Using steam APPID:896660
02/26/2021 15:18:15: Invalid APPID
02/26/2021 15:18:15: Steam is not initialized
02/26/2021 15:18:16: Steam manager on destroy
paulvilla commented 3 years ago

I have followed the steps as you said and I can't get it to have a normal file load. You could explain step by step how to implement it, because there is something I am doing wrong. Thank you

xaenerys0 commented 3 years ago

@paulvilla Here are the steps I took to get it to load and run correctly from a fresh install of LGSM:

  1. Extract UnixServer.zip into /home/vhserver/serverfiles
  2. Run "chmod 755 start_server_bepinex.sh"
  3. Edit start_server_bepinex.sh and replace the arguments of Valheim executable with $@ so the last line looks like this: ./valheim_server.x86_64 $@
  4. Add/Edit executable="./start_server_bepinex.sh" in your vhserver.cfg
  5. Run "sudo apt install libc6-dev"
  6. Start the server.

Basically, the steps provided by @dertexaner85.

paulvilla commented 3 years ago

@atipper I have done as you say and it seems to be fine, I have not been able to activate the client version verification in the configurations because it told me that I did not have the latest version (I do have it)

But I see the following error that at the moment nothing happens because people enter with the IP but in the search engine the server looks bad the name

image

image

image

I have a question, in the logs it is normal for this to appear, from what I see if it loads the mod, but I'm worried:

In logs it is normal for this to appear image

this is the file below, if it seems to load but from the original game folder image

Thanks for the help to all guys

dertexaner85 commented 3 years ago

@paulvilla Did you use the "valheim" version of bepinex with the unstripped Unity + Mono BCL DLLs ? https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/

Budman17r commented 3 years ago

so on centos 8 I had to do

sudo yum install glibc-devel
wakcjob commented 3 years ago

Adding to what @dertexaner85 said: If your server name has a space, or spaces, in it you will need to add quotes around the $@ in your start_server_bepinex.sh exec ./valheim_server.x86_64 "$@"

ghost commented 3 years ago

@paulvilla Here are the steps I took to get it to load and run correctly from a fresh install of LGSM:

  1. Extract UnixServer.zip into /home/vhserver/serverfiles
  2. Run "chmod 755 start_server_bepinex.sh"
  3. Edit start_server_bepinex.sh and replace the arguments of Valheim executable with $@ so the last line looks like this: ./valheim_server.x86_64 $@
  4. Add/Edit executable="./start_server_bepinex.sh" in your vhserver.cfg
  5. Run "sudo apt install libc6-dev"
  6. Start the server.

Basically, the steps provided by @dertexaner85.

Where do you download UnixServer.zip?

When I download the mod from https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/, I get the folder "denikson-BepInExPack_Valheim-5.4.701", but that doesn't contain any UnixServer.zip?

Rsslone commented 3 years ago

@WonderingDane

I get the folder "denikson-BepInExPack_Valheim-5.4.701", but that doesn't contain any UnixServer.zip?

1- that's not the latest version (It just updated) 2- that's the correct files you need, simply follow the steps. You don't extract a "UnixServer.zip" you're extracting the contents of the archive to /home/vhserver/serverfiles/ ie. these files should be inside that dir https://i.imgur.com/KMKCgjK.png

xaenerys0 commented 3 years ago

@WonderingDane I was referring to Valheim Plus which includes a copy of BepInEx (whether or not that is up to date I am not sure).

h3o66 commented 3 years ago

I made now a inital integration for ValheimPlus, if anyone got a test server, feel free to test. See the connected PR

Tiberius1OOO commented 3 years ago

I made now a inital integration for ValheimPlus, if anyone got a test server, feel free to test. See the connected PR

how dose this work? and how do I integrate this now? there is only the LINUX GSm doc linked and I have never used Githup before this is not helping me saddly at all and I have the feeling that if this feature request will be closed this will never get added.

Rsslone commented 3 years ago

how dose this work? and how do I integrate this now? there is only the LINUX GSm doc linked and I have never used Githup before this is not helping me saddly at all and I have the feeling that if this feature request will be closed this will never get added.

I'm only a half baked user, but what I believe is going on here is they're asking for testers to manually grab the PR (Pull Request) and test it on a test server. I'd probably recommend following our instructions above, as it might be easier to do since you're only messing around with the game server files and one config file, the PR would have you mess with your LGSM install.

I.E be patient, people are hard at work to make it happen, and look out for the feature request to close, due to being implemented.

Tiberius1OOO commented 3 years ago

how dose this work? and how do I integrate this now? there is only the LINUX GSm doc linked and I have never used Githup before this is not helping me saddly at all and I have the feeling that if this feature request will be closed this will never get added.

I'm only a half baked user, but what I believe is going on here is they're asking for testers to manually grab the PR (Pull Request) and test it on a test server. I'd probably recommend following our instructions above, as it might be easier to do since you're only messing around with the game server files and one config file, the PR would have you mess with your LGSM install.

I.E be patient, people are hard at work to make it happen, and look out for the feature request to close, due to being implemented.

Ahh thank you so much. Yeah as someone how only kows a bit about programing and nothing else this was super confusing I just realized stack overflow was a thing 6 month ago.. still discovering everything. Thanks so much for clearig up that confusion ^^

Zxurian commented 3 years ago

@paulvilla Here are the steps I took to get it to load and run correctly from a fresh install of LGSM:

  1. Extract UnixServer.zip into /home/vhserver/serverfiles
  2. Run "chmod 755 start_server_bepinex.sh"
  3. Edit start_server_bepinex.sh and replace the arguments of Valheim executable with $@ so the last line looks like this: ./valheim_server.x86_64 $@
  4. Add/Edit executable="./start_server_bepinex.sh" in your vhserver.cfg
  5. Run "sudo apt install libc6-dev"
  6. Start the server.

Basically, the steps provided by @dertexaner85.

A heads up to anyone finding there way here, and for @h3o66 with the pull request. It looks like one of the recent updates for V+ is parsing the arguments on the command line, so step 3 in those instructions actually doesn't run the arguments. Just skip step 3 entirely and the start_server_bepinex.sh will auto parse the arguments provided to it.

Batch381 commented 3 years ago

Anyone else getting the "incompatible version" after doing this?

jjones18 commented 3 years ago

Anyone else getting the "incompatible version" after doing this?

I am and i can't seem to figure out why. i tested it and it's still loading vanilla valheim. i've followed all the directions perfectly and on the main valheim plus site for unix servers.

Caffeinedesign commented 3 years ago

Anyone else getting the "incompatible version" after doing this?

I am and i can't seem to figure out why. i tested it and it's still loading vanilla valheim. i've followed all the directions perfectly and on the main valheim plus site for unix servers.

i just installed it on my server, followed @atipper steps and made it working (i think, cause it connects and prompts for password), but have incompatible version error :(

Caffeinedesign commented 3 years ago

update:

my server is

could be the problem?

Caffeinedesign commented 3 years ago

Anyone else getting the "incompatible version" after doing this?

I am and i can't seem to figure out why. i tested it and it's still loading vanilla valheim. i've followed all the directions perfectly and on the main valheim plus site for unix servers.

i installed on server the nexusmods version of plus and it seems to work, i connect to server and it takes my plus data (i tried to set backpack weight to 500 in my client plus and i have 500 on server)

i have also set this:

; This settings add a version control check to make sure that people that try to join your game or the server you try to join has V+ installed enforceMod=false

Batch381 commented 3 years ago

I can confirm this, I have found this from somewhere else but @Caffeinedesign beat me to it here :D changing "enforceMod" to false fixed this issue of the "Incompatible version" for me

Tiberius1OOO commented 3 years ago

I can confirm this, I have found this from somewhere else but @Caffeinedesign beat me to it here :D changing "enforceMod" to false fixed this issue of the "Incompatible version" for me

NO NEVER DO THAT! never change that that means player can set up whatever they want!

this is a problem with the mod and not the game client, you guys should have read the FAQ and HOW TO INSTALL V+ because you need the same configurations what you basically did was giving your users the posibility to give themself admin rights on there server by editing the config files.

Normaly you edit the config file and copy paste these to the client and BOOM the error message is gone cuz nobody cheats now.

But this should not belong here this shoul dbelong in the valheim + discord or on the github to valheim +

Caffeinedesign commented 3 years ago

I can confirm this, I have found this from somewhere else but @Caffeinedesign beat me to it here :D changing "enforceMod" to false fixed this issue of the "Incompatible version" for me

NO NEVER DO THAT! never change that that means player can set up whatever they want!

this is a problem with the mod and not the game client, you guys should have read the FAQ and HOW TO INSTALL V+ because you need the same configurations what you basically did was giving your users the posibility to give themself admin rights on there server by editing the config files.

Normaly you edit the config file and copy paste these to the client and BOOM the error message is gone cuz nobody cheats now.

But this should not belong here this shoul dbelong in the valheim + discord or on the github to valheim +

For now my server is private, and probably i'll use It only for friends, and... I have set It to false in client not in server 😅

Cave-Johnson commented 3 years ago

Using the previous version of start_server_bepinex.sh from stable 0.9 (https://github.com/valheimPlus/ValheimPlus/releases/download/0.9/UnixServer.tar.gz) still works with the updated version of the mod.

Seems they have changed the way the script parses options so adding $@ doesn't work the same way as before and the server isn't loading the mod correctly

Zxurian commented 3 years ago

V+ moderators just merged my pull request so with their next push it will work transparently with lgsm (which I also use) without any modification needed from the lgsm side for start parameters.

shadowdogg commented 3 years ago

V+ moderators just merged my pull request so with their next push it will work transparently with lgsm (which I also use) without any modification needed from the lgsm side for start parameters.

Can you please detail it here for the rest of us.

Cave-Johnson commented 3 years ago

Yes please link here, interested to see the details! Thanks for your work to get this supported properly

Zxurian commented 3 years ago

link to PR: https://github.com/valheimPlus/ValheimPlus/pull/378

shadowdogg commented 3 years ago

link to PR: valheimPlus/ValheimPlus#378

Works perfectly. Thanks

valheimplayer commented 3 years ago

Can someone post a step-by-step summary of what to do as of now? Very much appreciated!

zayadur commented 3 years ago

@h3o66 https://github.com/GameServerManagers/LinuxGSM/issues/3287#issuecomment-792275858

I made now a inital integration for ValheimPlus, if anyone got a test server, feel free to test. See the connected PR

Implemented these changes and tested it. So far so good. Thank you kindly!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.