I have done much research and attempted fixes on this issue, mostly involving tweaking the xstartup file. I've tried alternative VNC clients (UltraVNC and TightVNC) from a Windows 7 computer, with the same results for each client.
Basically, I get either a blank grey screen with only an arrow cursor, or a failure to connect at all.
I also tried a different VNC server (VNC4server) but abandoned that because, although I could connect, I got an error every time on the client window. And Tightvnc seems more widely used and user-supported.
I find that, almost regardless of what I put in the ~/.vnc/xstartup file (for example, even if it has just one line (startkde &) it will work if I specify "root" as the VNC user. But then I'm logged in as root and I need instead to follow standard *nix practice of being logged in as a non-root user. So, the issue does appear to relate to privileges. However, I check for correct ownership and executable flags on files after every time I edit them.
I read somewhere that the latest Tightvnc server will not allow KDE desktop to be started if there is already a desktop session running on the host (user logged in), so I start the host machine without anyone logged in. I have configured Tightvnc server as a service.
My current xstartup file follows, but like I said, I have already attempted many variants of these lines, commenting out nearly everything, from suggestions gathered on the internet.
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc &
# unset DBUS_SESSION_BUS_ADDRESS[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &
exec startkde &
Here is the service file, /lib/systemd/system/tightvncserver.service :
[Unit]
Description=TightVNC remote desktop server
After=sshd.service[Service]
Type=dbus
ExecStart=/usr/bin/vncserver -geometry 1024x768 -depth 24 :1
User=vnc
Type=forking[Install]
WantedBy=multi-user.target
Here is the log after one reboot of the host followed by one connection attempt:
14/03/16 01:37:46 Xvnc version TightVNC-1.3.9
14/03/16 01:37:46 Copyright (C) 2000-2007 TightVNC Group
14/03/16 01:37:46 Copyright (C) 1999 AT&T Laboratories Cambridge
14/03/16 01:37:46 All Rights Reserved.
14/03/16 01:37:46 See http://www.tightvnc.com/ for information on TightVNC
14/03/16 01:37:46 Desktop name 'X' (test:1)
14/03/16 01:37:46 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
14/03/16 01:37:46 Listening for VNC connections on TCP port 5901
/home/vnc/.vnc/xstartup: 12: /home/vnc/.vnc/xstartup: vncconfig: not found
x-terminal-emulator: Unknown option 'ls'.
x-terminal-emulator: Use --help to get a list of available command line options.
Error: cannot create directory "/tmp/ksocket-vncw1nXNU": File exists
startkde: Starting up...
kdeinit4: Aborting. bind() failed: Address already in use
Could not bind to socket '/tmp/ksocket-vncGcyXe4/kdeinit4__1'14/03/16 01:38:09 Got connection from client 192.168.10.10
14/03/16 01:38:09 Using protocol version 3.8
14/03/16 01:38:14 Full-control authentication passed by 192.168.10.10
14/03/16 01:38:14 Pixel format for client 192.168.10.10:
14/03/16 01:38:14 32 bpp, depth 24, little endian
14/03/16 01:38:14 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
14/03/16 01:38:14 no translation needed
14/03/16 01:38:14 Using hextile encoding for client 192.168.10.10
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 19
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 18
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 17
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 16
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 10
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 9
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding 8
14/03/16 01:38:14 Using compression level 6 for client 192.168.10.10
14/03/16 01:38:14 Enabling full-color cursor updates for client 192.168.10.10
14/03/16 01:38:14 Enabling cursor position updates for client 192.168.10.10
14/03/16 01:38:14 Using image quality level 6 for client 192.168.10.10
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -65530
14/03/16 01:38:14 Enabling LastRect protocol extension for client 192.168.10.10
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -223
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -32768
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -32767
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -32764
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -32766
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -32765
14/03/16 01:38:14 rfbProcessClientNormalMessage: ignoring unknown encoding -1063131698
14/03/16 01:38:43 Client 192.168.10.10 gone
14/03/16 01:38:43 Statistics:
14/03/16 01:38:43 key events received 0, pointer events 260
14/03/16 01:38:43 framebuffer updates 2, rectangles 5, bytes 776789
14/03/16 01:38:43 cursor shape updates 2, bytes 4920
14/03/16 01:38:43 cursor position updates 1, bytes 12
14/03/16 01:38:43 hextile rectangles 2, bytes 771857
14/03/16 01:38:43 raw bytes equivalent 6291480, compression ratio 8.151095
Any ideas?
[EDIT, 2014/03/14, 1409 UTC]: I forgot to mention that I had it working error-free with XFCE desktop. But I much prefer KDE, and I wish to get that working if at all possible.
[EDIT, 2014/03/14, 2216 UTC]: This is a follow-up to Paul H.'s suggestion, I'm putting it here because the mini-formatting of comments doesn't seem to allow blockquotes and images.
Thank you, that got me further. After I give the "startkde &" command, the client window opens with a sensible-looking desktop that is starting to load and gets this far before closing (note the error message in top left):
The log is as follows:
14/03/16 21:32:11 Desktop name 'X' (test:1)
14/03/16 21:32:11 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
14/03/16 21:32:11 Listening for VNC connections on TCP port 5901
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.14/03/16 21:32:37 Got connection from client 192.168.10.10
14/03/16 21:32:37 Using protocol version 3.8
14/03/16 21:32:47 Full-control authentication passed by 192.168.10.10
14/03/16 21:32:47 Pixel format for client 192.168.10.10:
14/03/16 21:32:47 32 bpp, depth 24, little endian
14/03/16 21:32:47 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0
14/03/16 21:32:47 no translation needed
14/03/16 21:32:47 Using hextile encoding for client 192.168.10.10
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 19
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 18
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 17
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 16
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 10
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 9
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding 8
14/03/16 21:32:47 Using compression level 6 for client 192.168.10.10
14/03/16 21:32:47 Enabling full-color cursor updates for client 192.168.10.10
14/03/16 21:32:47 Enabling cursor position updates for client 192.168.10.10
14/03/16 21:32:47 Using image quality level 6 for client 192.168.10.10
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -65530
14/03/16 21:32:47 Enabling LastRect protocol extension for client 192.168.10.10
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -223
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -32768
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -32767
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -32764
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -32766
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -32765
14/03/16 21:32:47 rfbProcessClientNormalMessage: ignoring unknown encoding -1063131698
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
kbuildsycoca4 running...
kbuildsycoca4(989) KBuildSycoca::checkTimestamps: checking file timestamps
kbuildsycoca4(989) KBuildSycoca::checkTimestamps: timestamps check ok
kbuildsycoca4(989) kdemain: Emitting notifyDatabaseChanged ()
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QString)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QString)
QDBusConnection: name 'org.freedesktop.UDisks2' had owner '' but we thought it was ':1.11'
klauncher: Exiting on signal 15
knotify4: Fatal IO error: client killed
kded4: Fatal IO error: client killed
konsole: Fatal IO error: client killed
konsole(902) Konsole::SessionManager::~SessionManager: Konsole SessionManager destroyed with sessions still alive
The first error message, ending with "application may misbehave," is supposed to be unimportant, from the bug reports I have seen. The rest, I'm not sure about..