Google Compute Engine中Ubuntu16.04 LTS的VNC安装异常求助
Hey there, let's tackle that gray screen issue with VNC and GNOME on your Ubuntu 16.04 LTS instance in GCE. This is a common hiccup, usually tied to either incomplete desktop installation or misconfigured xstartup settings. Here's how to fix it step by step:
Reinstall the Full GNOME Desktop Environment
First, let's ensure GNOME is fully installed with all required dependencies. Sometimes partial installs can lead to missing components that break the desktop session:sudo apt update && sudo apt install ubuntu-gnome-desktop --reinstallThis will refresh your package list and reinstall the complete GNOME desktop stack, fixing any missing or corrupted files.
Fix the xstartup Configuration
Your xstartup file is likely not properly triggering the GNOME session. Let's reset it:- Back up your existing configuration to avoid losing any customizations:
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak - Create a new
xstartupfile with the correct commands to launch GNOME:
Paste the following content into the file:nano ~/.vnc/xstartup#!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & gnome-session & - Save and exit the editor (press
Ctrl+O, thenEnter, thenCtrl+X). - Give the file executable permissions so VNC can run it:
chmod +x ~/.vnc/xstartup
- Back up your existing configuration to avoid losing any customizations:
Restart VNC Server and Test the Connection
Now let's stop the current VNC session and restart it with the corrected settings:- Kill the active VNC session (replace
:1with your session number if different):vncserver -kill :1 - Launch a new VNC session with a specified resolution (adjust to your preference):
vncserver :1 -geometry 1920x1080 - Reconnect to your VNC session—you should now see the full GNOME desktop instead of the gray screen.
- Kill the active VNC session (replace
Check VNC Logs for Further Troubleshooting
If the issue persists, check the VNC session logs for error messages that can point to specific problems:cat ~/.vnc/$(hostname):1.logLook for lines mentioning missing libraries, failed session launches, or permission issues. These logs will help narrow down any remaining problems.
内容的提问来源于stack exchange,提问作者arun nath

