Run wine totally headless

16

4

I want to run wine headless and avoid the error message:

Make sure that your X server is running and that $DISPLAY is set correctly.

Is there a way or do i have to route/forward it to some output? Can it just run from a command line way?

FabioCosta

Posted 2015-04-15T17:04:23.150

Reputation: 323

What exactly are you trying to run in wine? Most Windows programs require a GUI to be present. – Michael Hampton – 2015-04-15T17:08:03.037

It's a long story but basically i have n very old exe that i have to use for legacy reasons and will not produce any GUI output. An example of a command that is issuing the same error would be winetricks vb6run – FabioCosta – 2015-04-15T17:09:43.233

1Well, yes, that starts up a GUI-based installer, so it will want a display. – Michael Hampton – 2015-04-15T17:10:47.530

I didn't realized it would really require the gui on this example, this is a different issue but you showed me an error of mine.Anyhow i guess i will end up using Xvfb and fixing the font errors – FabioCosta – 2015-04-15T17:19:21.683

Answers

11

I don't know any way to run wine totally headless but I can point you to xvfb. It can create a virtual display to which X server can redirect its output. No need to have a physical display connected. We use it to run selenium tests in browsers on a headless Jenkins cluster.

Does that meet the requirements or are you bent on running wine absolutely headless?

Erathiel

Posted 2015-04-15T17:04:23.150

Reputation: 434

I am trying with Xvfb but it's kind of strange using "Xvfb :1 &'" and then "export DISPLAY=:1 " and then running my wine issue me a font error and lock the execution . I am trying to fix the font error by following this http://blog.martin-lyness.com/archives/installing-xvfb-on-ubuntu-9-10-karmic-koala while seeking other alternatives

– FabioCosta – 2015-04-15T17:12:59.133

12

You can configure your wine to run headless by installing X virtual framebuffer. For instance:

sudo apt-get install Xvfb
Xvfb :0 -screen 0 1024x768x16 &

Install wine:

# On 64-bit also run: sudo dpkg --add-architecture i386
sudo add-apt-repository -y ppa:ubuntu-wine
sudo apt-get update
sudo apt-get install wine

Note: For detailed installation example, check provision.sh script.

Install fonts if required:

winetricks allfonts

Then run your apps as:

DISPLAY=:0.0 wine my_app.exe

or you can export it (so no need for the above prefix when running):

export DISPLAY=:0.0 # Select screen 0.

Where DISPLAY is your request to local display/input service (or: export DISPLAY=[user's machine]:0).


Alternatively set-up X11 Forwarding. Then you don't need to use DISPLAY.

Basically set X11Forwarding yes in /etc/ssh/sshd_config on the headless server and ForwardX11 yes in /etc/sshd/ssh_config on the machine you're connecting from.

Then you can run GUI applications on your headless server and at the same time wine will be able to connect to your local X11 server, so you could run your console-based DOS executables.

kenorb

Posted 2015-04-15T17:04:23.150

Reputation: 16 795