Troubleshooting Virtual Session Creation on Linux
Topics
If connecting to a virtual session results in a No session available
or The sessionId
error, this is probably due to the fact that the virtual
session creation failed and was terminated.
session
is not available
You can check if the session is present with the dcv list-sessions
command. See Viewing NICE DCV sessions for more information about inspecting running sessions. If the session
is not present in the list, then it might have failed.
Investigating Virtual Session Creation Failure on Linux
A virtual session is created on Linux with the command:
$
dcv create-sessionsession
This command will return an error only if the creation of the session fails. However, it might happen that
the session is initially created successfully, but it terminates before a user can connect. You might notice this
because when you check for the existing sessions, for example with the command dcv list-sessions
or
with dcv describe-session
, you might get no listed sessions.
session
In most of the cases, this happens because the desktop session is created but then immediately fails, for example in case one of the applications launched by the init script crashed or failed, or in case one of the required tools is missing.
Check the following in case the session creation fails:
-
Check the
/var/log/dcv/sessionlauncher.log
file containing the log related to the dcv component creating the new session processes. -
Check the
/var/log/dcv/dcv-session.
file containing the log related to the dcv init script.user
.session.log
-
Check the
$HOME/.xsession-errors
file in the home directory corresponding to the session owner. This file contains a log generated by the system X session init script, and usually contains the log generated by the desktop session manager or by other applications called by the script. -
Check the system logs to get more information about failing systems and components. As a start, check the output of
dmesg
(e.g in case of a process failure) andjournalctl -xe
. -
Test with a failsafe session to verify that the issue does not depend on the session manager in use.
In case the failure only occurs to a specific user, you might also try the following:
-
Check the user configuration, in particular what happens when the user configuration is deleted or renamed.
Depending on the desktop environment and version, the configuration directory might be
.gnome
or.kde
or.config
in the user directory. -
Check for specific user configurations affecting the user
PATH
or environment. Quite often, session start failures for specific users are due to frameworks such asanaconda
overriding some standard native commands that may causedbus
connections in sessions initialization to fail. -
Check for permission issues. Wrong permissions set on local
~/.dbus
or~/.Xauthority
(for example they might be owned byroot
instead of the user) might cause a desktop session to terminate immediately.
Creating a Failsafe Virtual Session on Linux
A common strategy to verify if the session creation failure is tied to the startup of the desktop environment consists in creating a minimal session. We will refer to this session as a "failsafe" session. If creating a failsafe session works correctly, then we can deduce that your normal session fails because the default system desktop environment fails to start. Conversely, if also the failsafe session fails, then the problem is more likely to be related to the setup of NICE DCV server.
A failsafe session typically consists of a desktop session containing only a simple window manager and a terminal. This allows the user to check in case there are session creation issues related to the specific session environment in use (typically gnome or KDE).
In order to create a failsafe session, you need to create an init script for the user, containing something as:
#!/bin/sh metacity & xterm
This will start the metacity
window manager and launch an xterm
terminal, as soon as the
xterm
process is terminated the session will also terminate.
You can use another session manager or terminal of your choice provided that it is available on the system.
Note
You must make sure that the script does not terminate immediately. For this you need to have a non
immediately terminating program launched by the end of the script. As the last command is terminated
(xterm
in the example), the init session is terminated as well. At the same time, when you launch
another tool after the windows manager, you need to make sure it runs in background (by adding the
&
in the example), to make sure that the next command is called.
Then you need to make sure that the init script is executable:
$
chmod a+xinit.sh
To create the session with the specified init script from the user shell, run this command, where
init.sh
is the script previously created:
$
dcv create-session dummy --initinit.sh
To create a session for another user as superuser you can run this command instead:
$
sudo dcv create-session test --useruser
--owneruser
--initinit.sh
Finally, you can launch a test application such for example dcvgltest
(only in case you have the
nice-dcv-gltest
package installed) or glxgears
to verify that an OpenGL or any other
application is correctly working.