[GUIDE]Dedicated Server On Linux

Users who are viewing this thread

Forewarning
This guide is somewhat advanced for linux beginners.

Installing Dependencies

Wine
Install wine however you like. Both PopOS repositories (wine6) and WineHQ repositories(wine7) work fine, tested. Just make sure to run winecfg to install .NetFramework after wine is installed.

SteamCMD
Follow the instructions here.

Installing Bannerlord Server Using Steam
Replace anonymous with your steam username that owns Bannerlord. Currently, sadly, downloading/updating the server files without logging in with your username isn't possible.
Code:
steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir /home/username/BannerlordServer +login anonymous +app_update 1863440 +exit

Solving Missing Files In the Server Files
For some reason, Taleworlds forgot to include some files along with the v1.0 release update. To avoid DirectoryDoesntExist Exception, copy over "MultiplayerForcedAvatars" folder inside "Native" folder from the game, to the /home/username/BannerlordServer/Modules/Native folder. This solves the issue.

Not Sure if Required But Better Safe Than Sorry
Go into /home/username/BannerlordServer/_CommonRedist/vcredist/2019/ and install the package using wine.
Code:
wine VC_redist.x64.exe

Automating

Environment Path for SteamCMD
This step is required to be able to run steamcmd from systemd. Create bin folder in your home directory if it already doesn't exist. Copy the steamcmd executable or create a link to it.
Code:
mkdir bin
ln -s [fullSteamCmdPath] /home/user/bin/steamcmd
Make sure the paths are full paths.

Script to Run the Server
Create a file called "RunBannerlordServer.sh" on your home directory, paste the code below then modify. Don't forget to make it executable by doing "chmod +x RunBannerlordServer.sh"
Code:
#!/bin/sh

#Replace anonymous with steam username. It asks for steam guard password once, afterwards it is able to auto login and update.
bin/steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir /home/username/BannerlordServer +login anonymous +app_update 1863440 +exit

#The Working Directory needs to be Win64_Shipping_Server. So we have to navigate to that folder before running the server.
cd /home/username/BannerlordServer/bin/Win64_Shipping_Server

#Replace longAssAuthKey at the end with your private auth token
wine DedicatedCustomServer.Starter.exe  /dedicatedcustomserverconfigfile ds_config_sample_team_deathmatch.txt /DisableErrorReporting /dedicatedcustomserverauthtoken longAssAuthKey

Systemd Service
Create a new file in /etc/systemd/system/ called "BannerlordServer.service". Like this:
Code:
sudo touch /etc/systemd/system/BannerlordServer.service
Paste the code below into the new service file with your favourite text editor.
Code:
[Unit]
Description=BannerlordServer
After=syslog.target network.target

[Service]
ExecStart=/home/username/RunBannerlordServer.sh
Restart=always
SyslogIdentifier=BannerlordServer
User=username
Group=username
Type=simple

[Install]
WantedBy=multi-user.target

Reload systemd daemon, then enable the service. Then start it.
Code:
sudo systemctl daemon-reload
sudo systemctl enable BannerlordServer
sudo systemctl start BannerlordServer

Conclusion
It works.
 
Last edited:
I run only client on linux, works fine. But servers are another piece of cake, and to be honest it should be preferred way to run servers as windows servers are pos.
Maybe that's the reason why servers are crap?
 
I am fairly confident i read somewhere that the matchmaking servers were run on linux servers, though i don't recall which dev and where i saw it.

Still very sad that in 2022 we are still offered the monster that is windows server as only hosting option.
 
I was able to make my server run on Debian when Dedicated server came out, but never managed to make it run as systemd, can't get wine to work as a service.

EDIT:
Nevermind, just managed to make it work as a service
 
Last edited:
Okay, I figured it out. The issue turned out to be utterly stupid, you have to navigate to the Win64_Shipping_Server folder first, then launch the server using wine. wineconsole isn't necessary.

Like this (works):
Code:
cd /home/tama/BannerlordServer/bin/Win64_Shipping_Server

wine DedicatedCustomServer.Starter.exe arguments

instead of doing (doesn't work):
Code:
wine /home/tama/BannerlordServer/bin/Win64_Shipping_Server/DedicatedCustomServer.Starter.exe arguments
 
TW servers run on linux, it will just be a matter of time till they will support it. How much performance loss do you get if you run a server through wine? Doubt it is worth it
 
TW servers run on linux, it will just be a matter of time till they will support it. How much performance loss do you get if you run a server through wine? Doubt it is worth it
That is highly irrelevant, it's not like I'm running a server for hundreds of players.

Edit: Technically "a matter of time". But considering how long it is taking them to roll out the features they have already demonstrated in videos, and how long it took them to release dedicated server, we are talking about a long time.

Even if TW had announced linux servers would never be supported, using windows would still not be an option in the meantime . I already had a linux server running various things 24/7. Why would i use another machine, physical or otherwise, for bannerlord? With windows no less. That ****ty os doesnt belong anywhere close to a server machine. I can barelly suffer through windows on a desktop when i have to.
 
Last edited:
That is highly irrelevant, it's not like I'm running a server for hundreds of players.

Edit: Technically "a matter of time". But considering how long it is taking them to roll out the features they have already demonstrated in videos, and how long it took them to release dedicated server, we are talking about a long time.

Even if TW had announced linux servers would never be supported, using windows would still not be an option in the meantime . I already had a linux server running various things 24/7. Why would i use another machine, physical or otherwise, for bannerlord? With windows no less. That ****ty os doesnt belong anywhere close to a server machine. I can barelly suffer through windows on a desktop when i have to.
*sigh* calm down u muppet, performance is relevant maybe not for your case and it was just a question.
https://moddocs.bannerlord.com/multiplayer/hosting_server/#will-you-provide-linux-support

Using windows is for you not an option, never said you have to use it. You published a damn guide, like for the love of god why do you take it all so personal to your own situation. It's a GUIDE. Also tune down your linux big **** energy a bit eh, your entire reaction is irrelevant to this guide lol.

So back ontopic I was just asking how much performance this WINE adaptation loses you, WINE can be really good but also quite bad hence me asking as I'm curious and it is interesting for this guide as for its usability. I'm very happy that you made this guide and I'm just asking a question about performance, it is not a personal attack ffs.
 
Even when running with wine, it probably performs better than windows. Because factors that define performance are subjective; how well a system runs, stability, power draw, maintenance, etc, are often overlooked. Then there's also the fact that cpu's achieve better performance per watt on linux.

I've seen a Ryzen 5 5600 with 3200Mhz memory on linux easily beat Ryzen 5 5600X with 3600Mhz memory on windows when you compare them with geekbench 5.

 
Hello,

I've tried to follow the guide to start a dedicated server on Linux / LXC Container / Debian 11.

But always failing

Thanks for your help.

steam@bannerlord:~$ sudo ./RunBannerlordServer.sh
WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'. International characters may not work.
Redirecting stderr to '/root/Steam/logs/stderr.txt'
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[ 0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1669935972
-- type 'quit' to exit --
Loading Steam API...OK
"@sSteamCmdForcePlatformType" = "windows"
Logging in user 'verrnum92100' to Steam Public...Warning: failed to set thread priority: set failed for 8: -1: setpriority() failed
Warning: failed to set thread priority: set failed for priority 8
Warning: support for elevated priorities is most likely unavailable, suppressing future warnings
Warning: failed to set thread priority: set failed for 8: -1: setpriority() failed
CHIDDeviceListSDL(): Couldn't load libSDL2-2.0.so.0, not enumerating devices
OK
Waiting for client config...OK
Waiting for user info...OK
Success! App '1863440' already up to date.
002c:fixme:winediag:LdrInitializeThunk wine-staging 7.22 is a testing version containing experimental patches.
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.
008c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
008c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
008c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
008c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0048:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
0048:err:systray:initialize_systray Could not create tray window

0114:fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (000000000041F9D0 1 C) semi-stub
0114:fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (000000000041FA40 1 C) semi-stub


[11:20:32.058] Mount and Blade II Bannerlord Console Started...
[11:20:32.059] 18 Dec 2022 Sunday 11:20 Greenwich Standard Time
[11:20:32.059] Build Version: 6960
[11:20:32.060] Loading xml file: $BASE/Modules/DedicatedCustomServerHelper/SubModule.xml.
[11:20:32.060] Loading xml file: $BASE/Modules/Multiplayer/SubModule.xml.
[11:20:32.061] Loading xml file: $BASE/Modules/Native/SubModule.xml.
[11:20:32.061] Loading xml file: $BASE/Modules/Native/SubModule.xml.
[11:20:32.063] Loading xml file: $BASE/Modules/Multiplayer/SubModule.xml.
[11:20:32.064] Command Args: /dedicatedcustomserverconfigfile ds_config_sample_team_deathmatch.txt /DisableErrorReporting /LogOutputPath /home/steam/logs /dedicatedcustomserverauthtoken MY_TOKEN /dedicatedcustomserver 7210 USER 0 /playerhosteddedicatedserver
[11:20:32.065] try_to_get_cache_save_privilege result : 1
[11:20:32.065] Loading xml file: $BASE/Modules/Native/ModuleData/project.mbproj.
[11:20:32.068] reading physics_material xml files
[11:20:32.068] file: ModuleData/physics_materials.xml
[11:20:32.068] Loading xml file: $BASE/Modules/Native/ModuleData/physics_materials.xml.
[11:20:32.069] Loading xml file: $BASE/Modules/Native/ModuleData/project.mbproj.
[11:20:32.069] reading physics_material xml files
[11:20:32.069] file: ModuleData/physics_materials.xml
[11:20:32.069] Loading xml file: $BASE/Modules/Native/ModuleData/physics_materials.xml.
[11:20:32.072] Loading xml file: $BASE/Modules/Native/ModuleData/project.mbproj.
[11:20:32.072] reading module_sound xml files
[11:20:32.072] file: ModuleData/module_sounds.xml
[11:20:32.072] Loading xml file: $BASE/Modules/Native/ModuleData/module_sounds.xml.
[11:20:32.081] Loading packages $BASE/Modules/Native/DsAssetPackages...
0120:fixme:heap:GetNumaHighestNodeNumber semi-stub: 0000000016C4F538
0120:fixme:seh:WerRegisterRuntimeExceptionModule (L"Z:\\home\\steam\\BannerlordServer\\bin\\Win64_Shipping_Server\\Microsoft.NETCore.App\\mscordaccore.dll", 000000001A820000) stub
0120:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
[11:20:32.320] Registering items...
[11:20:32.369] Unable to find item to add dependency(depender conversation_negative_confident)
[11:20:32.369] Unable to find item to add dependency(depender conversation_positive_confident)
[11:20:32.370] Unable to find item to add dependency(depender conversation_trivial_confident)
[11:20:32.370] Unable to find item to add dependency(depender conversation_unsure_confident)
[11:20:32.371] Unable to find item to add dependency(depender conversation_very_negative_confident)
[11:20:32.371] Unable to find item to add dependency(depender conversation_very_positive_confident)
[11:20:32.399] Initializing items
[11:20:32.423] --------------Mono Loading Step::eek:n_managed_interface_init--------------
[11:20:32.424] --------------Mono Loading Step::managed_interface_init--------------
Fatal error. Internal CLR error. (0x80131506)
0144:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
0144:fixme:advapi:ReportEventW (00000000CAFE4242,0x0001,0x0000,0x000003ff,0000000000000000,0x0001,0x00000000,000000003514DF00,0000000000000000): stub
0144:err:eventlog:ReportEventW L"Application: DedicatedCustomServer.Starter.exe\nCoreCLR Version: 4.700.22.51102\nDescription: The process was terminated due to an internal error in the .NET Runtime at IP 000000001A8AB98B (000000001A820000) with exit code 80131506.\n"
0144:fixme:advapi:grin:eregisterEventSource (00000000CAFE4242) stub
0144:fixme:seh:RaiseFailFastException (000000003514F9E0, 000000003514F4F0, 0) stub
 
Hello, is this guide up to date? I think the files for the linux dedicated server /Linux64_Shipping_Server are already there.

My idea is to implement it on a linux server (not client), is it possible?

https://moddocs.bannerlord.com/multiplayer/hosting_server/#will-you-provide-linux-support
Hey, you can still use this way (Windows files with Wine as an emulator), but using Native Linux files is, indeed, possible now. I wrote a short guide for that earlier today, see here.
 
Back
Top Bottom