Ubuntu 14.04/15.10 MultiSeat configuration

The problem:

One Ubuntu Desktop PC with two graphic cards,  two LCDs, two mouses and keyboards and configure it in a way that it can be used by two different users at the same time, each one using its own set own lcd/mouse/keyboard/usb ports, etc.

The the graphic cards available in the PC are the Intel based available on the motherboard and an NVIDIA as a PCIe card expansion.

Notes:

Documentation is not entirety missing (just Google for it and see) but it often old or very technical and in general the impression is that is a very complicated setup, but at least for simple configurations it is not.

The pages that were fundamental to understand how to solve the problem are:

http://en.softmaker.kz/software-for-everyone/multiseat-setup-on-ubuntu-1404.html

https://wiki.ubuntu.com/MultiseatTeam/Instructions

The solution:

  • Detecting video cards and other devices (especially mouses, keyboard and USB devices)
  • Setting up rules for Multiseat mode

Step1 (not sure is necessary at all, at least it won’t hurt):

sudo apt-add-repository ppa:ubuntu-multiseat/ppa
sudo apt-get update
sudo apt-get upgrade

Step2:

Detect videocards and USB devices

lspci | grep VGA
lsusb

and find unique identification number of each device and port. The list is long so it will be exported to a text file

udevadm info --export-db > /home/user/udevadm.txt

Each user will have its own SEAT. A default seat always exist and is called seat0, each additional seat must be called seat-1, seat-2, seat-3, etc.

Devices must be configured to belong to seats other than seat0, all the other devices will be automatically granted to seat0.

Step3:

Examine the file and look for the “DEVPATH” of the devices you want to grant to seats other than seat0. Example:

P: /devices/pci0000:00/0000:00:01.0/0000:01:00.0
E: DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0
E: DRIVER=nouveau
E: ID_MODEL_FROM_DATABASE=GT218 [GeForce 210]
E: ID_PCI_CLASS_FROM_DATABASE=Display controller
E: ID_PCI_INTERFACE_FROM_DATABASE=VGA controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=VGA compatible controller
E: ID_VENDOR_FROM_DATABASE=NVIDIA Corporation
E: MODALIAS=pci:v000010DEd00000A65sv00001043sd0000852Dbc03sc00i00
E: PCI_CLASS=30000
E: PCI_ID=10DE:0A65
E: PCI_SLOT_NAME=0000:01:00.0
E: PCI_SUBSYS_ID=1043:852D
E: SUBSYSTEM=pci
E: USEC_INITIALIZED=8621

Step4:

Create a udev rule file that defines the devices granted to seats other than seat0

sudo nano /etc/udev/rules.d/99-multiseat.rules

An example of such file is:

# ************************ SEAT-1 ************************

# USB port function mouse for seat-1
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb1/1-4*", ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# USB port function keyboard for seat-1
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb1/1-3*", ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# USB 2.0 hub for seat-1
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb2*", ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# Videocard function GeForce for seat-1
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:01.0/0000:01:00.0*", ENV{ID_SEAT}="seat-1", TAG+="seat-1"

NOTE: NO NEW LINES IN RULES

Step5:

Create a new configuration file for LightDM

sudo nano /etc/lightdm/lightdm.conf

that must contain

[LightDM]
logind-load-seats=true

Step6:

restart

Step7:

check the list of seats and the list of devices granted to each seat

loginctl list-seats
loginctl seat-status seat0
loginctl seat-status seat-1

Issues:

The above setup works fine, but on Ubuntu 14.04 is not free of issues:

On seat-1, the seat that uses the NVIDIA graphic card, the user can have the system completely froze when using LibreOffice when doing some particular text selection operations. This apparently is not an issue that is related to multiseat configurations, as the bug reports found on-line suggest, see for example

http://askubuntu.com/questions/671487/ubunty-14-04-freezes-when-i-select-a-big-chunk-of-text-in-libreoffice

The solution seems to be to install the proprietary NVIDIA drivers to replace the Open Source ones (Nouveau) but this leads to a bigger issue after rebooting: no graphic output on seat-1.

As suggested in

https://wiki.ubuntu.com/MultiseatTeam/Instructions

I added the “master-of-seat” configuration, at no avail.

The problem seems to be in the packages that allow the user to switch from Intel to NVIDIA output, but after a lot of effort I wasn’t able to figure how to solve the issue.

As a last resort I installed Ubuntu 15.10 instead of 14.04, applied the above configuration and in this case using Nouveau drivers there are no issues with LibreOffice on seat-1.

Ubuntu 14.04/15.10 MultiSeat configuration

Schedule Netgear ReadyNAS Ultra 2 backups with RSYNC over SSH

The problem:

The ReadyNAS Ultra 2 allows create scheduled backup jobs on remote RSYNC servers, using its web based control panel, but not over SSH, that could be very well the only option.

The solution:

Enable root SSH access to the ReadyNAS Ultra 2 unit and (using the command line) setup a CRON job.

Step1:

Enable root SSH on the ReadyNAS unit by installing the following extension: http://www.readynas.com/?p=4203

[Note: the “root” user password is the same as the one of the “admin” user]

Connect via SSH to the NAS

$ ssh root@IP_OF_NAS

Step2:

Generate public and private SSH keys (use no passphrase)

$ ssh-keygen

Step3:

Copy the public key on the remote server

$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote_server_user@IP_OF_REMOTE_SERVER

Step4:

Edit crontab and add a scheduled RSYNC task

$ crontab -e

after issuing the above command it may very well show an error like

$ netgear-nas:~# crontab -e
 no crontab for root - using an empty one
 /bin/sh: /usr/bin/editor: No such file or directory
 crontab: "/usr/bin/editor" exited with status 127

this is because the default command line text editor is not correctly configured. Switching to “vi” is needed

$ EDITOR=/bin/vi; export EDITOR

now trying again

$ crontab -e

should work and crontab can be edited with vi

[Note: “vi” is hard for the less skilled user, but basic commands are easy enough to do simple edits to text files]

Step5:

Add a RSYNC task to crontab, save and exit

30 17 * * * rsync /nas/folder remote_server_user@IP_OF_REMOTE_SERVER:/path/where/place/backup/

Final note:

Better test the above RSYNC task directly from the command line and check if it will still ask for the password, it should not. If it still asks for the password the likely issue is because of wrong permissions of the

~/.ssh/authorized_keys

file on the remote host, ~/.ssh should be 700, and ~/.ssh/authorized_keys should be 600. If it still ask for the password check the permissions on ~ (should be 700 too).

See:

http://unix.stackexchange.com/questions/36540/why-am-i-still-getting-a-password-prompt-with-ssh-with-public-key-authentication

and/or

http://www.daveperrett.com/articles/2010/09/14/ssh-authentication-refused/

Schedule Netgear ReadyNAS Ultra 2 backups with RSYNC over SSH

Install WordPress under Ubuntu and enable automatic updates

Install MySQL and PHP5 MySQL extension:

sudo apt-get install mysql-server php5-mysql

Initialize the cluster and run a script to make MySQL more secure:

sudo mysql_install_db
sudo mysql_secure_installation

Enter MySQL console as root, create the DB, create the user and grant it the necessary permissions:

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost;
FLUSH PRIVILEGES;
exit

Install WordPress as usual, after that add the following two lines to wp-config.php:

define('FS_METHOD','direct');
define( 'WP_AUTO_UPDATE_CORE', true );

and set the permissions of the WordPress folder/files as following:

sudo find /path/to/wordpress/ -type f -exec chmod 664 {} \;
sudo find /path/to/wordpress/ -type d -exec chmod 775 {} \;
sudo chgrp -R www-data /path/to/wordpress/

To backup automatically the MySQL database, first create a .my.cnf and then chmod it to 600. The file must include:

[client]
user=mysqluser
password=mysqlpassword

Then add a CRON job as

mysqldump --defaults-file=/path/to/.my.cnf -u mysqluser databasename --add-drop-table -h host | bzip2 -c > /path/to/backupfile-`date +\%Y\%m\%d`.sql.bz2
Install WordPress under Ubuntu and enable automatic updates