VNC viewer shows black screen for one user and normal for the other – A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about VNC viewer shows black screen for one user and normal for the other was one problem in server stack that need for a solution. Below are some tips in manage your linux server when you find problem about linux, centos, centos7, vnc, .
I installed TigerVNC on a CentOS 7 and configured its service for two users (user1 and user2). It worked perfectly until recently. When I try to connect with VNC Viewer with user1 it shows just a black screen, meanwhile with user2 everything is fine. Both ports for each of them are opened.
P.S. I have mainly used user1, I was working one some apache configurations and when I restarted the server it happened.
Thank you in advance.
cat /etc/sysconfig/vncservers
showed this output:
THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service
Meanwhile cat /lib/systemd/system/vncserver@.service
showed this:
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
I’m posting my own answer here in hope that it will help someone in the future.
So, I just closed the port from before, removed the previous vncserver@:<port number>.service
, created a new vncserver service in another port but still coulnd’t reload or restart the service.
After checking with sudo tail /var/log/messages
I ended up deleting this folder /tmp/.X11-unix/X4
, then restarted the service.
It finally works.
I suspect that your vncservers service isn’t configured properly.
Edit /etc/sysconfig/vncservers
and make sure that your file looks like so:
VNCSERVERS="6:root 7:itai"
VNCSERVERARGS[6]="-geometry 1024x768"
VNCSERVERARGS[7]="-geometry 1152x864"
The first line configures which port each user will connect to… 6 translates to port 5906 and 7 translates to 5907.
The other lines configure the screen resolution for each user.
If you make any changes in the configure, don’t forget to restart the service:
service vncservers restart
I hope that helps.