Taylorbyte.com

Documentation Wiki

Dual Seat debian linux NVIDIA

Hardware requirements

  • 2 NVIDIA cards / 1 NVIDIA card with 2 GPUs
  • 2 Monitors
  • 2 USB keyboards
  • 2 USB mice
  • 2 Sound cards / devices

Configure kdmrc fpr 2 layouts

sudo nano /etc/kde4/kdm/kdmrc

Change StaticServers=:0 to StaticServers=:0,:1

Change ReserveServers=:1,:2,:3 to ReserveServers=:2,:3

At the end of [X-:0-Core] settings add the following lines

ServerArgsLocal=-nolisten tcp -layout Layout0
ServerVT=7

[X-:1-Core]
ServerArgsLocal=-nolisten tcp -layout Layout1 -sharevts -novtswitch
ServerVT=8

Configure xorg.conf

Backup xorg.conf

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.orig

Find keyboards and mice

watch -n 1 ls /dev/input/by-path/

Plug in usb keyboards and mice and watch the list, to see which ones are which

Create a new xorg.conf

cat > /etc/X11/xorg.conf << EOF
# nvidia-xconfig: X configuration file generated by nvidia-xconfigi
# nvidia-xconfig:  version 1.0  (buildmeister@builder62)  Wed May 27 01:58:49 PDT 2009

Section "ServerFlags"
    Option         "DefaultServerLayout" "Layout0"
    Option         "AllowMouseOpenFail"  "true"
    Option         "AutoAddDevices"      "false"
    Option         "DontZap"             "false"
EndSection

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "G15-0" "CoreKeyboard"
    InputDevice    "G15-0-Buttons" "SendCoreEvents"
    InputDevice    "RazerMouse0" "CorePointer"
    InputDevice    "RazerMouse0-extra" "SendCoreEvents"
EndSection

Section "ServerLayout"
    Identifier     "Layout1"
    Screen      0  "Screen1"
    InputDevice    "G15-1" "CoreKeyboard"
    InputDevice    "G15-1-Buttons" "SendCoreEvents"
    InputDevice    "RazerMouse1" "CorePointer"
    InputDevice    "RazerMouse1-extra" "SendCoreEvents"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    Identifier     "RazerMouse0"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.0-usb-0:2:1.0-event-mouse"
EndSection

Section "InputDevice"
    Identifier     "RazerMouse0-extra"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.0-usb-0:2:1.0-mouse"
EndSection

Section "InputDevice"
    Identifier     "RazerMouse1"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.1-usb-0:1:1.0-event-mouse"
EndSection

Section "InputDevice"
    Identifier     "RazerMouse1-extra"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.1-usb-0:1:1.0-mouse"
EndSection

Section "InputDevice"
    Identifier     "G15-0"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.0-usb-0:1.1:1.0-event-kbd"
#    Option         "XkbOptions"          "terminate:ctrl_alt_bksp"
EndSection

Section "InputDevice"
    Identifier     "G15-0-Buttons"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.0-usb-0:1.4:1.0-event-kbd"
EndSection

Section "InputDevice"
    Identifier     "G15-1"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.2-usb-0:1.1:1.0-event-kbd"
#    Option         "XkbOptions"          "terminate:ctrl_alt_bksp"
EndSection

Section "InputDevice"
    Identifier     "G15-1-Buttons"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:1a.2-usb-0:1.4:1.0-event-kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "BenQ"
    ModelName      "G2420HD"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "BenQ"
    ModelName      "G2420HD"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "GTX285"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 285"
    BusID          "PCI:3:0:0"
    Option         "NoLogo"
    Option         "XAANoOffscreenPixmaps" "true"
    Option         "AllowGLXWithComposite" "true"
EndSection

Section "Device"
    Identifier     "9800GT"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 9800 GT"
    BusID          "PCI:5:0:0"
    Option         "NoLogo"
    Option         "XAANoOffscreenPixmaps" "true"
    Option         "AllowGLXWithComposite" "true"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "GTX285"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "RenderAccel" "True"
    Option         "AllowGLXWithComposite" "True"
    Option         "RandRRotation" "True"
    Option         "AddARGBGLXVisuals" "True"
    Option         "DisableGLXRootClipping" "True"
    Option         "AddARGBGLXVisuals" "True"
   SubSection     "Display"
        Depth       24
   EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "9800GT"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "RenderAccel" "True"
    Option         "AllowGLXWithComposite" "True"
    Option         "RandRRotation" "True"
    Option         "AddARGBGLXVisuals" "True"
    Option         "DisableGLXRootClipping" "True"
    Option         "AddARGBGLXVisuals" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection
EOF

Easy part is finnished restart x. Switch to TTY 1

/etc/init.d/kdm restart

Setup sound with multiple sound cards

Find sound devices

sudo lsmod | grep snd
snd_usb_audio          93397  4
snd_hda_intel          23311  14

Add these 2 lines to the bottom of /etc/modprobe.d/alsa.conf

sudo cat >> /etc/modprobe.d/alsa.conf << EOF
options snd-hda-intel index=0,1,2
options snd-usb-audio index=3
EOF

Configure asound.conf

sudo cat > /etc/asound.conf << EOF
pcm.!default {
  type plug
  slave.pcm intel
}

pcm.intel {
  type asym
  playback.pcm "intelplay"
  capture.pcm "intelroute"
  hint {
    show on
    description "snd-hda-intel"
  }
}

pcm.intelplay {
  type dmix
  ipc_key 1001
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

pcm.intelroute {
  type route
  slave {
    pcm "intelrecord"
    format S16_LE
  }
  ttable {
    0 {0 0.5}
    1 {0 0.5}
  }
}

pcm.intelrecord {
  type dsnoop
  ipc_key 1002
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:0,0"
    #period_time 0
    #period_size 1024
    #buffer_size 8192
    period_size 256
    periods 16
    buffer_size 16384
  }
  bindings {
    0 0
  }
}

pcm.usb {
  type asym
  playback.pcm "usbplay"
  capture.pcm "usbrecord"
  hint {
    show on
    description "snd-usb-audio"
  }
}

pcm.usbplay {
  type dmix
  ipc_key 3001
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:3,0"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

pcm.usbrecord {
  type dsnoop
  ipc_key 3002
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:3,0"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

ctl.usb {
type hw
card 1
}

ctl.intel {
type hw
card 0
}

pcm.nvidia {
  type dmix
  ipc_key 4001
  ipc_key_add_uid false
  ipc_perm 0666
  hint {
    show on
    description "snd-nvidia"
  }
  slave {
    pcm "hw:1,9"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

pcm.nvidia1 {
  type dmix
  ipc_key 5001
  ipc_key_add_uid false
  ipc_perm 0666
  hint {
    show on
    description "snd-nvidia1"
  }
  slave {
  pcm "hw:2,9"
  period_time 0
  period_size 1024
  buffer_size 8192
  }
}
EOF

Configure audio and video groups for users

sudo usermod -G audio -G video -G plugdev -a user
sudo usermod -G audio -G video -G plugdev -a guest

Configure each users .asoundrc file

sudo cat > /home/guest/.asoundrc << EOF
pcm.!default {
  type plug
  slave.pcm nvidia
}
EOF

sudo chown guest:guest /home/guest/.asoundrc

Install GLX Gears

apt-get install mesa-utils

Run glgears

glxgears

Ctrl + Alt + Bksp

sudo nano /etc/X11/Xsession.d/40x11-common_xsessionrc

add the following line to the end

setxkbmap -option terminate:ctrl_alt_bksp

Troubleshooting

If X keeps crashing use the next steps to downgrade xorg to stable and pin the packages

Disable the second screen

change StaticServers=:0,:1 back to StaticServers=:0

nano /etc/kde4/kdm/kdmrc
StaticServers=:0

To check the current version of xorg packages

dpkg -l | grep xorg
ii  xserver-xorg                            1:7.5+3                    the X.Org X server
ii  xserver-xorg-core                       2:1.7.4-2                  Xorg X server - core server

Stop X and downgrade packages

/etc/init.d/kdm stop
apt-get remove xserver-xorg xserver-xorg-core
apt-get -t squeeze install xserver-xorg/squeeze xserver-xorg-core/squeeze x11-common/squeeze

Check version of xorg packages again

dpkg -l | grep xorg
ii  xserver-xorg                            1:7.3+20                   the X.Org X server
ii  xserver-xorg-core                       2:1.4.2-10.lenny2          Xorg X server - core server

Pin packages

To pin packages as stable create /etc/apt/preferences

cat > /etc/apt/preferences << EOF
Package: xserver-xorg
Pin: release a=stable
Pin-Priority: 1001

Package: xserver-xorg-core
Pin: release a=stable
Pin-Priority: 1001

Package: x11-common
Pin: release a=stable
Pin-Priority: 1001

EOF

In future you can run apt-get dist-upgrade safely

Re install NVIDIA drivers

/NVIDIA-Linux-x86_64-190.42-pkg2.run
/etc/init.d/kdm start

Enable 2nd screen

nano /etc/kde4/kdm/kdmrc
StaticServers=:0,:1

More Information

Creative Commons License

This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 Australia License.

Last edited by Brenton Taylor on Monday, September 19th, 2011 (r2085).