# Installing GOG.com Linux games (via mojosetup)



## Eitot (Nov 21, 2016)

Hey everyone,

I have been using FreeBSD 11 for a couple of weeks now as a desktop system and so far it is going well. However, I am a bit at a loss when it comes to installing Linux games obtained from GOG.com using the Linux compatibility layer. I have followed the instructions in the handbook and elsewhere, i.e. I installed emulators/linux-c6 and emulators/linux_base-c6 (I compiled them with ’DEFAULT_VERSIONS+=linux=c6_64’ in /etc/make.conf to obtain the 64-bit files) and added the entries to /etc/rc.conf and /etc/fstab.

To add a bit of context, GOG.com distributes Linux games as Makeself packages (though they look like shell scripts), within them a ‘mojosetup’ binary image (which is supposed to handle the installation). Executing the script seems to work until it reaches the mojosetup binary image, as it manages to extract the contents to /tmp first. The execution just hangs at that point and the command line does not respond anymore (I have to `pkill` the process). I have tried several games and they all have the same problem.


```
$ ./gog_bastion_2.0.0.1.sh
Verifying archive integrity... All good.
Uncompressing Bastion (GOG.com) 100%
Collecting info for this system...
Warning: No binaries for "freebsd" found, trying to default to Linux...
Operating system: linux
CPU Arch: x86_64
trying mojosetup in bin/linux/x86_64
USING en_US
```

I am not sure where to begin. I have tried executing the ‘shell script’ as verbose (`sh -v`) and as debug (`sh -x`), but it does not show any messages at that point. Using `ldd mojosetup` results in this (I omitted the long numbers within parentheses at the end, as I am currently typing this out by hand):


```
mojosetup:
        linux_vdso.so.1 =>
        libpthread.so.0 => /lib64/libpthread.so.0
        libdl.so.2 => /lib64/libdl.so.2
        libm.so.6 => /lib64/libm.so.6
        libc.so.6 => /lib64/libc.so.6
        /lib64/ld-linux-x86-64.so.2
```

Are the first and last lines correct that way? `brandelf` does not seem to do anything.

There is something else I noticed. Before I installed emulators/linux-c6, I only installed emulators/linux_base-c6. When I started the shell script, I received an error message that it could not find ‘xterm-256color’. At this point I installed emulators/linux-c6 as well, which required me to add this line to /etc/fstab: `tmpfs       /compat/linux/dev/shm   tmpfs      rw,mode=1777  0 0`

However, I did not do that immediately and the mojosetup binary did start (but I could not complete the installation due to a fatal error). Upon rebooting the system, Gnome 3 would not start anymore (it would just go on and off before I could reach the login screen). I was able to resolve this by adding the line above, but hence mojosetup hangs.

Any ideas where I could look for clues?


----------



## abishai (Nov 21, 2016)

Not linux subsystem user, but I saw c7 landed to the port tree. Maybe it's worth to try it.
You can try to debug the process with ktrace(1)() . Use `kdump -HAR` to make trace file human readable. Maybe you will see some unimplemented calls or something obvious.


----------



## Eitot (Nov 23, 2016)

Thanks for the response. I managed to recompile x11/nvidia-driver-340 with emulators/linux_base-c7. Unfortunately, the issue is the same.

I haven't used ktrace or like before and I am not sure what to look for. I posted the log here.

I am still wondering why it worked and managed to present a GUI before I added the tmpfs line (above) to /etc/fstab.


----------



## morbit (Mar 11, 2017)

I've tried to run `./startmojo.sh` manually, it flashes something blue (installer I suppose) then spins without output taking 98% CPU.


----------



## morbit (Mar 17, 2017)

You can use https://github.com/Yepoleb/gogextract to extract all the data from installer script, omitting mojosetup. It requires lang/python3.


----------



## pkubaj (Mar 20, 2017)

morbit said:


> You can use https://github.com/Yepoleb/gogextract to extract all the data from installer script, omitting mojosetup. It requires lang/python3.


I also play games from GoG. When I use the Linux version, I just run:
`$ tar xvvf game.sh`
It works.


----------



## morbit (Mar 20, 2017)

Indeed, the simplest solution. Although the only linux binary which I could 'use' here is `glxgears` from graphics/linux-c7-glx-utils. If not complaining about missed binaries from older linux base, all of them segfault on me (I'm speaking of GoG game as well as demos from ports).


----------



## Eitot (Mar 22, 2017)

Thanks for the responses, people! I had given up, but I will try this.


----------

