Difference between revisions of "Linux Installation Guide"

From BTAWiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
<div id="" class="" style="clear: right; margin: -1em 0 0 10px; float: right; padding: 10px; background: transparent; width: 200px; ">__TOC__</div>
 
<div id="" class="" style="clear: right; margin: -1em 0 0 10px; float: right; padding: 10px; background: transparent; width: 200px; ">__TOC__</div>
  
'''Thanks to Indigo for writing this guide!'''
+
This guide assumes you are running the native linux version BattleTech. If you installed the windows version and got it running through wine, parts of this guide may still be helpful, but it won't work exactly step by step.
  
This guide assumes you are using the native Linux version of BattleTech. If you installed the Windows version, got it running with Proton, and successfully installed BTA, please write up a document similar to this one for your scenario.
+
= 0. Disclaimer. =
  
= 1. Prepare =
+
The BTA Team does not *officially* support Linux installations. The below guide is provided as-is and is not guaranteed to work for all possible configurations and installations of Linux due to Linux's variability as an OS. If it doesn't work, you are on your own. Ye be warned.
  
== 1.1. Set some vars we’ll need later to avoid typos ==
+
= 1. Preparation. =
 +
All of these steps are necessary. Seriously, don't skip them - you'll get weird errors later on even if installing the mod seems to succeed at first.
  
Double-check these paths with your local installation, they may be different.
+
== 1.1. Install Wine and winetricks ==
 +
You'll need to install Wine in order to run the installer. On debian-based systems (such as Ubuntu), you can install it with
  
  $ BTA_ROOT="$HOME/src/BATTLETECH/BTA"
+
  $ sudo apt-get install wine winetricks
=== Steam on Debian ===
 
  
$ BT_ROOT="$HOME/.steam/debian-installation/steamapps/common/BATTLETECH"
+
Other distributions will have their own commands along similar lines.
=== Steam on other distros ===
 
  
Check your <code>$HOME/.steam</code> directory and modify the above environment variable assignment accordingly.
+
== 1.2. Install dotnet 4.7.2 ==
 +
Installing BTA also requires dotnet 4.7.2. If you fail to install dotnet, you won't notice issues until you try to actually run the game. '''Do not skip this step'''.
  
=== GOG ===
+
$ winetricks dotnet472
 +
== 1.3. Raising the open files limit ==
 +
Most distributions default to a limit of 1024 open files at once, but you'll need to raise this for your user by editing /etc/security/limits.conf
  
  $ BT_ROOT="$HOME/GOG Games/BATTLETECH"
+
  $ sudo nano /etc/security/limits.conf
== 1.2. Ensure dependencies are installed ==
 
  
{| class="wikitable"
+
Insert these lines at the bottom of the file:
! Package*
 
! Purpose
 
|-
 
| wine
 
| run the installer
 
|-
 
| unzip
 
| unzip the installer package
 
|-
 
| jq
 
| allow pathfinder.sh to parse JSON
 
|}
 
  
<nowiki>*</nowiki> Package name may differ on your distribution.
+
*               hard    nofile          32768
 +
*              soft    nofile          32768
  
=== Debian &amp; Friends (Ubuntu, Mint, Pop_OS!, PureOS) ===
+
You'll need to log out and log back in, or restart your computer for this change to take effect.
  
$ sudo apt install wine unzip jq
+
= 2. Install BTA =
=== RedHat &amp; Friends (Fedora, SuSe) ===
+
== 2.1. Locate your BattleTech install and create Mods directory ==
 
 
$ sudo dnf install wine unzip jq
 
=== Arch &amp; Friends (Manjaro, GamerOS) ===
 
  
$ sudo pacman -S wine unzip jq
+
For Steam on Debian-based distributions, BattleTech is installed at ~/.steam/debian-installation/steamapps/common/BATTLETECH.
== 1.3. Prepare Wine prefix for the BTA installer. ==
 
  
The wine-mono package listed here is for reference only. You can get the most recent version from https://dl.winehq.org/wine/wine-mono/.
+
For GOG installs, the path will be something like `~/GOG Games/BATTLETECH/game`.
  
$ mkdir -p "${BTA_ROOT}"
+
You want the folder containing the BattleTech binary and a folder for BattleTech_Data. For example, on my system:
$ cd "${BTA_ROOT}"
 
$ wget https://dl.winehq.org/wine/wine-mono/6.1.0/wine-mono-6.1.0-x86.msi
 
$ WINEPREFIX="${BTA_ROOT}/wine64" WINEARCH=win64 wine msiexec /i wine-mono-6.1.0-x86.msi
 
== 1.4. Download the BTA installer and Extract the .zip into <code>${BTA_ROOT}</code> ==
 
  
You’ll have to manually download the [https://www.bta3062.com/files/BTAdvancedLauncher.php installer] from BTA3062.com. Save it to your <code>${BTA_ROOT}</code>. Then unzip it.  
+
$ ls -l ~/Games/BATTLETECH/game
 +
total 27788
 +
-rwxrwxr-x  1 bluewinds bluewinds 27147344 Dec 22 13:35 BattleTech
 +
drwx------  8 bluewinds bluewinds    20480 Dec 22 13:49 BattleTech_Data
 +
...more stuff...
  
'''Note:''' The file name for the Launcher may change in the future, adjust the below example to the correct file name as necessary.
+
In this directory, you'll need to create a Mods folder.
  
  $ unzip 'BattleTech Advanced 3062 Installer-452-v10-4-1624553953.zip'
+
  $ mkdir ~/Games/BATTLETECH/game/Mods
  
== 1.5. Prepare the Mods directory ==
+
== 2.2. Setup an installer directory and download the installer. ==
 +
You will need a directory to host the installer and cache '''outside the game directory'''. For purposes of this guide, we'll use BTAInstaller in your home directory, but feel free to use any other location outside of the game directory (and outside of .steam).
  
If you try to run BTA alongside other mods, problems are likely. If the Mods directory already exists, back it up (optional), and delete it.
+
This location will need at least 40gb of free space. The cache is big.
  
Clean up and create the Mods directory:
+
$ mkdir ~/BTAInstaller
 +
$ cd ~/BTAInstaller
  
$ rm -rf "${BT_ROOT}/Mods"
+
Download the installer into this directory and unzip it, either using [this link](https://www.bta3062.com/files/BTAdvancedLauncher.php) or by running:
$ mkdir -p "${BT_ROOT}/Mods"
 
== 1.6. Collect paths for the BTA installer ==
 
  
The installer needs to know where to install to. It does not know how to browse into Linux “hidden” paths (such as $HOME/.steam). Instead, you must copy and paste paths into the installer’s file/directory chooser after clicking the “Browse” button.
+
$ wget https://www.bta3062.com/files/BTAdvancedLauncher.php -O BTAdvancedLauncher.zip
 +
$ unzip BTAdvancedLauncher.zip
  
Also, the installer cannot parse Linux paths. You must convert them to Windows paths and include the Windows drive letter <code>Z:</code>, which is where wine mounts the Linux filesystem as if it were a Windows filesystem.
+
You should end up with BTAdvancedLauncher.exe in your install folder.
  
Collect those Windows paths:
+
$ ls -l ~/BTAInstaller
  
=== Install Target path ===
+
-rw-rw-rw- 1 bluewinds bluewinds 42516095 Jan  6 17:14 BTAdvancedLauncher.exe
 +
-rw-rw-r-- 1 bluewinds bluewinds 42295941 Feb  3 13:57 BTAdvancedLauncher.zip
  
Examples:
+
== 2.3 Configure the installer ==
 +
Run the BTAInstaller:
  
  $ echo "Z:${BT_ROOT}/Mods" | sed -e 's#/#\\#g'
+
  $ wine ~/BTAInstaller/BTAdvancedLauncher.exe
Z:\home\indigo\.steam\debian-installation\steamapps\common\BATTLETECH\Mods
 
=== Checkout Workspace path ===
 
  
$ echo "Z:${BTA_ROOT}" | sed -e 's#/#\\#g'
+
At the bottom left of the installer, click "Advanced Mode".
Z:\home\indigo\src\BATTLETECH\BTA
 
=== BattleTech.exe Binary path ===
 
  
$ echo "Z:${BT_ROOT}/BattleTech" | sed -e 's#/#\\#g'
+
You can then edit the "Install Target". Hit "Browse", and navigate to the location of the Mods folder you created in step 2.1.
Z:\home\indigo\.steam\debian-installation\steamapps\common\BATTLETECH\BattleTech
+
Also edit the "Checkout Workspace". Hit "Browse", and navigate to the installer directory you created in step 2.2.
= 2. Install BTA =
 
  
== 2.1. Run the installer ==
+
== 2.4 Install! ==
 +
You can now click "Update/Install BTA" to start the process.
  
$ WINEPREFIX="${BTA_ROOT}/wine64" WINEARCH=win64 wine BTAdvancedLauncher.exe
+
When prompted to configure your game, be sure to select "Old Fire / Linux" at the bottom. Select *only* the addons for DLC you own - enabling addons for DLC you haven't installed will lock up the game when you try to play. Multithreading and Corgi's Perfix can improve performance.
== 2.2. Click the “Advanced Mode” button. ==
 
  
'''''Click'''''
+
When it asks for the location of the BattleTech Binary ("Unable to locate BattleTech.exe"), navigate to your BattleTech install (see step 2.1) and select the "BattleTech" file.
  
== 2.3. Input the Install Target and Checkout Workspace paths ==
+
== 2.5 Enable ModTek 3.x ==
 +
=== Steam on Linux ===
  
Click the “Browse” button next to each path and copy/paste the Windows paths you made in step 1.6 into the “Filename” field of the file picker.
+
    Note These instructions are based on the Steam Guide for BepInEx.
  
== 2.4. Run the install ==
+
Instead of running the run.sh script directly, you need to ask Steam to run it for you.
  
Click the “Update/Install BTA” button. Pay attention to any popups or instructions.
+
Right mouse click on the game in the Steam library -> Properties... -> SET LAUNCH OPTIONS.
  
== 2.5. Choose your Advanced Configuration Options ==
+
Launch options for Linux:
  
Select all the things you want to install. Make sure Fire Option for Linux Users is set to “Old Fire for Linux Users”
+
    ./run.sh %command%
  
== 2.6. Wait for it. ==
+
=== GOG on Linux ===
  
After installing the mod, the installer will install ModTek. ModTek needs to know where your BattleTech binary lives. The installer cannot find BattleTech.exe and will ask you where to find it. Give it the “BattleTech.exe Binary path” collected earlier. It will not complain when there is not <code>.exe</code> extension on the filename.
+
Modify the start.sh script from GOG to execute the run.sh script from ModTek/UnityDoorstop instead of BattleTech.
  
== 2.7. Ensure all the paths and symlinks are correct ==
+
    #chmod +x "BattleTech"
'''Note:''' This step may not be necessary, depending on your distribution.
+
    #./"BattleTech"
 +
    ./run.sh
  
At this point the installation for Windows is complete. However, you’re not done. Because HBS was kind enough to provide us with a native binary, and because BTA’s installer runs as if it were a Windows program, we have to create some symlinks to make sure BattleTech can see all the mod files.
+
=== Proton/Wine on Linux ===
  
Thankfully some magical creature named “b2cc” has written a script to do this for us. The script is called “pathfinder.sh”. Download and run it.
+
Using Proton or Wine is also supported, make sure the winhttp.dll from UnityDoorstop is loaded by setting the override to native, builtin.
  
$ cd ${BT_ROOT}
+
= Troubleshooting =
$ wget https://gist.githubusercontent.com/b2cc/c312bec251aaecbfedd07e4d4bda512e/raw/f7fdaa5bc458372b421a6a207e93c4d9ea257901/pathfinder.sh
+
== Issue: The BTA Launcher will not run at step 2.1 and you get error message "MESA-INTEL:warning: processor code name Vulkan Support is incomplete" ==
$ less pathfinder.sh  # its up to you to make sure script doesn't do anything naughty!
+
Likely cause: Older hardware that OpenGL struggles with.
$ bash pathfinder.sh -c
 
You should see a lot of console spam and green success words.
 
 
 
If you do not, ask for help.
 
 
 
= 3. Okay, that’s it. =
 
 
 
All done. Run the game. Assuming all went well, you can go stomp around and get your dakka dakka pew pew on.
 
  
If for whatever reason things are not working, check the Troubleshooting section.
+
Solution: Run the following command in terminal before running the BTA Launcher with wine:
  
 +
$ export MESA_GL_VERSION_OVERRIDE=4.5
 +
== Issue: The Launcher gives you the error message "non-folder object in selection" when trying to point the Install Target to the correct folder through the Launcher's "browse" button ==
 +
Likely cause: Unknown
  
= Troubleshooting =
+
Solution: Edit the BTALauncherSettings.xml to apply the correct path, then restart the launcher to load up the correct path.
  
 
== Issue: The game loads but the main menu doesn’t say “BattleTech ADVANCED - 3062” and the ModTek version doesn’t show up under the game version next to the CREDITs button ==
 
== Issue: The game loads but the main menu doesn’t say “BattleTech ADVANCED - 3062” and the ModTek version doesn’t show up under the game version next to the CREDITs button ==
Line 148: Line 130:
 
Likely cause: ModTek isn’t patched into the game correctly.
 
Likely cause: ModTek isn’t patched into the game correctly.
  
This can happen if mono is incorrectly installed or was not installed before the BTA installer was run the first time.
+
This can happen if dotnet is incorrectly installed or was not installed before the BTA installer was run.
  
Solution: (re)run the ModTek Injector. It should look like this if it worked correctly:
+
Solution: Install dotnet472 with winetricks and (re)run the installer.
  
  $ cd ${BT_ROOT}/Mods/ModTek
+
  $ winetricks dotnet472
$ WINEPREFIX="${BTA_ROOT}/wine64" WINEARCH=win64 wine ModTekInjector.exe
+
Run the installer, and "Update/Install BTA" again.
ModTek Injector
 
---------------
 
 
Assembly-CSharp.dll backed up to Assembly-CSharp.dll.orig
 
Injecting Assembly-CSharp.dll with ModTek.Injection.LoadModTek at BattleTech.Main.Start
 
Writing back to Assembly-CSharp.dll...
 
Injection complete!
 
 
== Issue: BattleTech refuses to launch/crashes to desktop immediately ==
 
== Issue: BattleTech refuses to launch/crashes to desktop immediately ==
  
Line 169: Line 144:
 
  $ mkdir -p "${BTA_ROOT}/../BattleTech_Data/Plugins/x86_64/"
 
  $ mkdir -p "${BTA_ROOT}/../BattleTech_Data/Plugins/x86_64/"
 
  $ mv "${BT_ROOT}/BattleTech_Data/Plugins/x86_64/libc.so.6" "${BTA_ROOT}/../BattleTech_Data/Plugins/x86_64/"
 
  $ mv "${BT_ROOT}/BattleTech_Data/Plugins/x86_64/libc.so.6" "${BTA_ROOT}/../BattleTech_Data/Plugins/x86_64/"
 +
== Issue: My Battletech directory is hidden, and I can't select it in the installer ==
 +
 +
Likely cause: Wine is not configured to show hidden paths, such as those beginning with a dot.
 +
 +
Solution: Run winecfg and select the Drives tab. Check "Show dot files" at the bottom. Now hidden folders (such as ~/.steam) will be visible in the installer.
 +
 +
== Issue: The game wont run, or briefly runs and quits. ==
 +
 +
Open a terminal in the BattleTech dir where your binary for the game is located, you should see the run.sh there.  Run this command to convert the line endings from windows to unix
 +
 +
    sed -i -e 's/\r$//' run.sh
 +
 +
and mark the script as executable, and finally run the game.
 +
 
== Issue: Not listed here ==
 
== Issue: Not listed here ==
  
 
There are a few Linux users on the [https://discord.com/invite/g5nCYAV BTA Discord channel], you can ask for help in General Chat, message Indigo#8200 directly or open a support ticket with #ticketbot to get help resolving issues with BTA. For general issues with BattleTech on Linux, there are several forums available by searching your favorite search engine.
 
There are a few Linux users on the [https://discord.com/invite/g5nCYAV BTA Discord channel], you can ask for help in General Chat, message Indigo#8200 directly or open a support ticket with #ticketbot to get help resolving issues with BTA. For general issues with BattleTech on Linux, there are several forums available by searching your favorite search engine.

Latest revision as of 20:14, 14 November 2023

This guide assumes you are running the native linux version BattleTech. If you installed the windows version and got it running through wine, parts of this guide may still be helpful, but it won't work exactly step by step.

0. Disclaimer.

The BTA Team does not *officially* support Linux installations. The below guide is provided as-is and is not guaranteed to work for all possible configurations and installations of Linux due to Linux's variability as an OS. If it doesn't work, you are on your own. Ye be warned.

1. Preparation.

All of these steps are necessary. Seriously, don't skip them - you'll get weird errors later on even if installing the mod seems to succeed at first.

1.1. Install Wine and winetricks

You'll need to install Wine in order to run the installer. On debian-based systems (such as Ubuntu), you can install it with

$ sudo apt-get install wine winetricks

Other distributions will have their own commands along similar lines.

1.2. Install dotnet 4.7.2

Installing BTA also requires dotnet 4.7.2. If you fail to install dotnet, you won't notice issues until you try to actually run the game. Do not skip this step.

$ winetricks dotnet472

1.3. Raising the open files limit

Most distributions default to a limit of 1024 open files at once, but you'll need to raise this for your user by editing /etc/security/limits.conf

$ sudo nano /etc/security/limits.conf

Insert these lines at the bottom of the file:

*               hard    nofile          32768
*               soft    nofile          32768

You'll need to log out and log back in, or restart your computer for this change to take effect.

2. Install BTA

2.1. Locate your BattleTech install and create Mods directory

For Steam on Debian-based distributions, BattleTech is installed at ~/.steam/debian-installation/steamapps/common/BATTLETECH.

For GOG installs, the path will be something like `~/GOG Games/BATTLETECH/game`.

You want the folder containing the BattleTech binary and a folder for BattleTech_Data. For example, on my system:

$ ls -l ~/Games/BATTLETECH/game
total 27788
-rwxrwxr-x   1 bluewinds bluewinds 27147344 Dec 22 13:35 BattleTech
drwx------   8 bluewinds bluewinds    20480 Dec 22 13:49 BattleTech_Data
...more stuff...

In this directory, you'll need to create a Mods folder.

$ mkdir ~/Games/BATTLETECH/game/Mods

2.2. Setup an installer directory and download the installer.

You will need a directory to host the installer and cache outside the game directory. For purposes of this guide, we'll use BTAInstaller in your home directory, but feel free to use any other location outside of the game directory (and outside of .steam).

This location will need at least 40gb of free space. The cache is big.

$ mkdir ~/BTAInstaller
$ cd ~/BTAInstaller

Download the installer into this directory and unzip it, either using [this link](https://www.bta3062.com/files/BTAdvancedLauncher.php) or by running:

$ wget https://www.bta3062.com/files/BTAdvancedLauncher.php -O BTAdvancedLauncher.zip
$ unzip BTAdvancedLauncher.zip

You should end up with BTAdvancedLauncher.exe in your install folder.

$ ls -l ~/BTAInstaller
-rw-rw-rw- 1 bluewinds bluewinds 42516095 Jan  6 17:14 BTAdvancedLauncher.exe
-rw-rw-r-- 1 bluewinds bluewinds 42295941 Feb  3 13:57 BTAdvancedLauncher.zip

2.3 Configure the installer

Run the BTAInstaller:

$ wine ~/BTAInstaller/BTAdvancedLauncher.exe

At the bottom left of the installer, click "Advanced Mode".

You can then edit the "Install Target". Hit "Browse", and navigate to the location of the Mods folder you created in step 2.1. Also edit the "Checkout Workspace". Hit "Browse", and navigate to the installer directory you created in step 2.2.

2.4 Install!

You can now click "Update/Install BTA" to start the process.

When prompted to configure your game, be sure to select "Old Fire / Linux" at the bottom. Select *only* the addons for DLC you own - enabling addons for DLC you haven't installed will lock up the game when you try to play. Multithreading and Corgi's Perfix can improve performance.

When it asks for the location of the BattleTech Binary ("Unable to locate BattleTech.exe"), navigate to your BattleTech install (see step 2.1) and select the "BattleTech" file.

2.5 Enable ModTek 3.x

Steam on Linux

   Note These instructions are based on the Steam Guide for BepInEx.

Instead of running the run.sh script directly, you need to ask Steam to run it for you.

Right mouse click on the game in the Steam library -> Properties... -> SET LAUNCH OPTIONS.

Launch options for Linux:

   ./run.sh %command%

GOG on Linux

Modify the start.sh script from GOG to execute the run.sh script from ModTek/UnityDoorstop instead of BattleTech.

   #chmod +x "BattleTech"
   #./"BattleTech"
   ./run.sh

Proton/Wine on Linux

Using Proton or Wine is also supported, make sure the winhttp.dll from UnityDoorstop is loaded by setting the override to native, builtin.

Troubleshooting

Issue: The BTA Launcher will not run at step 2.1 and you get error message "MESA-INTEL:warning: processor code name Vulkan Support is incomplete"

Likely cause: Older hardware that OpenGL struggles with.

Solution: Run the following command in terminal before running the BTA Launcher with wine:

$ export MESA_GL_VERSION_OVERRIDE=4.5

Issue: The Launcher gives you the error message "non-folder object in selection" when trying to point the Install Target to the correct folder through the Launcher's "browse" button

Likely cause: Unknown

Solution: Edit the BTALauncherSettings.xml to apply the correct path, then restart the launcher to load up the correct path.

Issue: The game loads but the main menu doesn’t say “BattleTech ADVANCED - 3062” and the ModTek version doesn’t show up under the game version next to the CREDITs button

Likely cause: ModTek isn’t patched into the game correctly.

This can happen if dotnet is incorrectly installed or was not installed before the BTA installer was run.

Solution: Install dotnet472 with winetricks and (re)run the installer.

$ winetricks dotnet472

Run the installer, and "Update/Install BTA" again.

Issue: BattleTech refuses to launch/crashes to desktop immediately

Likely cause: Libc library conflict. The system libc is likely newer than, and incompatible with, the libc included in BattleTech’s native Linux distribution.

Solution: Remove libc.so.6 from the BattleTech game directory. This forces BattleTech to use the system libc.

$ mkdir -p "${BTA_ROOT}/../BattleTech_Data/Plugins/x86_64/"
$ mv "${BT_ROOT}/BattleTech_Data/Plugins/x86_64/libc.so.6" "${BTA_ROOT}/../BattleTech_Data/Plugins/x86_64/"

Issue: My Battletech directory is hidden, and I can't select it in the installer

Likely cause: Wine is not configured to show hidden paths, such as those beginning with a dot.

Solution: Run winecfg and select the Drives tab. Check "Show dot files" at the bottom. Now hidden folders (such as ~/.steam) will be visible in the installer.

Issue: The game wont run, or briefly runs and quits.

Open a terminal in the BattleTech dir where your binary for the game is located, you should see the run.sh there. Run this command to convert the line endings from windows to unix

   sed -i -e 's/\r$//' run.sh

and mark the script as executable, and finally run the game.

Issue: Not listed here

There are a few Linux users on the BTA Discord channel, you can ask for help in General Chat, message Indigo#8200 directly or open a support ticket with #ticketbot to get help resolving issues with BTA. For general issues with BattleTech on Linux, there are several forums available by searching your favorite search engine.