Sample Header Ad - 728x90

Start two X servers on boot on RHEL

3 votes
1 answer
2011 views
I have a powerful machine that I want to use as a multi-seat system. It has two graphic cards and two pairs of keyboards and mice. I've been able to successfully configure two "seats" using udev and Xorg.conf, and launch two X servers from a script so two users can have independent sessions. Just for the record, here's my udev rules file, where I identify each USB hub and label the devices and the seats: SUBSYSTEM=="drm", KERNEL=="card[0-9]*", ATTRS{vendor}=="0x10de", DRIVERS=="nvidia", TAG+="master-of-seat" # SUBSYSTEM=="drm", KERNEL=="card0", ENV{ID_SEAT}="seat0" # SUBSYSTEM=="drm", KERNEL=="card1", ENV{ID_SEAT}="seat1" SUBSYSTEM=="input", ENV{ID_INPUT.tags}="input_default" # KVM HUBS KERNELS=="3-2", ATTRS{bDeviceClass}=="09", ENV{KVM_HUB}="1", ENV{ID_SEAT}="seat0" KERNELS=="3-8", ATTRS{bDeviceClass}=="09", ENV{KVM_HUB}="2", ENV{ID_SEAT}="seat1" # Devices of HUB 1 KERNEL=="event*", ENV{KVM_HUB}=="1", ATTRS{bInterfaceProtocol}=="01" SYMLINK+="kvm_keyboard_1" KERNEL=="event*", ENV{KVM_HUB}=="1", ATTRS{bInterfaceProtocol}=="02" SYMLINK+="kvm_mouse_1" # Devices of HUB 2 KERNEL=="event*", ENV{KVM_HUB}=="2", ATTRS{bInterfaceProtocol}=="01" SYMLINK+="kvm_keyboard_2" KERNEL=="event*", ENV{KVM_HUB}=="2", ATTRS{bInterfaceProtocol}=="02" SYMLINK+="kvm_mouse_2" # Default seat SUBSYSTEM=="input", TAG=="seat", ENV{ID_SEAT}=="" , ENV{ID_SEAT}="seat0" # set all tags accordingly ENV{ID_SEAT}!="", ENV{ID_INPUT.tags}+="$env{ID_SEAT}" TAG+="$env{ID_SEAT}" The relevant part of my xorg.conf file looks like this: Section "ServerFlags" # Option "AutoAddDevices" "false" # Option "AutoEnableDevices" "false" Option "DefaultServerLayout" "Layout0" Option "AllowMouseOpenFail" "true" Option "Xinerama" "0" EndSection # --------------------------------------------------------------- # LAYOUT Section "ServerLayout" Identifier "Layout0" Screen "Screen0" MatchSeat "seat0" Option "Clone" "off" EndSection Section "ServerLayout" Identifier "Layout1" Screen "Screen1" MatchSeat "seat1" Option "Clone" "off" EndSection As I said, **I can successfully launch** two independent sessions using the following script, but I'd like this to happen automatically on boot. #!/bin/bash set +x rm /etc/X11/xorg.conf cp ./xorg_independientes /etc/X11/xorg.conf # X (:0) systemctl stop gdm killall Xorg killall X systemctl restart gdm sleep 7 # X (:1) su - sit -c "startx /usr/bin/gnome-session -- :1 vt4 -layout Layout1 -seat seat1 -sharevts" & sleep 10 DISPLAY=:1 xhost + My approach would be setting the default target runlevel to 4 (so it has everything but graphics) and then placing these commands in a script somewhere.
Asked by José Tomás Tocino (170 rep)
Dec 12, 2016, 09:02 AM
Last activity: Jun 25, 2025, 10:09 PM