Skip to content

Linux Setup Gotchas

CJ Kucera edited this page Feb 28, 2018 · 13 revisions

There are a few caveats which bear mentioning when using mods on Borderlands 2/TPS under Linux.

Game Patching

In order to enable the console, which is required to run the mods, Windows users can use FilterTool to handle automatic patching of the main .EXE file. This isn't possible on Linux (or at least nobody's yet taken the time to figure out an equivalent), so Linux (and Mac) users must instead edit their engine.upk files manually.

FilterTool's successor, BLCMM, will support automatically patching engine.upk on both Mac and Linux, so I'm not including instructions here for doing so. Detailed instructions can be found here, though: http://apocalyptech.com/games/bl-modding/

Once BLCMM is released (which should be pretty soon, as of February 28, 2018), most of that URL will become pretty obsolete, since BLCMM will take care of it for you.

DLC Directory Ordering Issues

This is a rather bizarre issue, due to some cross-platform differences between Windows and Linux, and because of some behaviors of the Borderlands engine.

Basically, when looking for DLC on your hard drive, Borderlands looks inside the steamassets/dlc directory and loads the mods in the order they're given by the kernel. On Windows, the filesystem driver will return the directories in alphabetical order by default. On Linux, the order of the directories is effectively random. (When looking at a directory listing via ls on Linux, the ls command does the sorting for you. If you want to see the "native" order in which the directory entries are given, you can run "ls -U" or "ls --sort=none".)

As the engine loads these DLC, some of the property names get dynamically-assigned number suffixes, and what numbers get assigned depends on what order the DLC is loaded. Mods which try to edit these values need to hardcode a number to use -- any mod written/tested on Windows is going to be using the numbers you get by sorting the directories alphabetically. For instance, the internal part list collection for one class mod from the Dragon Keep DLC has this property name:

GD_Aster_ItemGrades.ClassMods.BalDef_ClassMod_Aster_Assassin:ItemPartListCollectionDefinition_28

However, the last number could easily be something else, like:

GD_Aster_ItemGrades.ClassMods.BalDef_ClassMod_Aster_Assassin:ItemPartListCollectionDefinition_42

And on other Linux systems it could be something different. There's no way to actually predict what number it'll be. This doesn't have a super wide impact, since there aren't that many mods which actually touch these variables, but UCP does contain a few statements which do, and you'll risk not getting the full effect of some mods.

So, how do I fix this?

Unfortunately, the only real fix for this is to mount your Borderlands DLC directory under a separate filesystem which supports sorting directories alphabetically. No native Linux filesystem does this. It's possible to disable some features on an ext4 filesystem, so that directory entries will be given in the order in which they were created. So theoretically you could create an ext4 partition, use the following tune2fs command on it:

# tune2fs -O ^dir_index /dev/foo

... and then carefully copy the DLC directories into that filesystem, one at a time, in alphabetical order. That method seems quite fragile to me, though, and I wouldn't recommend that even though you'd still be using a native Linux FS.

What I've done on my own system is to just resign myself to using NTFS. The Borderlands 2 DLC dir contains a little over 6GB of data, so I created a new 10GB LVM LV, used "mkfs.ntfs /dev/vg/bl2dlc" (obviously substitute the proper device name there), copied over all the DLC data into that new filesystem, and then added the following to my /etc/fstab -

# Borderlands 2 DLC Modding Nonsense
/dev/mapper/vg-bl2dlc  /usr/local/games/Steam/SteamApps/common/Borderlands\0402/steamassets/dlc   ntfs    uid=1000,gid=1000,umask=022   1 2

Note the special string "\040" in the pathname, required because there's a space in the directory name. Adjust the device name, path, UID/GID/unmask, etc, to suit your circumstances. Make sure that the dir is mounted properly and that the DLC data is in there, and you should be good to go. You can use "ls -U" in the DLC directory to verify that they're showing up in alphabetical order now.

So... yeah. That is quite weird, and I suspect not a lot of folks are going to be willing to do something like that to their system, just to support some game mods. Still, if you're looking for 100% mod compatibility inside Linux, this is a step you'll have to deal with.

Clone this wiki locally