I’m trying to run Disciples: Sacred lands. In firejail. And I can say, that without firejail it runs just fine. The problem isn’t trivial, though, and this all might as well be posted on some firejail forum instead of here, but I have hopes, that asking here might clear the reason, for someone more knowledgeable than me might just have the answer pop from his head. I’m not good in those Linux internal subsystems. The problem is related to memory access. But it’s probably the time I explained what happens and what I did to debug it.
I used a GOG release, which is newer, than the version, that required Win98. (Meaning, that it shouldn’t be a 16-bit addressing problem, but who knows…) I used a clean wineprefix, and installed the game in /tmp/wine-game (where I usually install stuff to test, saving SSD lifespan). The game launches and runs just fine without firejail, I could create a character, visit the castle, walk around, some days passed in the game without it crashing or hanging.
With firejail, it refuses to run at all. Wouldn’t even spawn a window.
Being confused at first (since I jail everything running in wine and it’s been ages since a game refused to run because of firejail) I’ve tried to run the game via Disciples GL wrapper/patch. Don’t hurry to say “aha, the patch doesn’t count, go ask the guy who made it!” – I’m going to mention it solely for one peculiarity, for since I remembered, that firejail might be the cause, I’ve tried to run the game without it and… you know the rest. So, the wrapper wasn’t needed in my case. But the wrapper worked in firejail, with one annoying bug, that it would make the game freeze some time after loading to character selection screen, or soon after – already in the game itself – if I managed to create the character fast enough. This was peculiar, and I won’t say how many days and retries were wasted on attempts to make it work. In the end, it was futile.
However! After figuring out, that the game runs well without firejail, I’ve grown an interest to discover the difference – maybe if I find it, then I could solve the firejail problem and jail this old game too. Possibly, it could other games run as well. The hope was that the issue was in some path, that firejail blocked. But it wasn’t a path to a library.
Running the command prepended with WINEDEBUG=warn+all, with WINEDEBUG=err+file and with WINEDEBUG=+loaddll,+relay,+snoop has unanimously pointed at the library named SHW32.dll as the culprit, whose initialisation has failed.
Code: Select all
0024:warn:seh:dispatch_exception EXCEPTION_ACCESS_VIOLATION exception (code=c0000005) raised
0024:warn:module:process_attach Initialization of L"SHW32.dll" failed
0024:err:module:loader_init "SHW32.dll" failed to initialize, aborting
0024:err:module:loader_init Initializing dlls for L"Z:\\tmp\\wine-game\\Disciples Gold\\Exe\\Disciple.exe" failed, status c0000142
0128:warn:rpc:RPCRT4_default_receive_fragment Short read of header, -1 bytes
…
0050:warn:rpc:RPCRT4_SendWithAuth rpcrt4_conn_write failed (auth)
Parent is shutting down, bye...
Code: Select all
firejail=( firejail --net=none
--noblacklist='/usr/lib/wine*'
--noblacklist=/usr/share/wine/mono
--noblacklist='/tmp/.wine*'
--noblacklist=/tmp/.current-wine-Temp
--ignore=nogroups --ignore=novideo
--noblacklist=/usr/lib32/libstrangle.so
--noblacklist=/usr/lib32/libstrangle_nodlsym.so
--noblacklist=/mnt/cdrom
--noblacklist=/tmp/wine-inst
--noblacklist=/tmp/wine-game
--noblacklist='/sys/module/nvidia*'
--read-only='/sys/module/nvidia*'
--ignore=noroot
--noblacklist=/home/me/.wine32-games
--noblacklist=/home/me/saved_games
--noblacklist=/home/me/.cache/winetricks
--noblacklist=/home/me/.nv
--noblacklist=/home/data/software/games
--noblacklist=/home/games
--noblacklist=/mnt/cdrom/
--noblacklist=/mnt/cdrom2/
)
$ WINEPREFIX=/home/me/.wine32-games WINEDEBUG=+all "${firejail[@]}" wine ./Disciple.exe
Code: Select all
$ ls -l
total 7884
-rw-rw-r-- 1 me me 130560 Oct 20 2008 C4DLL-R.DLL
-rwxrwxr-x 1 me me 42496 Oct 20 2008 Config.exe
-rwxrwxr-x 1 me me 2946560 Feb 15 2012 Disciple.exe
-rw-rw-r-- 1 me me 1938 Jun 19 17:28 DISCIPLE.INI
-rw-rw-r-- 1 me me 68 Jun 19 17:55 Disciple.log
-rw-rw-r-- 1 me me 265296 Mar 18 2016 goggame-1207658683.dll
-rwxrwxr-x 1 me me 1351480 Jun 24 2014 GOGLauncher.exe
-rw-rw-r-- 1 me me 364032 Oct 20 2008 HA312W32.DLL
-rw-rw-r-- 1 me me 6916 Oct 20 2008 License.txt
-rw-rw-r-- 1 me me 331776 Oct 20 2008 MSS32.DLL
-rw-rw-r-- 1 me me 4640 Oct 20 2008 MSSB16.TSK
-rw-rw-r-- 1 me me 373760 Oct 20 2008 MSVCRTD.DLL
-rw-rw-r-- 1 me me 277776 Oct 20 2008 MSVCRT.DLL
-rwxrwxr-x 1 me me 1737216 Oct 20 2008 SCENEDIT.EXE
-rw-rw-r-- 1 me me 112672 Oct 20 2008 SHW32.DLL
-rw-rw-r-- 1 me me 96256 Oct 20 2008 SMACKW32.DLL
The library is found, loaded and mapped to memory successfully. But when the initialisation occurs, there are memory access errors:
Code: Select all
21381.890:0020:0024:Ret ntdll.NtProtectVirtualMemory() retval=00000000 ret=7bc61633
21381.890:0020:0024:Call ntdll.NtWriteVirtualMemory(ffffffff,7bb1195c,0031a5b0,00000005,0031a5ac) ret=7bc61669
0024: write_process_memory( handle=ffffffff, addr=7bb1195c, data={e9,bf,a2,e2,8e} )
0024: write_process_memory() = ACCESS_DENIED
So, it seems that SHW32.dll wants to access memory of some neighbouring process (thread?), and fails. I hoped that the issue may come from some file subsystem in /proc/ and allowing the firejail access it for just the spawned process could make the game run as well as without firejail. Perhaps, it’s more complicated than this; in the worst case I hoped to get the direction where to dig this problem further. Sorry, if there are mistakes in my English.