Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by any_user · Nov 24, 2012 at 08:27 PM · serverlinuxbatchmode

How can a unity game be started on headless linux servers?

I try to run a server build of a unity application on an Ubuntu Server (12.04). It doesn't work when I try to start the application with:

 ./myUnityApplication -batchmode

Following error occurs (Player.log):

 Display is invalid  
 Failed to initialize ScreenManager
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

6 Replies

· Add your reply
  • Sort: 
avatar image
13
Best Answer

Answer by any_user · Nov 27, 2012 at 03:41 PM

Now that I found the answer myself, here it is:

You can run unity applications on headless linux systems (eg. servers) by running the application with xvfb (x virtual frame buffer http://manpages.ubuntu.com/manpages/precise/man1/Xvfb.1.html):

On ubuntu server 12.04 i had to install following packages:
apt-get install libglu1
apt-get install xvfb
apt-get install libxcursor1

then I was able to run unity applications with this command:

 xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' myUnityApplication -batchmode

it's important to run the virtual screen buffer in 24 or 32 bit mode (eg. 640x480x24 or 640x480x24:32) else it will not work (xvfb default is 640x480x8).

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mtoivo · Nov 27, 2012 at 03:47 PM 0
Share

Cool, even better workaround. $$anonymous$$ight come handy at some point. We'll see whether this is needed anymore when the next unity build comes out.

avatar image eheimburg · May 16, 2014 at 09:10 PM 2
Share

Just a comment for people wandering in now -- in Unity 4.something they added better headless linux support that doesn't require X11. The supported way to do this now is to build the app with the "Headless" checkbox checked in Unity. Then you don't need an xvfb session, nor even the "-batchmode" parameter.

On the down side, the old way doesn't seem to work correctly anymore -- the "-batchmode" parameter is supposedly still supported for Linux, but I haven't gotten it to do anything. This means if you really wanted to use one Linux build for both headless and regular gameplay, you seem to be out of luck.

avatar image
0

Answer by mtoivo · Nov 24, 2012 at 09:27 PM

Batchmode needs X11 session anyway. If you're using mac, it's easily achieved remotely (although I haven't tried this). Fire up your X11.app or XQuartz.app with newer OS's, use ssh -X user@ubuntuserver and there you go. On windows, you'd need some sort of X11 server running, too, but it's been a while since I've played with those.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image any_user · Nov 24, 2012 at 09:48 PM 0
Share

Ok thanks, that worked basically, I was able to start the application with ssh -X user@server. But how can I start it and log off with the server still running? Looks like I need to keep X11 open.

avatar image mtoivo · Nov 24, 2012 at 10:07 PM 0
Share

I guess you would need some kind of X11/VNC-solution for that to work. You could probably log in from console, start X11 session and fire up VNC-server there. It shouldn't be hard to set up a 'virtual' X11 session inside the server, that doesn't require a real X11 running. Something like this, perhaps: http://www.karlrunge.com/x11vnc/

avatar image
0

Answer by jcongote.unity · Apr 11, 2013 at 03:21 PM

Sometimes the application don't run in Xvfb for GLX, the solution for Unity 4.1 and later is to add -nographics argument

 xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' myUnityApplication -batchmode -nographics
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by nan · Oct 08, 2013 at 11:27 AM

Hi,

I think my UnityApp is run correctly:

Logfile

ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4185:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4185:(_snd_config_evaluate) function snd_func_concat returned error: No such file or direcFMOD failed to initialize ... Error initializing output device.

(Filename: Line: 177)

Begin MonoManager ReloadAssembly Platform assembly: /multi_test/multi_Data/Managed/UnityEngine.dll (this message is harmless) Loading /multi_test/multi_Data/Managed/UnityEngine.dll into Unity Child Domain Platform assembly: /multi_test/multi_Data/Managed/Assembly-CSharp.dll (this message is harmless) Loading /multi_test/multi_Data/Managed/Assembly-CSharp.dll into Unity Child Domain - Completed reload, in 0.140 seconds


but i Cant connect to it on port 25000. any idea ?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cheebsco · Jan 13, 2014 at 04:56 PM 0
Share

Change the port to 25050, I had the same error on Lubuntu with a unity game, and the port was being used already by a different process

avatar image
0

Answer by _Mathias · Jul 16, 2015 at 09:54 PM

Hello,

I need your help please. I try to install a server for my game on my debian server, and the game file is called "server.x86". When I replace "myUnityApplication" to "server.x86" in xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' myUnityApplication -batchmode

it returns an error:

 /usr/bin/xvfb-run: 183: /usr/bin/xvfb-run: server.x86: not found

I tried with the x86_64 extension but it still doesn't work. I built this application in Headless mode.

If somebody could help me it would be very nice ! Thanks in advance

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Linux game server 1 Answer

Headless linux server 2 Answers

Unity server on Amazon EC2 Ubuntu? 2 Answers

Batchmode on linux 1 Answer

Headless mode checkbox is uncheckable 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges