Ubuntu dual-seat setup

Problem: My wife likes to use my computer, and so do I.

Goal: Allow two people to be seated at the computer simultaneously.

You will need:

  • A computer running Linux with systemd;
  • Two videocards (or the onboard integrated graphics plus one dedicated videocard);
  • Two display devices (monitors, TVs);
  • Two sets of keyboards and mice;
  • A multicore CPU is highly recommended, although not necessary;
  • Enough RAM for whatever two persons will be running simultaneously.

My setup:

  • Ubuntu Linux 15.04 64 bit;
  • CPU Intel I5-4690k;
  • 16 GB RAM DDR3-2133;
  • seat0:
    • Nvidia GeForce GTX 660;
    • Monitor LG 27MP75HM (27″, Full-HD, HDMI);
    • USB keyboard (Das Keyboard 4 Pro);
    • Mouse Logitech Performance MX (wireless).
  • seat1:
    • Intel HD Graphics 4600 (onboard);
    • TV Samsung UE55H7000 (55″, Full-HD, HDMI);
    • Keyboard Logitech K400r (wireless);
    • Mouse Logitech M175 (wireless).

Step 1: Enable both videocards in the BIOS setup

This will vary from BIOS to BIOS. On my motherboard (ASUS Z87-Pro), I’ve found something curious: the display adapter that will be used for seat0 has to be set as “Primary Display”. I’ve been able to use both the integrated Intel graphics and the Nvidia card for seat0, as long as they are set as Primary Display (iGPU for the integrated graphics; PCIE for the Nvidia card).

BIOS Graphics

I have read that some motherboards will not allow the integrated GPU and a PCI Express video adapter to be both enabled at the same time. I hope you are not stuck with such motherboard.

One more thing about Nvidia cards: I was not able to get the binary drivers to work with this multiseat setup. I recommend switching to Nouveau before proceeding.

Step 2: take note of your hardware

Your systemd automatically assigns all the hardware to the default seat, which is seat0. Let’s take a look at the hardware! Open a shell and fire the command:

lucas@desktop:~$ loginctl seat-status seat0

Tip: Maximize your shell window before issuing this command to get a better visualization.

It will show something like this:

seat0
 Sessions: *c4
 Devices:
 ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
 │ input:input1 "Power Button"
 ├─/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input26
 │ input:input26 "Video Bus"
 ├─/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
 │ input:input0 "Power Button"
 ├─/sys/devices/pci0000:00/0000:00:02.0/drm/card0
 │ drm:card0
 ├─/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128
 │ drm:renderD128
 ├─/sys/devices/pci0000:00/0000:00:02.0/graphics/fb1
 │ [MASTER] graphics:fb1 "inteldrmfb"
 ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1
 │ drm:card1
 ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/renderD129
 │ drm:renderD129
 ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/graphics/fb0
 │ [MASTER] graphics:fb0 "nouveaufb"
 ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2
 │ sound:card2 "NVidia"
 │ ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2/input27
 │ │ input:input27 "HDA NVidia HDMI/DP,pcm=3"
 │ ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2/input28
 │ │ input:input28 "HDA NVidia HDMI/DP,pcm=7"
 │ ├─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2/input29
 │ │ input:input29 "HDA NVidia HDMI/DP,pcm=8"
 │ └─/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2/input33
 │ input:input33 "HDA NVidia HDMI/DP,pcm=9"
 ├─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3
 │ sound:card3 "Generic"
 │ ├─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3/input10
 │ │ input:input10 "HD-Audio Generic HDMI/DP,pcm=10"
 │ ├─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3/input11
 │ │ input:input11 "HD-Audio Generic HDMI/DP,pcm=11"
 │ ├─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3/input6
 │ │ input:input6 "HD-Audio Generic HDMI/DP,pcm=3"
 │ ├─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3/input7
 │ │ input:input7 "HD-Audio Generic HDMI/DP,pcm=7"
 │ ├─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3/input8
 │ │ input:input8 "HD-Audio Generic HDMI/DP,pcm=8"
 │ └─/sys/devices/pci0000:00/0000:00:01.1/0000:02:00.1/sound/card3/input9
 │ input:input9 "HD-Audio Generic HDMI/DP,pcm=9"
 ├─/sys/devices/pci0000:00/0000:00:03.0/sound/card0
 │ sound:card0 "HDMI"
 │ ├─/sys/devices/pci0000:00/0000:00:03.0/sound/card0/input30
 │ │ input:input30 "HDA Intel HDMI HDMI/DP,pcm=3"
 │ ├─/sys/devices/pci0000:00/0000:00:03.0/sound/card0/input31
 │ │ input:input31 "HDA Intel HDMI HDMI/DP,pcm=7"
 │ └─/sys/devices/pci0000:00/0000:00:03.0/sound/card0/input32
 │ input:input32 "HDA Intel HDMI HDMI/DP,pcm=8"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb1
 │ usb:usb1
 │ ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/hidraw/hidraw0
 │ │ hidraw:hidraw0
 │ └─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9
 │ usb:1-9
 │ ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.2/1-9.2:1.2/0003:046D:C52B.0006/0003:046D:C52B.000B/input/input23
 │ │ input:input23 "Logitech Unifying Device. Wireless PID:101a"
 │ ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.2/1-9.2:1.2/0003:046D:C52B.0006/hidraw/hidraw1
 │ │ hidraw:hidraw1
 │ ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.4/1-9.4:1.0/0003:24F0:0140.0007/input/input21
 │ │ input:input21 "Metadot - Das Keyboard Das Keyboard"
 │ └─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.4/1-9.4:1.1/0003:24F0:0140.0008/input/input24
 │ input:input24 "Metadot - Das Keyboard Das Keyboard"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.0009/input/input22
 │ input:input22 "Logitech Unifying Device. Wireless PID:4024"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.000A/input/input25
 │ input:input25 "Logitech Unifying Device. Wireless PID:4008"
 └─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1
 sound:card1 "PCH"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input12
 │ input:input12 "HDA Intel PCH Front Mic"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input13
 │ input:input13 "HDA Intel PCH Rear Mic"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input14
 │ input:input14 "HDA Intel PCH Line"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input15
 │ input:input15 "HDA Intel PCH Line Out Front"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input16
 │ input:input16 "HDA Intel PCH Line Out Surround"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input17
 │ input:input17 "HDA Intel PCH Line Out CLFE"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input18
 │ input:input18 "HDA Intel PCH Line Out Side"
 └─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input19
 input:input19 "HDA Intel PCH Front Headphone"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb2
 │ usb:usb2
 │ ├─/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3
 │ │ usb:2-3
 │ └─/sys/devices/pci0000:00/0000:00:14.0/usb2/2-5
 │ usb:2-5
 ├─/sys/devices/pci0000:00/0000:00:1a.0/usb3
 │ usb:usb3
 │ └─/sys/devices/pci0000:00/0000:00:1a.0/usb3/3-1
 │ usb:3-1
 ├─/sys/devices/pci0000:00/0000:00:1d.0/usb4
 │ usb:usb4
 │ └─/sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1
 │ usb:4-1
 ├─/sys/devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0/block/sr0
 │ block:sr0
 ├─/sys/devices/pci0000:00/0000:00:1f.2/ata4/host3/target3:0:0/3:0:0:0/scsi_generic/sg3
 │ scsi_generic:sg3
 ├─/sys/devices/platform/eeepc-wmi/input/input20
 │ input:input20 "Eee PC WMI hotkeys"
 ├─/sys/devices/virtual/misc/kvm
 │ misc:kvm
 └─/sys/devices/virtual/misc/rfkill
 misc:rfkill

It looks confusing at first, but if you look carefully, you will be able to recognize your video and audio devices, as well as your keyboards and mice.

In my setup, I want to assign to the second seat (seat1) the Intel integrated graphics adapter, the Intel integrated audio adapter, the Logitech K400 keyboard and the Logitech M175 mouse. So, we have to find these devices in the list above.

Tip: If you have multiple Logitech wireless devices, like I have, you can sync all devices that belong to the same seat to one Logitech Unifying Receiver. Devices on the same receiver, however, cannot be assigned to different seats! That’s why I have synced the seat1 keyboard and mouse to one USB receiver, and the Performance MX mouse that belongs to seat0 to another receiver.

Step 3: assign devices to the secondary seat

First, let’s take note of the Intel video adapter info. It seems to be these devices:

 ├─/sys/devices/pci0000:00/0000:00:02.0/drm/card0
 │ drm:card0
 ├─/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128
 │ drm:renderD128
 ├─/sys/devices/pci0000:00/0000:00:02.0/graphics/fb1
 │ [MASTER] graphics:fb1 "inteldrmfb"

Now let’s assign each of these devices that belong to the integrated video adapter to seat1 using the following command:

lucas@desktop:~$ sudo loginctl attach seat1 /sys/devices/pci0000:00/0000:00:02.0/drm/card0 /sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 /sys/devices/pci0000:00/0000:00:02.0/graphics/fb1

Next, let’s find the keyboard and the mouse that belong to seat1. It took me some trial and error, since I have two Logitech mice, and the descriptions are not too obvious. But here they are:

├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.0009/input/input22
 │ input:input22 "Logitech Unifying Device. Wireless PID:4024"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.000A/input/input25
 │ input:input25 "Logitech Unifying Device. Wireless PID:4008"

So let’s assing them to seat1:

lucas@desktop:~$ sudo loginctl attach seat1 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.0009/input/input22 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.000A/input/input25

Step 4: Cross your fingers and reboot

At this point, you should have the bare minimum for a working second seat! Reboot. Hopefully, you should be greeted with two independent login screens, with one set of keyboard and mouse working on each screen.

Did it work? Great! Read this blog name out loud and proceed to the next step! It didn’t? Keep calm and jump to troubleshooting.

Step 5: Assign more devices to the secondary seat

You can assign more devices to seat1. In fact, you can assign devices from one seat to another on-the-fly, without logging out — except for video adapters! Examples of devices that you might want to assign to seat1 are webcams, card readers and audio devices.

In my setup, I have assigned the onboard audio adapter to seat1, so that my wife can flood the room with music using her 200-watts-per-channel sound system from the Iron Age. Here are the relevant devices:

└─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1
   sound:card1 "PCH"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input12
  │ input:input12 "HDA Intel PCH Front Mic"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input13
  │ input:input13 "HDA Intel PCH Rear Mic"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input14
  │ input:input14 "HDA Intel PCH Line"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input15
  │ input:input15 "HDA Intel PCH Line Out Front"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input16
  │ input:input16 "HDA Intel PCH Line Out Surround"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input17
  │ input:input17 "HDA Intel PCH Line Out CLFE"
  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input18
  │ input:input18 "HDA Intel PCH Line Out Side"
  └─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input19
  input:input19 "HDA Intel PCH Front Headphone"

You can assign the entire sound adapter to seat1 with the command:

lucas@desktop:~$ sudo loginctl attach seat1 /sys/devices/pci0000:00/0000:00:1b.0/sound/card1

That’s it! The Intel HDA device should have disappeared from seat0‘s sound settings and appeared in seat1‘s.

Tip: If your video card supports audio (e.g. via HDMI or DisplayPort), you can assign the video card’s audio device to the second seat.

You can check the devices attached to the secondary seat with the command:

lucas@desktop:~$ loginctl seat-status seat1 
seat1
 Sessions: *c5
 Devices:
 ├─/sys/devices/pci0000:00/0000:00:02.0/drm/card0
 │ drm:card0
 ├─/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128
 │ drm:renderD128
 ├─/sys/devices/pci0000:00/0000:00:02.0/graphics/fb1
 │ [MASTER] graphics:fb1 "inteldrmfb"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.0009/input/input22
 │ input:input22 "Logitech Unifying Device. Wireless PID:4024"
 ├─/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.2/0003:046D:C52B.0003/0003:046D:C52B.000A/input/input25
 │ input:input25 "Logitech Unifying Device. Wireless PID:4008"
 └─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1
 sound:card1 "PCH"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input12
 │ input:input12 "HDA Intel PCH Front Mic"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input13
 │ input:input13 "HDA Intel PCH Rear Mic"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input14
 │ input:input14 "HDA Intel PCH Line"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input15
 │ input:input15 "HDA Intel PCH Line Out Front"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input16
 │ input:input16 "HDA Intel PCH Line Out Surround"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input17
 │ input:input17 "HDA Intel PCH Line Out CLFE"
 ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input18
 │ input:input18 "HDA Intel PCH Line Out Side"
 └─/sys/devices/pci0000:00/0000:00:1b.0/sound/card1/input19
 input:input19 "HDA Intel PCH Front Headphone"

Troubleshooting

I have followed all these steps and it doesn’t work!

Don’t give up yet! It took me four hours to get this to work for the first time. Check the seat1 configuration with

loginctl seat-status seat1

If you get the following error message:

Failed to get seat: No seat 'seat1' known

then make sure that you have assigned all devices belonging to the video adapter to seat1. I had this error for failing to attach the framebuffer device.

Also check for kernel errors with the command dmesg,  as well as for X server errors in the log files /var/log/Xorg.*.log.

You may also try to invert the seat configuration. In my case, as explained above, only the video adapter set as “Primary Display” in the BIOS could be assigned to seat0. Who knows what other idiosyncrasies your computer might have?

My mouse/keyboard/audio adapter that was working on seat1 has come back to seat0!

Switching USB ports; attaching or removing devices; and kernel updates might change the address of your devices, and they will be automatically reassigned to seat0. To check the current configuration, use the commands:

loginctl seat-status seat0
loginctl seat-status seat1

Reassign devices to seat1 as needed. If you feel that your setup is FUBAR and you want to reset and start over, the following command will reassign all devices to seat0:

sudo loginctl flush-devices
My Nvidia seat ramdomly freezes, except for the mouse cursor, while my other seat still works!

This bug seems to happen often with Nvidia GeForce GTX 660 cards on nouveau, especially when other video adapters are in use simultaneously. I have fixed this by loading the proprietary Nvidia firmware with nouveau, as described in this thread.

Advertisements
Ubuntu dual-seat setup

One thought on “Ubuntu dual-seat setup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s