In order to connect to the physical desktop of the remote Linux host, it's necessary that a desktop environment is installed. This is necessary also for creating a NoMachine virtual desktop.
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:
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.
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
2) Uncomment the AvailableSessionTypes key and add the unix-xsession-default value. For example:
3) Uncomment the AvailableSessionTypes key and add the unix-xsession-default value. For example:
4) Finally, restart NoMachine:
Some examples of how to setup an alternative desktop environment are available here: https://www.nomachine.com/AR04K00667
Note for headless machines and others
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.
Given that a desktop environment is available (as explained above) when users connect, they are 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.