NoMachine Support

Your questions answered

Knowledge Base

Searching in: Articles & FAQs
Filter the search results
Applies to:
Last update:
Searching in: Articles & FAQs
ID: AR06N00891
Applies to: NX Server Products
Added on: 2016-06-20
Last update: 2016-06-20
How to solve error 'Cannot find the default environment' on Linux headless machines

On headless machines, or every time the local X server cannot be found, NoMachine will use its own display service (that is an embedded X server) to let users connect seamlessly a physical desktop running in background on the remote machine.

In order to connect to the physical desktop of the remote Linux host, it's necessary that a desktop environment is installed.

A desktop environment is a set of programs running on top of the computer operating system and sharing a common graphical user interface. Most common Linux desktop environments are Unity 3D, GNOME 3, KDE's Plasma desktop (they all implement 3D hardware acceleration and use OpenGL)  and lightweight ones such as MATE desktop (a fork of GNOME 2), Xfce and LXDE.

When no desktop environment is installed, users connecting to the remote computer usually get a black screen. To confirm that the problem is due to the fact that the desktop environment is not installed,  check the /usr/NX/var/log/node/C-<sessionId>/clients file and look for the 'Cannot find the default environment' message. 

As a further confirmation you may also check the user's home to see if a .xsession-errors file is present: it should indicate the reason why the /etc/X11/Xsession command failed, for example  "No such file or directory: gnome-session".

In order to solve this problem, download and install a desktop environment on the remote host

If the just installed desktop environment is Unity, GNOME or KDE (which are supported by default by NoMachine), then update the NoMachine configuration by running:

/usr/NX/scripts/setup/nxnode --availablesessionsetup

If a different desktop environment is chosen when for example a lighter solution is the preferable choice, it's necessary to configure NoMachine manually as explained below.

Edit /usr/NX/etc/node.cfg

1) Uncomment the DefaultDesktopCommand key and specify the command for starting the desktop environment.

For example the following command will instruct NoMachine to launch the Xfce desktop

DefaultDesktopCommand "/usr/local/bin/startxfce4'"

2) Uncomment the AvailableSessionTypes key and add the unix-xsession-default value. For example:

AvailableSessionTypes physical-desktop,unix-xsession-default
 

Edit /usr/NX/etc/server.cfg

3) Uncomment the AvailableSessionTypes key and add the unix-xsession-default value. For example:

AvailableSessionTypes physical-desktop,unix-xsession-default


4) Finally, restart NoMachine:

/etc/NX/nxserver --restart

 

When users connect, they should now be prompted with this dialog:

“Cannot detect any display running. Do you want NoMachine to create a new display and proceed to connect to the desktop?”

By choosing 'yes' NoMachine will launch the desktop session  (an Xfce session in the example above) and users will be able to connect to the remote physical desktop.

 

Some examples of how to setup a light desktop environment are available here:

- For Ubuntu https://www.nomachine.com/AR07K00676

- For Fedora https://www.nomachine.com/AR06L00806

 

For NoMachine v. 4 refers to:

https://www.nomachine.com/AR10K00710