OK, I finally made it work.
general
This section is here as a little "getting started" for others, and as a little "aide-mémoire" for myself... This is not the only and maybe not even the best way to do it, it's just the way I did it.
- Get two USB hubs and place one at each of the two seats. Plug them into two USB ports of the machine.
- Get a USB sound card (small USB dongle with one mic-in and one line-out connector) and plug it into another USB port of your machine. This assumes that there already is another (on-board) sound device that is to be used on seat0.
- Get two USB wireless mouse/keyboard combos and plug one of the USB dongles in each of the two USB hubs.
- Assign the hubs to the respective seats (
loginctl attach seat1 /dev/...
). This automatically assigns the mouse and keyboard which are plugged into the hub.
- Assign the USB sound card to seat1
- Assign one of the Nvidia cards (all of it, including DRM and Sound devices) to seat1.
- If you have any other devices that are not plugged into the already-assigned hub, then assign them as well.
Run loginctl seat-status seat1
. This is how it looks here:
seat1
Sessions: *c3
Devices:
├─/sys/devices/pci0000:00/0000:00:03.0/0000:02:00.0/drm/card1
│ [MASTER] drm:card1
├─/sys/devices/pci0000:00/0000:00:03.0/0000:02:00.0/drm/renderD129
│ drm:renderD129
├─/sys/devices/pci0000:00/0000:00:03.0/0000:02:00.1/sound/card2
│ sound:card2 "NVidia"
│ ├─/sys/devices/pci0000:00/0000:00:03.0/0000:02:00.1/sound/card2/input20
│ │ input:input20 "HDA NVidia HDMI/DP,pcm=3"
│ └─/sys/devices/pci0000:00/0000:00:03.0/0000:02:00.1/sound/card2/input21
│ input:input21 "HDA NVidia HDMI/DP,pcm=7"
├─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8
│ usb:usb8
│ ├─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8/8-1
│ │ usb:8-1
│ │ ├─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8/8-1/8-1.3
│ │ │ usb:8-1.3
│ │ ├─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8/8-1/8-1.4/8-1.4:1.0/0003:046A:B102.0004/input/input5
│ │ │ input:input5 "HOLTEK USB Wireless Device"
│ │ └─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8/8-1/8-1.4/8-1.4:1.1/0003:046A:B102.0005/input/input6
│ │ input:input6 "HOLTEK USB Wireless Device"
│ └─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8/8-2
│ usb:8-2
│ └─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb8/8-2/8-2.3
│ usb:8-2.3
├─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb9
│ usb:usb9
│ ├─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb9/9-1
│ │ usb:9-1
│ │ └─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb9/9-1/9-1.3
│ │ usb:9-1.3
│ └─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb9/9-2
│ usb:9-2
│ └─/sys/devices/pci0000:00/0000:00:04.0/0000:03:00.0/usb9/9-2/9-2.3
│ usb:9-2.3
├─/sys/devices/pci0000:00/0000:00:12.0/usb4
│ usb:usb4
│ ├─/sys/devices/pci0000:00/0000:00:12.0/usb4/4-4/4-4:1.0/sound/card5
│ │ sound:card5 "Device"
│ └─/sys/devices/pci0000:00/0000:00:12.0/usb4/4-4/4-4:1.3/0003:0D8C:0014.0001/input/input2
│ input:input2 "C-Media Electronics Inc. USB Audio Device"
└─/sys/devices/pci0000:00/0000:00:12.2/usb1
usb:usb1
├─/sys/devices/pci0000:00/0000:00:12.2/usb1/1-2
│ usb:1-2
├─/sys/devices/pci0000:00/0000:00:12.2/usb1/1-3/1-3:1.0/input/input15
│ input:input15 "UVC Camera (046d:0807)"
├─/sys/devices/pci0000:00/0000:00:12.2/usb1/1-3/1-3:1.0/video4linux/video0
│ video4linux:video0 "UVC Camera (046d:0807)"
├─/sys/devices/pci0000:00/0000:00:12.2/usb1/1-3/1-3:1.2/sound/card3
│ sound:card3 "U0x46d0x807"
└─/sys/devices/pci0000:00/0000:00:12.2/usb1/1-5
usb:1-5
nouveau
I didn't find out what to do about the screen flickering on seat1 and lockups on seat0 when using the nouveau driver. In case you're looking for a solution for this very problem, it might be worth to have a look at https://wiki.archlinux.org/index.php/Xorg_multiseat which says:
To avoid tearing this seems to help on nearly all configurations - add this to /etc/environment:
CLUTTER_PAINT=disable-clipped-redraws:disable-culling
CLUTTER_VBLANK=True
Another hint was to add the user to the group video
because otherwise they might not have access to the DRI interface.
This is about all I can say, and I switched to using Nvidia binary drivers.
NVidia
The problem that I had was appearantly that the X server of seat0 was somehow trying to take control of both GPUs even though GPU-1 was is assigned to seat1.
This somehow mixed up the X screens and X server for seat 1 couldn't find any usable screens.
I spent hours of fiddling with /etc/X11/xorg.conf.d
files where I put tiny pieces of configuration like
Section "Device"
Identifier "graphic0"
Driver "nvidia"
Option "NoLogo"
BusId "PCI:1:0:0"
MatchSeat "seat-1"
Option "Monitor-DVI-1" "monitor1"
EndSection
and
Section "ServerLayout"
Identifier "seat-1"
Screen "screen1" 0 0
InputDevice "mouse1" "CorePointer"
InputDevice "keyboard1" "CoreKeyboard"
Option "Seat" "seat-1"
Option "SingleCard" "on"
EndSection
as advised by https://wiki.archlinux.org/index.php/Xorg_multiseat (lot's of useful information there, though it didn't solve my problem) or https://devtalk.nvidia.com/default/topic/936873/linux/-howto-multiseat-with-ubuntu-16-04-systemd-gdm-proprietary-drivers/1 (another high-quality discussion of this issue).
What finally worked for me was doing it the hard way and providing a X configuration for each of the seats.
So, my procedure was:
- use
loginctl attach seat1 ....
to assign all required devices to seat1
install nvidia proprietary drivers (make sure you select the right one for you system; in terminal run ubuntu-drivers devices
to see the list of available drivers)
apt install nvida-384
- reboot
- login on seat0 and run
nvidia-seetings
. Select X Server Display Configuration
on the left, click on save to X Configuration File
bottom-right and save the file as ~/xorg-template
- Copy ~/xorg-template config file twice to
/etc/X11
, once as xorg-seat0.conf
and once as xorg-seat1.conf
Modify these two Xorg config files to match seat0 and seat1 setup respectively. I only had to change a couple of lines - the PCI address of the GPU and the number of monitors. I did however also change the naming of the Identifiers for the sake of clarity - I suppose that would not really be required. Below is my config:
seat0
# xorg-seat0.conf
Section "ServerLayout"
Identifier "Layout-seat0"
Screen 0 "Screen-seat0" 0 0
InputDevice "Keyboard-seat0" "CoreKeyboard"
InputDevice "Mouse-seat0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse-seat0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard-seat0"
Driver "kbd"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor-seat0_1"
VendorName "Unknown"
ModelName "FUS H22-1W"
HorizSync 28.0 - 79.0
VertRefresh 50.0 - 75.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device-seat0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce GT 740"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen-seat0"
Device "Device-seat0"
Monitor "Monitor-seat0_1"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "metamodes" "DVI-D-0: nvidia-auto-select +0+0, DVI-D-1: nvidia-auto-select +1680+0"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection
seat1
# xorg-seat1.conf
Section "ServerLayout"
Identifier "Layout-seat1"
Screen 0 "Screen-seat1" 0 0
InputDevice "Keyboard-seat1" "CoreKeyboard"
InputDevice "Mouse-seat1" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse-seat1"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard-seat1"
Driver "kbd"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor-seat1_1"
VendorName "Unknown"
ModelName "FUS H22-1W"
HorizSync 28.0 - 79.0
VertRefresh 50.0 - 75.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device-seat1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce GT 730"
BusID "PCI:2:0:0"
EndSection
Section "Screen"
Identifier "Screen-seat1"
Device "Device-seat1"
Monitor "Monitor-seat1_1"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "metamodes" "DVI-D-0: nvidia-auto-select +0+0"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Create a new file 10-seats.conf
in /etc/lightdm/lightdm.conf.d/
(create the folder if it isn't there yet) and assign the layouts and config files to each of the X servers:
# 10-seats.conf
[Seat:seat0]
xserver-command=/usr/bin/X :0
xserver-config=/etc/X11/xorg-seat0.conf
xserver-layout=Layout-seat0
[Seat:seat1]
xserver-command=/usr/bin/X :1
xserver-config=/etc/X11/xorg-seat1.conf
xserver-layout=Layout-seat1
- reboot
As you may notice, the xorg-seat[01].conf files do not contain any hint to seats. I named the Identifiers using the strings seat0 and seat1, but that has no relevance.
But, in lightdm configuration it is required to use the names you assigned to the seats when creating them. seat0 can't be changed, but the second seat can have any name you choose (as long as it starts with seat
and is followed by letters, digits, - and _ only). Make sure you use that name to configure the second seat - I have used seat1
to keep it simple.
I'm pretty sure that there are things that could be removed from the X config files, but I haven't yet tried to tidy them up. If you find a more minimalistic file to working well, feel free to post a comment here and I'll add your info (well, unless you don't feel like posting your own entire answer, that is).
For example, neither the mouse nor the keyboard configured in both of the X config files do exist on my machine - they are dummy devices added by nvidia-settings
. The physical devices (USB wireless mouse and keyboard) are added on the fly because they are attached to seat0 and seat1 respectively.