Update @ Jan 2021:
New version of Ubuntu 20.04 and 20.10 has been out for a while. I have been seeing many post about setting up VNC server on Ubuntu, most talking about specifically with TightVNC server and Xfce, without detail explanation of the choice. Xfce is one of Desktop environment for Ubuntu, among other popular environment such as Gnome (default for Ubuntu 20.x), KDE, etc. Basically, Xfce is light weight, so more suitable for VNC remote connection. And for the server, TightVncServer is not the only choice.
This post shows how to setup VNC with TightVNC server + Xfce desktop environment:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-18-04
And this combination might be easier to be setup for headless (no monitor connected Linux station), with xserver-xorg-video-dummy package installed. For Xfce, if the Terminal launcher doesn't work, check Settings Manager > Preferred Applications setting, and switch to a different Terminal app.
New version of Ubuntu 20.04 and 20.10 has been out for a while. I have been seeing many post about setting up VNC server on Ubuntu, most talking about specifically with TightVNC server and Xfce, without detail explanation of the choice. Xfce is one of Desktop environment for Ubuntu, among other popular environment such as Gnome (default for Ubuntu 20.x), KDE, etc. Basically, Xfce is light weight, so more suitable for VNC remote connection. And for the server, TightVncServer is not the only choice.
-----------------------------------
I have used several different VNC solution (most are free, and even Open Source), here is my feeling:
- vino, available on Ubuntu by default, but performance is not good
- Vnc4Server is very stable, but might be out-of-date, depends on the desktop environment, such as Gnome or Kde, may need some tweak with x server and authentication configuration;
- TightVnc, UltraVnc, noMachine RealVnc and several other open-source VNC all have some cons and pros, and neither of them is integrated to Ubuntu as good as x11vnc. Some found TightVnc is easy to setup and use, some found noMachine is very powerful. But like TightVnc, it won't allow local user and remote user have the view at same time, so it cannot be used for remote assistant.
- x11vnc is the only one which can be up with the user login screen, so you can type in account credential in the Ubuntu login GUI. One shortage is x11vnc relies on the hardware display. But for headless (no monitor/display adapter), user can set up Xvfb, Xvnc or dummy display. So x11vnc is my favorite one.
As of Ubuntu 18.04, it switched from LightDM to GDM3.
Connecting to the login screen with VNC while using GDM3 is currently not possible.
The easiest way to get this VNC functionality back is to simply switch back from GDM3 to LightDM as mentioned here: https://askubuntu.com/questions/1033274/ubuntu-18-04-connect-to-login-screen-over-vnc/
Install LightDM is very simple as: apt install lightdm
This post shows how to setup VNC with TightVNC server + Xfce desktop environment:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-18-04
And this combination might be easier to be setup for headless (no monitor connected Linux station), with xserver-xorg-video-dummy package installed. For Xfce, if the Terminal launcher doesn't work, check Settings Manager > Preferred Applications setting, and switch to a different Terminal app.
There might be issue to run Microsoft's Visual Studio Code with xrdf. Refer to vscode ticket 3451. The workaround provide by 'groone' in 2016 still works as of Jun 2020:
- make a backup first
- sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1
libxcb.so.1 is a symbolic link (such as libxcb.so.1.1.0). So just remove the symbolic link, and copy the '.so' file like this: 'cp libxcb.so.1.1.0 libxcb.so.1', then run 'sed' to replace the string. This way it won't break other application which may rely on libxcb (such as VLC player).
Below is some other note which might be old.
vnc
server =>refer help.ubuntu.com/community/VNC/Servers.
x11vnc
works
pretty well. Start x11vnc server(apt-get
install x11vnc):
x11vnc
-storepasswd =>
provide
password
x11vnc
-auth guess
-forever -loop -noxdamage -repeat -rfbauth /home/lab/.vnc/passwd
-rfbport 5900 -shared
Have
x11vnc start automatically via systemd in any environment (Vivid+,
i.e. Ubuntu15
and up):
sudo
nano /lib/systemd/system/x11vnc.service =>
add following:
[Unit]
Description=Start
x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc
-auth guess -forever -loop -noxdamage -repeat -rfbauth
/home/lab/.vnc/passwd
-rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
Then
do: sudo
systemctl daemon-reload && sudo systemctl enable
x11vnc.service
For
Ubuntu14,
sudo
nano /etc/init/x11vnc.conf
#
description "Start x11vnc at boot"
description
"x11vnc"
start
on runlevel [2345]
stop
on runlevel [^2345]
console
log
respawn
respawn
limit 20 5
exec
/usr/bin/x11vnc -auth guess
-forever
-loop -noxdamage -repeat -rfbauth /home/lab/.vnc/passwd
-rfbport 5900 -shared
No
desktop but a terminal only with ubuntu14/vnc4server=>
log shows x-window-manager: not found
This
link
works for me:
#
apt-get install gnome-panel gnome-settings-daemon metacity nautilus
gnome-terminal
and
use this xstartup file
#!/bin/sh
export
XKL_XMODMAP_DISABLE=1
unset
SESSION_MANAGER
unset
DBUS_SESSION_BUS_ADDRESS
[
-x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[
-r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot
-solid grey
vncconfig
-iconic &
gnome-panel
&
gnome-settings-daemon
&
metacity
&
nautilus
&
gnome-terminal
&
Use
gnome classic: refer to this au,
or install
gnome-session-fallback
Many
search points to ubuntu14.04 gnome-fallback broken, use startxfce4,
which is not gnome.
For
log show xinitrc denied, change
exec
/etc/X11/xinit/xinitrc to
.
exec
/etc/X11/xinit/xinitrc or
exec sh
/etc/…
Some
of our PC has vino
installed,
which is slow sometimes
Refer
this
for vnc through SSH. Basically run this from local PC: ssh
-L 5900:localhost:5900 lab@pv-host39,
then VncViewer open localhost:5900.
For
some PC may get “channel 3: open failed: connect failed: Connection
refused”. Solution here
doesn’t work for me. For me, x11 failed to start.
Display, remote and dummy
If
seeing monitor shows signal out of range, refer this AU.
If mode not available, try
cvt
1920 1080 60. The
output looks like below. Copy the modeline after Modeline
to
use it in the next command:
#
1360x768 59.80 Hz (CVT) hsync: 47.72 kHz; pclk: 84.75 MHz
Modeline
"1360x768_60.00" 84.75 1360 1432 1568 1776 768 771 781
798 -hsync +vsync
Create
a new mode with the copied modeline and xrandr.:
xrandr
--newmode "1360x768_60.00" 84.75 1360 1432 1568 1776
768 771 781 798 -hsync +vsync
With
the following command, you get the connected port: xrandr
--query | grep connected
The
output looks like this. As you can see, in my case the connected port
is DVI-0.:
HDMI-0
disconnected (normal left inverted right x axis y axis)
DVI-0
connected 1920x1080+0+0 (normal left inverted right x axis y axis)
521mm x 293mm
VGA-0
disconnected (normal left inverted right x axis y axis)
Add
the new mode using your connected port.: xrandr
--addmode DVI-0 "1360x768_60.00"
Change
the monitor resolution.: xrandr
--output DVI-0 --mode "1360x768_60.00"
So
for our case, as monitor does not support 1920x1200,
mostly need to run: xrandr
--output HDMI1 --mode "1920x1080"
Fore
remote
display, refer to au.
Not like VNC,
it only opens a display remotely, but not allow any remote input.
For
PC without monitor(headless),
refer to this
to add a dummy display: sudo
apt-get install xserver-xorg-video-dummy,
then update/create /usr/share/X11/xorg.conf.d/xorg.conf:
Section
"Device"
Identifier
"Configured Video Device"
Driver
"dummy"
EndSection
Section
"Monitor"
Identifier
"Configured Monitor"
HorizSync
31.5-48.5
VertRefresh
50-70
EndSection
Section
"Screen"
Identifier
"Default Screen"
Monitor
"Configured Monitor"
Device
"Configured Video Device"
DefaultDepth
24
SubSection
"Display"
Depth
24
Modes
"1024x800"
EndSubSection
EndSection
With
above, won’t see display after connect the PC with a monitor.
Seeing error: /usr/bin/xinit:
XFree86_VT property unexpectedly has 0 items instead of 1.
Boot to recovery mode and try dpkg or failsafeX won’t resolve the
problem as Xorg still take the modified xorg.conf. Delete xorg.conf.
0 Comments:
Post a Comment