GCloud Ubuntu虚拟机安装GUI遇no screens found(EE)错误求助
Hey there, let's tackle this issue head-on. That no screens found error you're seeing is directly tied to how Google Cloud (GCP) Compute Engine VMs are set up—they're built as "headless" servers by default, meaning there's no physical or pre-configured virtual graphics hardware for Xorg (the display server) to detect. Here's exactly how to get your GUI up and running:
Step 1: Install the Dummy Video Driver
First, we need a virtual display driver that Xorg can use since there's no physical GPU. Install the required package:
sudo apt-get update && sudo apt-get install xserver-xorg-video-dummy -y
Step 2: Create a Custom Xorg Configuration File
We need to explicitly tell Xorg what virtual screen to use. Let's set this up:
- Back up any existing config (if you have one):
sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak 2>/dev/null - Create a new config file with
nano:sudo nano /etc/X11/xorg.conf - Paste this configuration (it defines a 1920x1080 virtual screen—adjust the resolution if needed):
Section "Device" Identifier "DummyDevice" Driver "dummy" VideoRam 256000 EndSection Section "Monitor" Identifier "DummyMonitor" HorizSync 5.0 - 1000.0 VertRefresh 5.0 - 1000.0 Modeline "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync EndSection Section "Screen" Identifier "DummyScreen" Device "DummyDevice" Monitor "DummyMonitor" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1920x1080" EndSubSection EndSection - Save and exit: Press
Ctrl+O, hit Enter, thenCtrl+X.
Step 3: Clean Up Conflicting Desktop Environments
You mentioned installing Xfce, Gnome, and KDE all at once—this can cause configuration conflicts. Let's stick to one desktop environment (we'll use Xfce as an example):
# Remove conflicting desktop environments sudo apt-get remove gnome-shell kde-plasma-desktop -y # Reinstall Xfce to fix any broken packages sudo apt-get install --reinstall xfce4 xfce4-goodies -y
Step 4: Set Up VNC for Remote Access
Since GCP VMs don't have a local display, you'll need to use VNC to connect to the GUI:
- Install a VNC server:
sudo apt-get install tigervnc-standalone-server tigervnc-xorg-extension -y - Set a VNC password (you'll need this to connect):
vncpasswd - Start the VNC server with your desired resolution:
vncserver :1 -geometry 1920x1080
Step 5: Connect to Your GUI
Use any VNC client (like RealVNC, TightVNC) to connect to your VM's external IP address followed by :1 (e.g., 123.45.67.89:1). Enter the password you set earlier, and you should see your Xfce desktop!
Why This Happens on GCP
GCP Compute Engine VMs are optimized for server workloads, so they don't include graphics hardware by default. Xorg relies on detecting a display device to start, and without the dummy driver and custom config, it can't find any—hence the no screens found error.
内容的提问来源于stack exchange,提问作者rmznbyk 1

