VNC server black screen

Issues related to applications and software problems
Post Reply
Blisk
Posts: 316
Joined: 2011/07/04 14:49:51
Contact:

VNC server black screen

Post by Blisk » 2019/02/11 16:51:34

OK last 5 hours I have searching internet and tried everything what I found regarding black screen, nothing works.
I still have black screen and VNC doesn't work.
Someone have any idea what can be wrong?

xstartup
#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
x-window-manager &
vncserver@:1.service
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace <USER> with the actual user name and edit vncserver
# parameters appropriately
# (ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
# PIDFile=/home/<USER>/.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.


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

[Service]
#Type=forking
Type=simple

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

[Install]
WantedBy=multi-user.target


User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: VNC server black screen

Post by TrevorH » 2019/02/11 19:12:05

For a start, don't vnc as root. I'd also suggest that you re-copy the sample unit file as you appear to have edited the current one. The only things you need to change are the parts where it says <USER> to your username. Your /home/$USER/.vnc.xstartup file should also look more like

Code: Select all

#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
vncserver -kill $DISPLAY
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Blisk
Posts: 316
Joined: 2011/07/04 14:49:51
Contact:

Re: VNC server black screen

Post by Blisk » 2019/02/11 20:12:31

I tried with regular user everything and it doesn't work than because of bug I tried with root, and it is the same.
This also doens't work

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: VNC server black screen

Post by lightman47 » 2019/02/12 00:29:34

unproven hint from my experience:

When you vnc (as a user) - it will be THAT user's account to which you connect on the remote. Therefore, that destination user account will already have to previously allowed sharing (Settings/Sharing - screen sharing & remore login).

Hopefully this is helpfull.

Blisk
Posts: 316
Joined: 2011/07/04 14:49:51
Contact:

Re: VNC server black screen

Post by Blisk » 2019/02/12 07:39:30

lightman47 wrote:
2019/02/12 00:29:34
unproven hint from my experience:

When you vnc (as a user) - it will be THAT user's account to which you connect on the remote. Therefore, that destination user account will already have to previously allowed sharing (Settings/Sharing - screen sharing & remore login).

Hopefully this is helpfull.
Sorry don't know what you mean

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: VNC server black screen

Post by lightman47 » 2019/02/12 12:59:48

What I had to do in Gnome:

From machine A you are trying (as user "Blisk") to VNC to machine B.
On machine B, as "Blisk", go into Settings as mentioned and enable the sharing.

Blisk
Posts: 316
Joined: 2011/07/04 14:49:51
Contact:

Re: VNC server black screen

Post by Blisk » 2019/02/12 13:23:31

lightman47 wrote:
2019/02/12 12:59:48
What I had to do in Gnome:

From machine A you are trying (as user "Blisk") to VNC to machine B.
On machine B, as "Blisk", go into Settings as mentioned and enable the sharing.
Still don't know what I should enable. What sharing? of folder?

Post Reply