Skip to content

Commit 48044c2

Browse files
authored
[develop] Fix DCV on Ubuntu 22.04+ by disabling Wayland (#3057)
* Fix DCV on Ubuntu 22.04+ on DLAMI by disabling Wayland Disable Wayland protocol in GDM3 for Ubuntu 22.04+ to force the use of Xorg on GPU instances running without a display. Ubuntu 22.04+ defaults to Wayland which causes GDM startup issues with NVIDIA drivers and NICE DCV. Force Xorg by setting `WaylandEnable=false` in `/etc/gdm3/custom.conf`. * Add kitchen test to check if GDM is using X11 session type
1 parent 85a0bc7 commit 48044c2

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste
1414
and achieve better performance at scale.
1515
- Load kernel module `drm_client_lib` before installation of NVIDIA driver, if available on the kernel.
1616
- Reduce dependency footprint by installing the package `sssd-common` rather than `sssd`.
17+
- Disable Wayland protocol in GDM3 for Ubuntu 22.04+ to force the use of Xorg on GPU instances running without a display.
1718
- Upgrade Slurm to version 24.11.7 (from 24.11.6).
1819
- Upgrade Pmix to 5.0.9 (from 5.0.6).
1920
- Upgrade libjwt to version 1.18.4 (from 1.17.0) for all OSs except Amazon Linux 2.

cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,62 @@ def optionally_disable_rnd
8282
end
8383
end
8484

85+
# Disable Wayland in GDM to ensure Xorg is used
86+
# This is required for Ubuntu 22.04+ where Wayland is the default
87+
# Without this, GDM won't start Xorg on headless GPU instances
88+
def disable_wayland
89+
bash 'Disable Wayland in GDM' do
90+
user 'root'
91+
code <<-DISABLEWAYLAND
92+
set -e
93+
if [ -f /etc/gdm3/custom.conf ]; then
94+
sed -i 's/#WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/custom.conf
95+
# If the line doesn't exist at all, add it under [daemon] section
96+
if ! grep -q "^WaylandEnable=false" /etc/gdm3/custom.conf; then
97+
sed -i '/\\[daemon\\]/a WaylandEnable=false' /etc/gdm3/custom.conf
98+
fi
99+
fi
100+
DISABLEWAYLAND
101+
end
102+
end
103+
104+
# Override allow_gpu_acceleration to disable Wayland before starting X
105+
def allow_gpu_acceleration
106+
# Update the xorg.conf to set up NVIDIA drivers.
107+
# NOTE: --enable-all-gpus parameter is needed to support servers with more than one NVIDIA GPU.
108+
nvidia_xconfig_command = "nvidia-xconfig --preserve-busid --enable-all-gpus"
109+
nvidia_xconfig_command += " --use-display-device=none" if node['ec2']['instance_type'].start_with?("g2.")
110+
execute "Set up Nvidia drivers for X configuration" do
111+
user 'root'
112+
command nvidia_xconfig_command
113+
end
114+
115+
# dcvgl package must be installed after NVIDIA and before starting up X
116+
# DO NOT install dcv-gl on non-GPU instances, or will run into a black screen issue
117+
install_dcv_gl
118+
119+
# Disable Wayland to ensure GDM starts Xorg
120+
disable_wayland
121+
122+
# Configure the X server to start automatically when the Linux server boots and start the X server in background
123+
bash 'Launch X' do
124+
user 'root'
125+
code <<-SETUPX
126+
set -e
127+
systemctl set-default graphical.target
128+
systemctl isolate graphical.target &
129+
SETUPX
130+
end
131+
132+
# Verify that the X server is running
133+
execute 'Wait for X to start' do
134+
user 'root'
135+
command "pidof X || pidof Xorg"
136+
retries 10
137+
retry_delay 5
138+
end
139+
end
140+
85141
def post_install
86142
# ubuntu-desktop comes with NetworkManager. On a cloud instance NetworkManager is unnecessary and causes delay.
87143
# Instruct Netplan to use networkd for better performance

cookbooks/aws-parallelcluster-platform/test/controls/dcv_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,27 @@
318318
end
319319
end
320320
end
321+
322+
control 'tag:config_dcv_xorg_running_with_x11_session_type' do
323+
title 'Check that Xorg is running and GDM is using X11 session type (not Wayland)'
324+
only_if do
325+
!os_properties.on_docker? &&
326+
instance.head_node? &&
327+
instance.dcv_installed? &&
328+
node['cluster']['dcv_enabled'] == "head_node" &&
329+
instance.graphic? &&
330+
instance.nvidia_installed? &&
331+
instance.dcv_gpu_accel_supported?
332+
end
333+
334+
describe 'Xorg process should be running' do
335+
subject { command('pidof Xorg || pidof X') }
336+
its('exit_status') { should eq 0 }
337+
its('stdout') { should_not be_empty }
338+
end
339+
340+
describe 'GDM should be using X11 session type, not Wayland' do
341+
subject { command("loginctl show-session $(loginctl | grep gdm | awk '{print $1}') -p Type 2>/dev/null | grep -i x11") }
342+
its('exit_status') { should eq 0 }
343+
end
344+
end

0 commit comments

Comments
 (0)