[Linux] Fix related to the Factorio binary and eventually folder structure

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

[Linux] Fix related to the Factorio binary and eventually folder structure

Post by mcgiwer »

Hello. I would like to propose following fixes for the Factorio binary for Linux and eventual directory structure:

Used terms:

Root Folder - directory to with the game was extracted from a archive
Binary - "factorio" file (main executable)

---

1. Directory structure:
  • All folders should be relative to the Root Folder
  • The Binary should be placed in the Root Folder instead of "bin/[architecture]"
2. Binary:

Fix the problem that the Binary searches the "data" folder in the not existing locations of the user's home directory and "/usr/share", instead to the Root Folder.

The both locations in with the Binary searches it aren't becoming neither created, nor linked to the existing in the Root Folder data folder and the game quit's

mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

Re: [Linux] Fix for point 2. from above post

Post by mcgiwer »

Proposed patch that fixes the "data" path issue in Factorio for Linux
Steps to patch the factorio binary
  1. Download the patch from: https://fastupload.io/qiwN4wLXbZgFBvy/file to the folder where you had extracted Factorio
  2. Open the terminal and using the "cd" command, go to the path where you had extracted factorio
  3. enter following commands:

    Code: Select all

    mv bin/$(uname -m)/factorio ../../
    patch factorio < data_path_fix.patch
    
That should be all :-)
Last edited by mcgiwer on Wed Nov 08, 2023 1:00 pm, edited 3 times in total.

User avatar
Hares
Fast Inserter
Fast Inserter
Posts: 128
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by Hares »

The attachment is no longer available
Here is a zipped copy:
data_path_fix.patch.zip
(10.72 KiB) Downloaded 32 times

mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by mcgiwer »

Hares wrote:
Tue Nov 07, 2023 3:18 pm
The attachment is no longer available
Here is a zipped copy: data_path_fix.patch.zip
Unfortunatelly, the website had limited how long it can be avaliable. I had selected the maximal value.

Hopefully, the developers will integrate my patch into the next relase ;)

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2595
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by FuryoftheStars »

This meant to be a fix for this issue that the devs told you was most likely a problem with your own system a couple years back?
viewtopic.php?f=49&t=99890

And when did you post that "patch"? Because your post here was the 7th, yesterday, and the download was deleted the same day from the site despite your selecting the longest hosting interval? Unless you actually uploaded it a very, very long time ago and just happened to put a link to it the day it expired, it sounds to me
like the site moderated the upload....
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics

mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by mcgiwer »

FuryoftheStars wrote:
Wed Nov 08, 2023 11:52 am
And when did you post that "patch"? Because your post here was the 7th, yesterday, and the download was deleted the same day from the site despite your selecting the longest hosting interval? Unless you actually uploaded it a very, very long time ago and just happened to put a link to it the day it expired, it sounds to me
like the site moderated the upload....
yes, I had created and uploaded the patch. Unfortunatelly, it seem I had choosen a wrong hosting provider for the file :-(

mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by mcgiwer »

Hares wrote:
Tue Nov 07, 2023 3:18 pm
The attachment is no longer available
Here is a zipped copy: data_path_fix.patch.zip
I had updated the links. Thanks for letting me know about it and creating a backup download :-)

User avatar
Hares
Fast Inserter
Fast Inserter
Posts: 128
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by Hares »

FuryoftheStars wrote:
Wed Nov 08, 2023 11:52 am
And when did you post that "patch"? Because your post here was the 7th, yesterday, and the download was deleted the same day from the site despite your selecting the longest hosting interval? Unless you actually uploaded it a very, very long time ago and just happened to put a link to it the day it expired, it sounds to me
like the site moderated the upload....
It was marked as "delete after downloaded". I downloaded it. :D

User avatar
BrainGamer_
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Sun Nov 14, 2021 9:52 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by BrainGamer_ »

I don't really get what the apparent issue here is?
Factorio will use the read-data and write-data directories as configured in the config.ini file.
The standalone/archive install of factorio defaults to using the root of the unpacked zip as both the read-data and write-data folder (as explained in config-path.cfg)

mcgiwer wrote:
Tue Nov 07, 2023 1:21 pm
The Binary should be placed in the Root Folder instead of "bin/[architecture]"
Any reasoning for this? Change for the sake of change is never good. It would just break existing tools that depend on the current structure.

mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by mcgiwer »

Let me explain. When starting factorio up for the first time on Linux (when the game wasn't ever run before), there seem be a issue that in the "/usr/share" isn't created link to the "data" folder.

Even when the config file in the game root folder states to a correct place factorio complains about missing content in the /usr/share/factorio because this path is hardcoded into the "factirio" file and it's readed in from there in the first place, befire the configuration file

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2595
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by FuryoftheStars »

mcgiwer wrote:
Wed Nov 08, 2023 6:09 pm
Let me explain. When starting factorio up for the first time on Linux (when the game wasn't ever run before), there seem be a issue that in the "/usr/share" isn't created link to the "data" folder.

Even when the config file in the game root folder states to a correct place factorio complains about missing content in the /usr/share/factorio because this path is hardcoded into the "factirio" file and it's readed in from there in the first place, befire the configuration file
Well, as the dev attempted to explain to you in the old thread I linked, this is not true. It's true on your system for some unknown reason, but the majority of Linux users do not have that issue when starting Factorio for the first time.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics

Koub
Global Moderator
Global Moderator
Posts: 7226
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by Koub »

Sorry if my intervention isn't related to the original issue, I haven't been on a linux system for 25 years.
@OP : is the information here of any use ? Especially the section about the config file.
Koub - Please consider English is not my native language.

mcgiwer
Inserter
Inserter
Posts: 39
Joined: Sat Aug 14, 2021 8:12 pm
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by mcgiwer »

Koub wrote:
Wed Nov 08, 2023 6:37 pm
Sorry if my intervention isn't related to the original issue, I haven't been on a linux system for 25 years.
@OP : is the information here of any use ? Especially the section about the config file.
Hello. I had tryed it as well, and sadly wothout any success.

While debugging I got into conclusions that for some reasons the "factorio" prefers to use the hard coded path, instead of reading first the mentioned by others in this topic config file

quyxkh
Smart Inserter
Smart Inserter
Posts: 1029
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [Linux] Fix related to the Factorio binary and eventually folder structure

Post by quyxkh »

for some reasons the "factorio" prefers to use the hard coded path, instead of reading first the mentioned by others in this topic config file
No, it doesn't. If you didn't tell it which config file to use it looks in the install directory for the config-path.cfg file that gives the rules this install should use to find and if needed create the default config, and uses those. Every linux install is going to have the binary in $install/bin/$arch/factorio, because that's where Wube puts the binaries in linux installs, so two levels up from the binary is $install, and it looks there for config-path.cfg, if you don't tell it where to find the config file, to tell it how to find or create the config for this run.

Appending "config-path.cfg" instead of "../../config-path.cfg" to a readlink("/proc/self/exe",...) result isn't going to make anything better.

The only way I can think to get anything like the behavior you're describing is if you tried cobbling together a handrolled fake install with a symlink on the path to the binary. If that's what happened, the damages that happened next is y'all's fault. You did it wrong. To do it right, also pass a(n absolute or current-directory-relative) config file path on the command line that already has the right read-data and write-data paths for this run. Hoisting the binary to the install root wouldn't help anything, then you'd have to copy or hardlink it into your handroll instead of symlinking it, which has worse fragilities.

Post Reply

Return to “Ideas and Suggestions”