[raiguard] [2.0.16] Filesystem error on start when .factorio is symlink (linux,steam)

Things that we don't consider worth fixing at this moment.
dr_vm
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Sep 23, 2017 3:06 pm
Contact:

[raiguard] [2.0.16] Filesystem error on start when .factorio is symlink (linux,steam)

Post by dr_vm »

TL;DR: Not a Factorio bug - seems like a new "feature" of steam / pressure-vessel
Workaround:
Replace the Steam Launch command with something like

Code: Select all

<PATH TO FACTORIO>/bin/x64/factorio # "%command%"
The trailing # "%command%" comment is required to replace the whole command and not only append to the predefined template.

Original but updated report / some data for search engines
I use a symlink to link the $HOME/.factorio onto an NFS share.
This was working fine, till steam updated itself and simultaneously Factorio from 2.0.14 to 2.0.15.
Now, the game refuses to start with the following error message (via steam STDOUT/STDERR and as graphical message)

Log from 2.0.15 and 2.0.16

Code: Select all

   0.000 Initializing Steam API.
   0.000 Error Util.cpp:81: filesystem error: cannot create directory: File exists [$HOME/.factorio]
path1: $HOME/.factorio
   0.000 Steam API shutdown.
   0.000 Goodbye
Using a bind-mount instead of a symlink works as a workaround, so it looks like the game now checks $HOME/.factorio more closely to be a directory and not only a symlink to a directory.

Known Working: (factorio-previous.log)

Code: Select all

   0.019 2024-11-07 20:40:31; Factorio 2.0.14 (build 79988, linux64, steam, space-age)
   0.244 Operating system: Linux (Devuan 5)
   0.000 Initializing Steam API.
   0.000 Warning SystemUtil.cpp:1088: Couldn't acquire exclusive lock on <NFS PATH>/steam_saves/.factorio/.lock: Bad file descriptor
   0.244 Program arguments: "<STEAMAPPS>/common/Factorio/bin/x64/factorio" 
   0.244 Config path: <NFS PATH>/steam_saves/.factorio/config/config.ini
   0.245 Read data path: <STEAMAPPS>/common/Factorio/data
   0.245 Write data path: <NFS PATH>/steam_saves/.factorio [158790/1277334MB]
   0.245 Binaries path: <STEAMAPPS>/common/Factorio/bin
The given NFS server does not have locking enabled. The shown warning is therefore expected and factorio did run very well.
Please note, that the Distribution was included in the operating system name.

With Bind-Mount Workaround: (factorio-current.log)

Code: Select all

   0.001 2024-11-08 19:02:08; Factorio 2.0.15 (build 80108, linux64, steam, space-age)
   0.001 Operating system: Linux
   0.000 Initializing Steam API.
   0.000 Warning SystemUtil.cpp:1088: Couldn't acquire exclusive lock on $HOME/.factorio/.lock: Bad file descriptor
   0.001 Program arguments: "<STEAMAPPS>/common/Factorio/bin/x64/factorio" 
   0.001 Config path: $HOME/.factorio/config/config.ini
   0.001 Read data path: <STEAMAPPS>/common/Factorio/data
   0.001 Write data path: $HOME/.factorio [156753/1275297MB]
   0.001 Binaries path: <STEAMAPPS>/common/Factorio/bin
Note that the game is now tricked into thinking its userdata would reside in $HOME/.factorio, but it still lives in the NFS share (as indicated by the still missing locking). The distribution name is now missing which looks like Factorio is now running inside some sort of lightweight container/namespace.

With bash -c ... Workaround: (factorio-current.log)

Code: Select all

   0.000 2024-11-09 15:15:10; Factorio 2.0.16 (build 80214, linux64, steam, space-age)
   0.218 Operating system: Linux (Devuan 5)
   0.000 Initializing Steam API.
   0.000 Warning SystemUtil.cpp:1088: Couldn't acquire exclusive lock on <NFS PATH>/steam_saves/.factorio/.lock: Bad file descriptor
   0.218 Program arguments: "<STEAMAPPS>/common/Factorio/bin/x64/factorio" 
   0.218 Config path: <NFS PATH>/steam_saves/.factorio/config/config.ini
   0.219 Read data path: <STEAMAPPS>/common/Factorio/data
   0.219 Write data path: <NFS PATH>/steam_saves/.factorio [156097/1274658MB]
   0.219 Binaries path: <STEAMAPPS>/common/Factorio/bin


(I'll update as soon as i checked with experimental)
Update: Same with 2.0.16 and downgrading to 2.0.14 or 2.0.7 or 1.1.107 via steam does not help. Therefore, i assume that this issue is not related to Factorio, but some used library or the steam linux runtime (pressure-vessel/overrides).
Steam does run as regular application, not as snap/flatpack or similar.

After fiddling a little bit with the Steam Launch Options, i was able to poke around a bit.
Important, the used terminal emulator (e.g. xfce4-terminal) must not already been registered at the session bus (otherwise, the regular environment would be used)!
Steam Launch Options:

Code: Select all

/usr/bin/xfce4-terminal --disable-server -x /bin/bash -c "%command%"
The game starts inside the pressure-vessel-adverb (inside srt-bwrap (inside reaper which itself was executed from steam-launch-wrapper)) and does not succeed (see above).

Trying to restart the game 1:1 with the steam-launch-wrapper results in the wrapper failing to find (the existing) file <STEAMAPPS>/common/SteamLinuxRuntime_soldier/pressure-vessel/bin/steam-runtime-launcher-interface-0

Code: Select all

$HOME/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- $HOME/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=427520 -- '<STEAMAPPS>/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '<STEAMAPPS>/common/SteamLinuxRuntime'/scout-on-soldier-entry-point-v2 --  '<STEAMAPPS>/common/Factorio/bin/x64/factorio'
Starting Factorio directly without any wrappers but still inside the environment created by steam works too

Code: Select all

<4>pressure-vessel-wrap[2585]: W: Disabling gtk3-nocsd LD_PRELOAD: it is known to cause crashes.
pid 2685 != 2681, skipping destruction (fork without exec?)
pid 2690 != 2681, skipping destruction (fork without exec?)
   0.000 Initializing Steam API.
[S_API] SteamAPI_Init(): Loaded '$HOME/.local/share/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 427520
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561198135020245 [API loaded no]
   0.000 Warning SystemUtil.cpp:1088: Couldn't acquire exclusive lock on <NFS PATH>/steam_saves/.factorio/.lock: Bad file descriptor
   0.000 2024-11-09 14:47:27; Factorio 2.0.16 (build 80214, linux64, steam, space-age)
   0.000 Operating system: Linux
   0.000 Program arguments: "<STEAMAPPS>/common/Factorio/bin/x64/factorio" 
   0.000 Config path: <NFS PATH>/steam_saves/.factorio/config/config.ini
   0.000 Read data path: <STEAMAPPS>/common/Factorio/data
   0.000 Write data path: <NFS PATH>/steam_saves/.factorio [156097/1274658MB]
   0.000 Binaries path: <STEAMAPPS>/common/Factorio/bin
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 627
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard] [2.0.16] Filesystem error on start when .factorio is symlink (linux,steam)

Post by raiguard »

Symlinking .factorio into an NFS share is the edgiest of edge cases, and since you already found a workaround, I will move this to "won't fix".

Steam recently started running all Linux-native games under the steam linux runtime without the game's consent, which could have triggered this.
Don't forget, you're here forever.
toverux
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Jan 02, 2025 8:36 pm
Contact:

Re: [raiguard] [2.0.16] Filesystem error on start when .factorio is symlink (linux,steam)

Post by toverux »

Same issue when I tried symlinking saves/ to a fuse (sshfs) filesystem so the issue is not just with NFS.
Here too though, bind mounting works just fine! Thanks for the tip.
R060
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri Jan 03, 2025 10:17 am
Contact:

Re: [raiguard] [2.0.16] Filesystem error on start when .factorio is symlink (linux,steam)

Post by R060 »

Looks more like a Steam issue than a Factorio. Their scripts are notoriously buggy and quite dangerous (https://github.com/valvesoftware/steam- ... ssues/3671), so I suggest everyone to run Steam from another user so it would not be able to delete your root or something.
Post Reply

Return to “Won't fix.”