Skip to content

Nice DCV virtual desktop Linux

0

Hi, I am trying out the Amazon Nice DCV server\client on a Rocky8\Win11 setup for a virtual desktop. It seems to work well. Does anyone have a working solution to auto start the DCV session when a user logins with the Windows client, so you dont have to login manually start the session then login via the windows client. I know it is able to do this for a console but it has alluded me if this can be done for virtual desktops. Thank you

asked 17 days ago101 views
4 Answers
4

Regarding your last comment: You are right, enabling individual services for every user does not scale in a dynamic multi-user environment.

For a truly 'on the fly' solution, I recommend these two industry-standard approaches:

  • NICE DCV Session Manager: This is the official AWS solution for multi-user fleets. It acts as a broker that automatically creates and manages virtual sessions whenever a user requests a connection, eliminating the need for manual service management.
  • PAM Integration: You can use a PAM script (pam_exec.so) on the Rocky 8 host. This triggers a session creation script automatically the moment a user authenticates, ensuring the DCV session exists before the client attempts to attach.

If you have a high volume of users, the Session Manager is the most robust way to handle this natively.

EXPERT
answered 17 days ago
4

As per re:Post Agent, DCV does not have native option to auto create virtual sessions. You will need to create a custom systemd daemon with custom script to create them on system boot and when users log off.

If you have a fleet of Amazon DCV servers, you can use Amazon DCV Connection Gateway to centralize access. Refer to blog for more information.

For a managed solution, do consider Amazon Workspaces which use DCV technologies for streaming.

You can also explore this Github repo which provisions EC2 instance with DCV server and other features including multiple virtual sessions support. Note that code is under MIT-0 license, i.e. free to use with no warranty.

AWS
EXPERT
answered 15 days ago
EXPERT
reviewed 14 days ago
2

The previous answer of the re:Post Agent is correct regarding the limitation of the create-session parameter in dcv.conf. To automate a Virtual Session for a specific user on Rocky 8, use a systemd unit.

1. Create a Service Unit Create /etc/systemd/system/dcv-session@.service (using a template allows for multi-user scaling):

[Unit]
Description=NICE DCV Virtual Session for %i
After=dcvserver.service
Requires=dcvserver.service

[Service]
Type=oneshot
RemainAfterExit=yes
# Ensure the session is owned by the target user
ExecStart=/usr/bin/dcv create-session --type virtual --owner %i %i
ExecStop=/usr/bin/dcv close-session %i

[Install]
WantedBy=multi-user.target

2. Enable and Start

Replace USERNAME with the actual Linux account name:

systemctl daemon-reload
systemctl enable --now dcv-session@USERNAME.service

Consider the following:

  • X11 Requirements: For virtual sessions, ensure the dcv-gl package is installed if GPU acceleration is required, and that an X server (like Xvfb) is accessible, though DCV usually handles the virtual display buffer internally.
  • Permissions: The command must run as root (default for systemd) to assign session ownership to the user without requiring the user to be logged in via SSH first.
  • Persistence: Using Type=oneshot with RemainAfterExit=yes ensures systemd tracks the session as "active" without needing a background process, as the DCV server manages the session lifecycle.
EXPERT
answered 17 days ago
0

For Amazon DCV virtual sessions on Linux, you can automate session creation, though the approach differs from console sessions. Here's what you need to know:

Console vs Virtual Sessions: Console sessions can be configured to start automatically using the create-session parameter in the DCV configuration file (/etc/dcv/dcv.conf). However, virtual sessions require manual creation and cannot be auto-started in the same way through the configuration file.

Workaround for Virtual Sessions: To achieve automatic session creation for virtual sessions, you would need to implement a custom solution, such as:

  1. Create a systemd service or startup script that runs the DCV create-session command when the system boots or when a user logs in
  2. Use the command: dcv create-session <username> --owner <username> --storage-root %home% --type virtual
  3. You can verify the session was created with: dcv list-sessions

Important Considerations:

  • Virtual sessions support custom resolutions and multiple displays, unlike console sessions which have resolution limits (especially on non-GPU instances)
  • The session owner must match the user who will be connecting
  • You'll need to ensure the DCV server is running before attempting to create the session

While there isn't a built-in automatic virtual session creation feature like there is for console sessions, implementing a startup script or systemd service would allow you to achieve similar functionality for your Rocky Linux 8 setup.
Sources
Deep Learning graphical desktop on Ubuntu Linux with AWS Deep Learning AMI (DLAMI) | AWS re:Post
Install GUI (graphical desktop) on Amazon EC2 instances running Amazon Linux 2023 (AL2023) | AWS re:Post
Deep Learning graphical desktop on Amazon Linux 2023 (AL2023) with AWS Deep Learning AMI (DLAMI) | AWS re:Post

answered 17 days ago
EXPERT
reviewed 17 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.