VNC Server in Virtual Mode appears to hang or you see a grey screen because a desktop environment

本文介绍了解决RealVNC在虚拟模式下出现灰屏的问题,通过修改xstartup脚本来启动特定的桌面环境,如XFCE、LXDE等,并提供了针对不同桌面环境的具体脚本示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

realvnc virtual mode灰屏解决方法

转自:https://support.realvnc.com/Knowledgebase/Article/View/345/0/vnc-server-in-virtual-mode-appears-to-hang-or-you-see-a-grey-screen-because-a-desktop-environment-cannot-be-loaded

If the desktop environment you've installed is not the default (for example, you've installed LXDE on a regular Ubuntu system), you will need to modify the xstartup script used by VNC Server to start your chosen desktop environment. Each desktop session should have a corresponding .desktop file in /usr/share/xsessions, which contains the command used to start the environment. You can use the following command to list the startup commands for all the available sessions installed on the system:

grep Exec= /usr/share/xsessions/*.desktop

Next, use a text editor to replace the existing xstartup script with the following template:

#!/bin/sh
DESKTOP_SESSION=name-of-desktop-file
export DESKTOP_SESSION
exec-command-from-desktop-file
vncserver-virtual -kill $DISPLAY

This should be saved to ~/.vnc/xstartup, or /etc/vnc/xstartup.custom for all users on the system, and made executable using chmod +x.

Example for Xfce:

#!/bin/sh
DESKTOP_SESSION=xfce
export DESKTOP_SESSION
startxfce4
vncserver-virtual -kill $DISPLAY

Example for LXDE:

#!/bin/sh
DESKTOP_SESSION=LXDE
export DESKTOP_SESSION
startlxde
vncserver-virtual -kill $DISPLAY

Example for KDE Plasma Standard:

#!/bin/sh
DESKTOP_SESSION=1-kde-plasma-standard
export DESKTOP_SESSION
startkde
vncserver-virtual -kill $DISPLAY

There is also a known issue with the RENDER extension in current versions of Xvnc that causes problems with Xfce, resulting in the desktop failing to start. This can be resolved by disabling the RENDER extension; to do this, create /etc/vnc/config.custom (if it does not already exist) and add the command:

-extension RENDER

xstartup scripts and VNC Server 6.2.0+

Please be aware that VNC Server terminates when the xstartup script terminates. Therefore, it is recommended not to use an ampersand (&) to background processes started in this script if you are running VNC Server 6.2.0+.  

Note: This is a change to the behaviour of previous versions of VNC Server which did require use of the ampersand (&). The change was introduced to allow the use of the built-in Xorg to support the Gnome desktop environment. See this article for more information.

So for example, from VNC Server 6.2.0+ use: 

startkde 

and not

startkde &



$ nslookup www.realvnc.com
Server:         223.6.6.6
Address:        223.6.6.6#53


Non-authoritative answer:
www.realvnc.com canonical name = dg98q1fqxxogp.cloudfront.net.
Name:   dg98q1fqxxogp.cloudfront.net
Address: 13.33.231.5
Name:   dg98q1fqxxogp.cloudfront.net
Address: 13.33.231.115
Name:   dg98q1fqxxogp.cloudfront.net
Address: 13.33.231.100
Name:   dg98q1fqxxogp.cloudfront.net
Address: 13.33.231.65

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值