Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk10 min

How to Fix the VNC Gray Screen on an Ubuntu VPS

A gray VNC screen usually means the virtual X server started but the Ubuntu desktop session did not. Follow a log-first repair sequence to match the session, remove stale startup overrides, install Xfce if needed, and reconnect safely through SSH.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A gray VNC window with a movable cursor usually means TigerVNC has created the virtual X display, but the desktop session did not start correctly. On an Ubuntu VPS, the usual causes are a session name that does not match an installed desktop, an obsolete ~/.vnc/xstartup file overriding Ubuntu’s packaged startup flow, or no graphical desktop installed at all. Diagnose the display log first, correct the session configuration, then restart the display cleanly. Firewall and viewer changes will not repair a desktop session that exits immediately.

What the gray screen means

TigerVNC has two separable jobs: it creates an X server for the virtual display, and it launches a desktop session inside that display. A gray background and cursor indicate that the first job probably succeeded. The second job may have failed, exited early, or launched nothing useful. This is why changing VNC viewer color settings, opening additional firewall ports, or repeatedly reconnecting rarely fixes the symptom.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The desktop session is selected by name. TigerVNC looks for a matching desktop file in /usr/share/xsessions. If the configured value is xfce, an installed file such as xfce.desktop must be present. A mismatch can leave the X server alive while the graphical desktop never appears.

A user startup file can create the same symptom. Ubuntu gives a per-user ~/.vnc/xstartup (and, depending on the release, a user Xtigervnc-session) precedence over the system startup script. An old tutorial’s script may call commands that are no longer installed, start a session that immediately exits, or omit the desktop-session command entirely.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Use this order of operations

  1. List running displays with tigervncserver -list.
  2. Open the newest per-display log in ~/.vnc/.
  3. Check which desktop session files are actually installed.
  4. Move an old ~/.vnc/xstartup out of the way unless you deliberately maintain it.
  5. Set a session name that matches the installed desktop and the syntax documented by the installed Ubuntu package.
  6. Install a desktop such as Xfce if the VPS has no usable session.
  7. Stop and restart the affected display, then read the new log before changing network settings.

Run these commands as the same non-root account that owns the VNC session. Configuration in one user’s home directory does not automatically apply to another user.

1. Identify the display and read its log

List existing VNC sessions

tigervncserver -list

The output shows display numbers such as :1 or :2. A display that is already running can make a new start attempt fail or cause you to inspect the wrong session. Do not assume that the first display number is free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Open the newest display log

List the files in the VNC directory and inspect the log belonging to the display you are troubleshooting:

ls -lt ~/.vnc/
less ~/.vnc/$(hostname -f):1.log

Current Ubuntu packaging may name the file in the form ~/.vnc/$(hostname -f):1.log. Older releases and configurations can use a slightly different hostname form, so use the filename that actually exists. Replace :1 with the display shown by tigervncserver -list.

Search the log for messages such as:

  • Unable to start X session: the selected desktop command could not be launched.
  • Early session exit: the startup process ended before a desktop remained running.
  • Command not found or missing executable: a custom script refers to software that is not installed.
  • Display already in use: another X or VNC process owns that display number.
  • Stale PID or lock information: an earlier crash left state that interferes with a clean start.

A gray screen with no corresponding desktop process is a session-start problem. A connection that never reaches the VNC server at all is a transport problem and should be investigated separately.

2. Confirm that Ubuntu has a desktop session to launch

List installed session files

ls /usr/share/xsessions

Typical entries include xfce.desktop and gnome.desktop. The important part is the filename stem: configure xfce for xfce.desktop, or gnome for gnome.desktop. Do not configure a name copied from a guide unless that exact desktop file exists on this VPS.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

If the directory is empty or contains no desktop you intend to use, TigerVNC has nothing usable to start. Install a desktop environment before changing VNC transport settings. A minimal server image commonly has no graphical session package at all.

Why the exact name matters

The session value is not a free-form label. TigerVNC uses it to select a desktop entry and launch the associated session. A typo, a distribution-specific name, or a desktop removed during cleanup can produce the same gray background as a broken startup script. Checking the directory is faster and more reliable than guessing.

3. Remove a stale startup override

Move the old file aside

If an earlier setup created ~/.vnc/xstartup, preserve it for reference but remove it from the startup path:

mv ~/.vnc/xstartup ~/.vnc/xstartup.old

Moving the file rather than deleting it lets you recover any intentional customizations. Start without it so Ubuntu’s packaged TigerVNC flow can select the configured desktop session.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a custom script is appropriate

A custom script is useful when you intentionally launch a minimal window manager or a fixed application instead of a full desktop. It must call commands that exist on the VPS, use the correct display environment, and remain running in the way TigerVNC expects. Keep it only when you understand every command it runs. During diagnosis, an unknown script is an uncontrolled variable and should be taken out of the path.

Ubuntu documents the -xstartup option for deliberately replacing the default startup script. Do not add that option to normal troubleshooting commands unless you specifically want to bypass the packaged session handling.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

4. Set a matching session with the syntax your Ubuntu release expects

Ubuntu 24.04-style per-user configuration

Current Ubuntu 24.04 guidance uses a per-user TigerVNC configuration file. For an installed Xfce session, edit or create ~/.vnc/tigervnc.conf and set:

$session="xfce";

The value must match the desktop file found in /usr/share/xsessions. Keep the semicolon and quotation marks shown by the packaged configuration format.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Alternative packaged syntax

The same Ubuntu setup reference accepts a plain setting in ~/.vnc/config:

session=xfce

Use the form supported by the tigervncserver and tigervnc.conf manpages installed on your VPS. Jammy-era and Noble-era packaging differ in filenames and syntax, and copying a configuration from an older blog post can silently do nothing. Check locally:

man tigervncserver
man tigervnc.conf

These manpages also describe startup precedence, including when a user xstartup or Xtigervnc-session takes priority over the system script. Follow the documentation for the release actually installed rather than assuming that every Ubuntu version parses the same file.

Check ownership and location

Place the file in the home directory of the account that starts TigerVNC. A configuration saved under /root will not configure a session started by an ordinary user, and a file owned by another account can be unreadable or ignored. Confirm the active account with id -un and inspect the path with:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
id -un
ls -la ~/.vnc

5. Install a desktop environment when none exists

If the log indicates that no X session can start and ls /usr/share/xsessions shows no suitable desktop, install one. Xfce is commonly selected on VPS systems because it is relatively light on CPU and memory compared with a full desktop. The current Ubuntu 24.04 walkthrough installs these packages:

sudo apt update
sudo apt install xfce4 xfce4-goodies tigervnc-standalone-server

Use the package manager for the Ubuntu release on the VPS; package availability and dependencies can differ across releases. After installation, run ls /usr/share/xsessions again and use the exact session stem that now appears. Installing a desktop does not automatically repair an old startup override, so complete the configuration and cleanup steps as well.

GNOME can also work when its session is installed and compatible with the TigerVNC setup. It generally consumes more resources, and a VPS with limited memory may provide a better experience with Xfce. The deciding test is whether the session file exists and the VNC log shows that the session remains running.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Stop the affected display and restart cleanly

Stop only the display you diagnosed

tigervncserver -list
tigervncserver -kill :1

Replace :1 with the actual display. If the list shows no such session, do not kill a different display by guesswork. A stale process or lock may need separate cleanup, but first confirm what is running and what the log reports.

Start the display again

tigervncserver :1

Some packaged versions choose the display automatically when you omit the number; specifying it makes the resulting log and SSH tunnel easier to identify. If :1 is occupied and you have verified that it belongs to another useful session, start :2 instead:

tigervncserver :2

Display :1 normally maps to TCP port 5901, while :2 normally maps to 5902. Read the startup output and then open the new log. A clean restart should show the selected session launching rather than exiting immediately.

Reconnect only after checking the new log

If the log still reports an early exit, return to the session filename and startup precedence checks. If the log is clean but the viewer cannot connect, you now have evidence of a separate listening or tunnel issue. This separation prevents network changes from masking an unresolved desktop failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

7. Connect safely from a VPS through SSH

Loopback listening is intentional

Many current Ubuntu 24.04 setups keep TigerVNC bound to the VPS loopback interface and expose it through an SSH tunnel. This prevents the VNC service from being directly reachable on the public network. A direct viewer connection to the VPS address will fail in that arrangement even when the desktop session is healthy.

Create a tunnel for display :1

From your local computer, forward a local port to the VPS’s VNC port:

ssh -L 5901:localhost:5901 user@your-vps-address

Keep that SSH connection open. Point the VNC viewer at the local end, commonly localhost::5901 (the double colon tells many viewers that 5901 is a port rather than a display number). If you use display :2, forward 5902 and connect to the corresponding local port.

Distinguish transport failures from gray sessions

  • Gray screen with a cursor after connecting: the tunnel and VNC listener worked; troubleshoot the desktop session.
  • Connection refused through the tunnel: verify that the selected display is running and listening on the expected port.
  • Direct public connection fails but the tunnel works: the loopback-only listening choice is functioning as designed.
  • Both direct and tunneled connections fail: check the display list, startup log, SSH forwarding command, and any explicit listener settings.

Only expose VNC directly when you intentionally configure the listener and firewall for that design. Opening a port does not make a failed X session start.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failure branches

Symptom Likely cause Next action
Gray background and cursor; log says session cannot start No matching desktop file or incorrect session value Run ls /usr/share/xsessions, then set the exact session stem.
Gray background after following an old guide Stale ~/.vnc/xstartup overrides packaged startup Move it to ~/.vnc/xstartup.old and restart.
“Command not found” in the log Custom script calls an uninstalled program Remove the override or install the required package, then test again.
Display already in use An existing session, X process, PID, or lock owns the number Inspect tigervncserver -list; stop the correct session or use another display.
Viewer cannot connect directly, tunnel works TigerVNC listens on loopback Continue using SSH forwarding or deliberately configure public listening and firewall rules.
Viewer cannot connect even through SSH VNC display is stopped, wrong port forwarded, or SSH command targets the wrong host Confirm the display number, expected 5900-plus port, and the active SSH tunnel.

Packaged session or custom startup: which should you use?

Approach Advantages Trade-offs
Packaged desktop session Uses Ubuntu’s session files and maintained startup flow; fewer moving parts. Requires the configured session name to match an installed desktop file.
Custom xstartup or -xstartup Useful for a deliberately minimal window manager or application-only display. You must maintain commands, environment, permissions, and the script’s lifetime; stale files commonly cause gray screens.

For a normal graphical VPS, start with the packaged session. Introduce a custom script only for a clear requirement and document what it launches.

Prevent the gray screen from returning

  • Record the desktop session stem shown by ls /usr/share/xsessions instead of relying on a copied example.
  • Keep one intentional startup method. Remove or rename obsolete per-user scripts when using the packaged flow.
  • After Ubuntu or TigerVNC upgrades, reread the local manpages because configuration filenames and syntax can change between releases.
  • Keep the VNC display number, SSH forwarding port, and viewer address aligned; :1 normally means 5901 and :2 normally means 5902.
  • When a problem returns, capture the newest per-display log before killing processes or changing firewall rules.
  • Use a loopback listener plus SSH forwarding unless you have a specific reason to expose VNC publicly and have secured that exposure.

A compact repair checklist

  1. Run tigervncserver -list and identify the display.
  2. Open its newest file under ~/.vnc/; look for early exits, missing commands, and display conflicts.
  3. Run ls /usr/share/xsessions; note an installed stem such as xfce.
  4. Move an inherited ~/.vnc/xstartup aside unless it is a maintained custom script.
  5. Set the matching session in ~/.vnc/tigervnc.conf using the syntax documented by your installed package, or use the accepted session=... form in ~/.vnc/config.
  6. If no desktop is installed, install xfce4, xfce4-goodies, and tigervnc-standalone-server on Ubuntu 24.04, then verify the new session file.
  7. Stop the affected display, restart it, and inspect the fresh log.
  8. For loopback listening, connect through an SSH tunnel to the matching 5900-plus port.

The Bottom Line

Fix the session, not the viewer: read the per-display log, match TigerVNC’s session name to an installed file, remove stale startup overrides, install Xfce when necessary, and restart the display cleanly. Once the log shows a persistent desktop, use the SSH tunnel and port that correspond to the display number.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.