get black screen after connect vnc server

I encountered following issue:

https://forums.opensuse.org/showthread.php/472989-VNC-problems-Suse11-4-kde4

 [dbus-launch vncserver] works

 

So changed to following:

/etc/systemd/system/vncserver@.service (don't use /usr/bin/runuser , because it already changed to the user when service start)

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
WorkingDirectory=/home/vnc
User=vnc
Group=vnc

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i
PIDFile=/home/vnc/.vnc/%H%i.pid
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

 

my xstartup: (don't forget chmod +x)

#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#vncconfig -iconic &
#dbus-launch --exit-with-session gnome-session &

dbus-launch --exit-with-session startkde &

 

reference:

https://www.golinuxcloud.com/step-by-step-guide-to-configure-tigervnc/

posted @ 2020-01-17 15:53  johnsonshu  阅读(234)  评论(0编辑  收藏  举报