VNC server on Ubuntu with login screen after boot

Source:

The problem:

have a VNC server installed on Ubuntu and have it starting at boot with access to the login screen (Note: Vino, the default VNC server available on Ubuntu does not seem to allow access to the login screen after boot).

The solution:

1)

sudo apt-get install x11vnc
sudo x11vnc -storepasswd /etc/x11vnc.pass

2a)

for Ubuntu 15.04+ (systemd)

sudo nano /lib/systemd/system/x11vnc.service

and enter the following code

[Unit]
Description="x11vnc"
Requires=display-manager.service
After=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth guess -rfbauth /etc/x11vnc.pass
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
Restart-sec=2

[Install]
WantedBy=multi-user.target

then

sudo systemctl daemon-reload
sudo systemctl start x11vnc
sudo systemctl enable x11vnc

2b)

for Ubuntu 12.04-14.10 (upstart with lightdm)

sudo nano /etc/init/x11vnc.conf

and enter the following code

start on login-session-start
script
/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
end script

then reboot.

if another display manager like GDM is used then the path here below must be changed accordingly. For example on Linux Mint 14.04 the file to edit is:

sudo nano /etc/mdm/Init/Default

and the line to add:

DISPLAY=:0 /usr/bin/syndaemon -d -i 1.0 -t -K -R
/usr/bin/x11vnc -xkb -auth /var/lib/mdm/:0.Xauth -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
exit 0

Tunnel via SSH

The VNC port (5900) is not usually open for access from outside the local network, but if the machine has SSH access this can be used to tunnel the VNC connection. The easiest way is to use a VNC client that supports SSH tunneling (no further configurations needed on server or client). Remmina on Linux and TightVNC on Windows are good choices.

VNC server on Ubuntu with login screen after boot

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