VMware player for testing mods on Linux - instructions

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

VMware player for testing mods on Linux - instructions

Post by jth »

Its obviously not going to be very quick but will it at least start up a copy of Linux and allow me to test my mods ?

jth
Last edited by jth on Tue, 22. Mar 16, 13:59, edited 1 time in total.
jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth »

I did manage to get this going after a lot of trial and error so here is how I did it

Creating a new VMware workstation player 12 Ubuntu 14.04 or 15.04 VM and getting X Rebirth to run on it

This is an outline set of instructions for getting a Ubuntu 14.04 or 15.04 desktop going for X Rebirth testing on Linux.

Warning it runs at about half the frame rate of the host OS

It assumes a bit of Linux experience ... most flavours will do

It also needs decent internet connection as you will be downloading between 10 and 15 GB

Out of the box VMware workstation player 12 will not run X Rebirth as the OpenGL graphics driver isn't new enough

So what we have to do is to compile a newer version using some instructions from

http://www.mesa3d.org/vmware-guest.html

Plus a few additional tweaks ..... or the Steam client doesn't work

Stage 1 Building and configuring the VM]

Download and install the VMware Workstation 12.1.0 Player for Windows 64-bit operating systems from VMware

If this is for personal use then you don't need a license. Please see their licensing blurb for full details.

I downloaded VMware-player-12.1.0-3272444.exe

Download the Ubuntu 14.04 or 15.04 64 bit software from Ubuntu

I downloaded ubuntu-15.10-desktop-amd64.iso and the ubuntu-14.04.4-desktop-amd64.iso either one will do

Install the VMware player

Startup the VMware player and click on Create a New Virtual Machine

Click on Installer disc image file (iso): and browse to the Ubuntu iso that you downloaded earlier

Click on Next which will bring up the Easy Install information

Put in a full name, username (lowercase only) and a password that you can remember then

Click on Next which brings up Name the Virtual Machine

You can keep the default settings or change the name and move the VM. It would probably be a good idea to have the files on a fast disk or SSD but it works for me with a SATA3 HDD.

Click on Next which brings up Specify Disk Capacity

This needs to be changed to at least 25GB to get the X Rebirth files and all the extras to fit.

My personal recommendation is to also select store virtual disk as a single file as IMHO its tidier and faster

Click on Next which brings up Ready to Create Virtual Machine

You are going to have to make a couple of additional changes to the VM to run X Rebirth and to efficiently compile some drivers. This can be done here or immediately after the VM is created.

The two changes are more virtual cpu's and more memory. If you have a quad core machine then give the VM 4 virtual cpus and it will need 8GB RAM to meet the X Rebirth requirements.

It did start up for me with 4 vcpu's and 2Gb RAM but then crashed later loading a big save game.

Click on Finish and wait for VMware to create the VM.

It will take a while as it fetches a pile of files from the States even if you are in Europe. Will fix that later.

If you haven't already done it then once its built login and shutdown the VM and change the virtual cpus and memory, Edit virtual machine settings then start it up again

To shut it down right click on the cog at the top right hand corner and select Shut Down then click on the big Shut down icon

Login using the username and password that you remember from earlier :)

Resize the VMware player windows to be nice and large

If the contents of the VM window does not dynamically resize when you grab the bottom right corner and move it about then you need to fix that before you go any further or you are wasting your time

Open VM Tools fixing

To fix issues with the open VMware client the easiest thing is to re-install the client

First make sure that you have the tools and the desktop support installed

Code: Select all

sudo apt-get install open-vm-tools open-vm-tools-desktop
and then restart the VM.

If that doesn't work then you need to re-install

Code: Select all

sudo apt-get remove open-vm-tools
sudo apt-get install open-vm-tools open-vm-tools-desktop
and then restart the VM.

Configuring the VM

We now need to adjust a few things, the time, patch server, keyboard layout

Lets start with the time if you are not in the Los Angeles time zone.

Right click the time at the top right of the the screen and select Time & Date settings

Click on your country with the mouse and then close the popup windows by clicking on the cross at the top left

To change the updates server (optional but recommended)

Select the System Settings icon from the icons down the left hand side and then select Software & Updates

Click on Download from and select Other then pick one from your Country or click on Select Best and let it work that out.

then click on Choose Server, put in your password and Authenticate and then click on Reload and it will update the cache. Close the Software & Updates popup windows when its finished

If you don't have an American keyboard then

Select the System Settings icon from the icons down the left hand side and then select Text Entry

At the bottom left is a + symbol, click it and then select your keyboard and click on Add and find your keyboard

Patching.

If you are intending to keep this VM up to date with patches on a one off or recurring basis then do it now BEFORE you update the VMware drivers

Click on the Software Updater and let it do its job and then restart the VM

Note that updating the kernel later will break the VMware drivers

At this point you have a nice shiny VM and it would be a good idea to shut it down and then zip up the entire VM folder as a backup and save it somewhere safe

Stage 2 - Installing Steam

You can use other methods but this is how I did it

Using firefox google "steam linx download" pick the first link offered and

Click on Install Steam now

A window will pop up saying opening steam_latest.deb with Ubuntu software center

Click on OK

Wait a bit and then click on Install then put in your password, when its done close the Ubuntu Software Center

Go back to a terminal window and type in

Code: Select all

steam
Accept the License agreement and then provide a password so that steam can install additional libraries and say y and when its done hit Enter

Ubuntu 15.04 will then chuck out some errors but 14.04 won't

libGL error: unable to load driver: vmwgfx_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: vmwgfx
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

this is a known issue and I got my solution from

http://askubuntu.com/questions/614422/p ... untu-15-04

the Edit 2015-08-22:

Code: Select all

find $HOME/.steam/root/ubuntu12_32/steam-runtime/*/usr/lib/ -name "libstdc++.so.6" -exec mv "{}" "{}.bak" \; -print
then do

Code: Select all

steam
It will then install a pile of updates and when its finished you get another set of errors on 15.04

libGL error: unable to load driver: vmwgfx_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: vmwgfx
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

as the updates broke it again, so re-issue the fixing command and then reload it again

it then does some more updating and if you are lucky will finally give you a Steam screen that you can read offering to let you login :)

At this point you have a nice shiny VM with Steam installed and it would be a good idea to shut it down and then zip up the entire VM folder as a backup and save it somewhere safe

Stage 3 - Downloading newer OpenGL drivers

Start up Firefox and browse to

http://www.mesa3d.org/vmware-guest.html

These instructions are excellent and do what they say but if you follow them exactly the Steam client will give you a completely empty black box and you won't be able to start X Rebirth

You need to do everything that you are told to for Ubuntu, don't assume that you only need the VMware bits

To carry them out you need a terminal window, to get that click on the top left icon Search your computer and online sources

Put in term and then click on Terminal This one lets you copy and paste the others don't ...

Read the VMware guest GL driver instructions and goto the Prerequisites for Ubuntu

Highlight each line one at a time and right click Copy

Then goto the Terminal and right click Paste them in and hit the Return or Enter key

The very first time that you run a command starting with sudo it will ask you for your password

It will then say what its going to do and ask for confirmation, type y and then Enter

If you didn't change the patch server then this may take a while ...

Then carry out the instructions from Getting the Latest Source Code

It will take some time to clone the mesa files as there are a lot of them, 145MB when I did this

For the more paranoid amongst you I would recommend that you take another backup of your working VM

Stage 4

Now start on Building the Code

If you have problems with this stage then you can restore the last backup. If you want to split things down further then skip the Build Mesa and the vmwgfx_dri.so driver section the first time through and get everything else going, make another backup then return to the Build Mesa and the vmwgfx_dri.so driver section as Stage 5

You have 64 bit Ubuntu

Now Build libdrm:

This configues and then compiles the drm code, compiling is a heavy cpu task and why I suggested that you have 4 virtual cpus

The Build Mesa and the vmwgfx_dri.so driver section threw a few wobblies on me due to Firefox eating the last few characters in the longest command. It might be a web server/Firefox issue.

but it did accidentally show me how to get this working with Steam :)

don't run the long line line starting with ./autogen or Steam won't work

do this instead to compile Mesa 11.2.0-rc3 (11.3 doesn't work with Steam for me)

Code: Select all

git checkout 11.2
./autogen.sh --prefix=/usr --libdir=${LIBDIR} --with-gallium-drivers=svga --with-dri-drivers=swrast
Then continue with the last two instructions, make and sudo make install

This is the biggest package to compile by a very long way, so it needs the vcpus or its going to take a very long time

The glxinfo command is part of the mesa-utils, get it and then run glxinfo

Code: Select all

sudo apt-get install mesa-utils
glxinfo | grep OpenGL
which should produce an error

glxinfo: symbol lookup error: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: undefined symbol: _glapi_tls_Dispatch

If it doesn't produce the error then these instructions are not going to work ... so you can stop here

If it produces the error then you need to copy the libGL.so.1.2.0 that you just compiled to the mesa directory to fix the error

Code: Select all

sudo cp /usr/lib/x86_64-linux-gnu/libGL.so.1.2.0 /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
then try the glxinfo command again and it should now work. Note the screen may flicker and it may log you out

Now xf86-video-vmware:

Now vmwgfx kernel module. Read and follow the additional guidance below

for the first command you will get No such file or directory

when you run find /lib/modules -name vmwgfx.ko -exec ls -l '{}' \; then you will get something like.

-rw-r--r-- 1 root root 304113 Oct 8 18:15 /lib/modules/4.2.0-16-generic/kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko
-rw-r--r-- 1 root root 742776 Mar 15 13:08 /lib/modules/4.2.0-16-generic/extra/vmwgfx.ko

The instructions say If you see the kernel module listed in more than one place, you may need to move things around. and we do

so to rename the old module and copy the new (bigger) one over to the right place

Code: Select all

sudo cp /lib/modules/`uname -r`/kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko.org
sudo cp /lib/modules/`uname -r`/extra/vmwgfx.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/vmwgfx/vmwgfx.ko
At this point we need to re-issue two commands or the old version of vmwgfx will load next time the VM starts

Code: Select all

sudo depmod -a
sudo update-initramfs -u
Now continue with the next instruction Now try to load the kernel module by issuing

Instead of dmesg use dmesg | grep vmwgfx and it should produce a single line that contains

[drm] Initialized vmwgfx 2.6.1 20140704 for 0000:00:0f.0 on minor 0

However thats not very helpful as that was the old version of vmwgfx that was loaded when the VM first started

try this instead

Code: Select all

sudo lsmod | grep vmwgfx
which should produce something like

vmwgfx 176128 3
ttm 94208 1 vmwgfx
drm_kms_helper 126976 1 vmwgfx
drm 356352 6 ttm,drm_kms_helper,vmwgfx

which proves that it loaded OK

Now restart the VM or the X Windows

and repeat the

Code: Select all

glxinfo | grep OpenGL
which should now say on 14.04

OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on SVGA3D; build: RELEASE;
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0-rc3 (git-9f21fdd)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 11.2.0-rc3 (git-9f21fdd)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

Thats the video drivers fixed

Now start the Steam client, login and download X Rebirth

On you way out collect your pair of virtual sandals :)

Have fun

Regards

jth
CulunTse
Posts: 153
Joined: Mon, 15. Jun 15, 08:10
x4

Post by CulunTse »

Impressive writeup! Thanks for sharing!
I'm including a link in my main post :-)
User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 25130
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus »

Honest question: What is the advantage of using a Virtual Machine for testing own mods under Linux in comparison to simply creating a proper linux installation?
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
CulunTse
Posts: 153
Joined: Mon, 15. Jun 15, 08:10
x4

Post by CulunTse »

The general advantage of virtual machines is always that you can freely mess around without risking your base install.

Not everyone is experienced enough with computers to feel confident making a dual boot (repartitioning your hard drive always carries risks of data loss).
Buying a second hard drive is also a big investment (time and money) if you "just wanna check something quickly"
Even experienced programmers and even sysadmins sometimes shy back from "OS fiddling" because they don't want to risk their primary work machine (that pays the bills).

I admit that vm's are usually not the first choice when it comes to 3D work. For this case though, seeing if the mod loads and stuff works (even though it's slower) it should be enough.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

suggestion: isntall linux on a cheap USB stick. may be slower on startup and loading, but is otherwise identical to an installation to disk (some Live Sysems can do this without installing in the commom sense - just create an installation medium and give it some additional space for changes and it is almost the same as an installed OS)

i think the tool MultiSystem had this function (it can create Installation Mediums for several OSes), but its been ages since i used it..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth »

My main reasons for doing it are that my spare PC hardware does not meet the 64 bit 8GB requirements. Its close but its also got an HD3000 video which doesn't meet the requirements. The older spare is not 64 bit or 8GB.

It takes a surprising amount of time to squash an existing partition and I seem to end up with loads of Linux partitions that won't boot on my older hardware

If you add another disk then it still tends to take over your boot loader and you need the space for the disk and I don't have any SATA 3 spare HDD's

I have also ended up taking out the boot loader on my main machine more times than I can remember and its getting harder to put back together not easier :(

I did think about the USB stick but they are way way slower than a sata 3 HDD and there is a lot to load. I even considered an external USB HDD if I could persuade it to boot from it but that's probably faster than sd card but slower than sata 3. The only thing I have is probably sata 2 via USB 2

My fall back was going to be WUBI which inserts itself as an option into your boot loader but then runs off a virtual disk file from an existing hard disk. I don't really want it anywhere near the boot loader but at least WUBI doesn't replace it just adds itself into the existing Windows 7 setup

jth
PS If I get an hour or two then I am curious about how well the VM will run on the HD3000 laptop. I suspect it will be awful but there is only one way of finding out ...

Return to “X Rebirth - Scripts and Modding”