Problems with VNC connection black screen

Source: Internet
Author: User

This article describes how to solve the problem of vnc black screen.


I installed the operating system of red flag. Black screen after connecting Vnccserver



• Check that the system has VNC installed



#rpm-Q VNC



• Solutions:



1. Modify the configuration file/root/.vnc/xstartup

Note: Some system configuration has –nolisten TCP and –NOHTTPD, these two are blocked Xwindows Landing and HTTP mode VNC landing, if you need a graphical interface, then delete this part




If you are using the GNOME image interface, you need to comment out the following two lines,
#xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &
#twm &
and add the following line:
Gnome-session &






For example, my configuration file is as follows
#!/bin/sh
# Uncomment the following-lines for normal desktop:
Unset Session_manager
Exec/etc/x11/xinit/xinitrc
[-x/etc/vnc/xstartup]&& Exec/etc/vnc/xstartup
[-R $HOME/. Xresources] && Xrdb $HOME/. Xresources
Xsetroot-solid Grey
Vncconfig-iconic &
#xterm-geometry 80x24+10+10-ls-title "$VNCDESKTOP Desktop" &


#gnome-session & #set Starting GNOME desktop
startkde& #kde Desktop

#twm & #Textinterface


Note: This part is the part that is modified or added



2. Modify User profile:/etc/sysconfig/vncservers


Open config file: vi/etc/sysconfig/vncservers, remove the "#" from the following two lines, which means to remove the comments from the two lines.
Vncservers= "1:root"
vncserverargs[1]= "-geometry 800x600"



1 means that VNC runs on desktop 1, so you can start the root desktop. You can add other users, such as vncservers= "



1:root,2:user1,3:user2 ", of course these users are implementing the system exists.



For example: My/etc/sysconfig/vncservers configuration file is as follows:



Vncservers= "1:root"
#VNCSERVERARGS [1]= "-geometry 800x600"


vncserverargs[1]= "-geometry 800x600-alwaysshared-depth 24″-alwaysshared representative allows multiple users to log in at the same time-depth on behalf of the color depth, parameters have 8,16,24,32. 

Note: This part is the part that is modified or added

In addition: if there is an image interface, the system settings > Server Settings > Services in the Vncserver tick, you can start with the system.






3, change the authority of Xstartup

This is a problem that many people tend to overlook, and is one of the reasons why a black screen is created after a successful connection.



In CentOS, the file path for Xstartup is:/root/.vnc/(can be locatexstartup to view Xstartup file path)



So need to execute: chmod 777 Root/.vnc/xstartup


4. Turn off firewall restrictions on VNC ports


If you need to control a Linux network from the extranet, you need to open the appropriate port for the firewall and port mapping on the router.
The VNC port to the browser is 5800+n, and the port to Vncviewer is 5900+n,n is the display number that is set.



If you do not want to open the firewall, but still need the VNC service, you will need:



Edit Vi/etc/sysconfig/iptables
Add the following two lines to the inside:
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport5901-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport5902-j ACCEPT



What is needed here is that the corresponding port of display N is 5900+n, so it is not recommended to set too much.


5. Start the VNC Server:


Open Terminal execution: Vncserver
The first time you run Vncserver, you will be asked to enter the password two times, you will see the following message:
New ' Localhost.localdomain:1 (root) ' Desktop Islocalhost.localdomain:1
Starting applications specified In/root/.vnc/xstartup
Log file Is/root/.vnc/localhost.localdomain:1.log
The ": 1" in the top message indicates the first VNC desktop to start.



--


1. VNC Start/stop/restart #service vncserver Start/stop/restart close the specific vncserver command:vncserver-kill:1 Vncserver-kill:22. Set Password #vncpasswd


6. Stop vncserver: (Selected readings)


The way to stop Vncserver is to execute: vncserver-kill:1
Note: ": 1", means stop the first VNC desktop, 1 represents the currently enabled Vncserver sequence number, ": 1" before there is a space. If the sequence number that is currently started is 2, you should use "Vncserver-kill:2" if you want to turn it off.


7. Modify the VNC password: (Selected readings)

The way to modify the VNC password is to execute: vncpasswd



Enter the password two times.



8: Check whether the server-side VNC server is functioning correctly :

Execution: Ps-ef|grep VNC



If VNC is executing, you can see a similar message:



[[email protected] ~]# Ps-ef|grep VNC
Root 3605 1 0 Jul13? 00:13:51 xvnc:1-desktopmyims.local: 1 (Root)-httpd/usr/share/vnc/classes-auth/root/. Xauthority-geometry 800x600-depth 16-rfbwait 30000-rfbauth/root/.vnc/passwd-rfbport 5901-PN



The description is the serial number ": 1" the VNC process listens on port 5901.



9.VNC Client

Once the server is functioning properly, we can consider using a VNC client to connect to it.

Configuration of the Windows client VNC Viewer:
1. Download VNC free Edition for Windows Version 4.1.2 from http://www.realvnc.com/download.html
2. Open Vncviewer:
Fill in Vncserver IP: Number (1 or 2 or ...)
3. Vncviewer Toggle Full Screen mode: F8


10. Configuration Files :


/etc/x11/xorg.conf Setting the screen resolution



Here, your VNC should already be able to connect, but there may be a problem with the black screen:



1, check the log log under/root/.vnc/, there is no error, there may be insufficient xstartup permissions. "Chmod xstartup777" under Change



permissions, reboot and then forward.



2, restart the computer, try. I am the various configurations, always black screen, restart the computer after OK.






Workaround reference: http://blog.csdn.net/lifuxin1125/article/details/7744027



Problems with VNC connection black screen


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.