Halloween 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 NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Fix the VNC Gray Screen on an Ubuntu VPS

A gray TigerVNC screen usually means the virtual display started but the Ubuntu desktop session failed. Follow this log-first guide to match the session, remove stale startup scripts, install Xfce when needed, and connect securely through SSH.
Length10 min Posted Quest giverVGSources Team

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.

A gray VNC window with a movable cursor usually means TigerVNC created the virtual X display, but the desktop session never started correctly. 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 desktop environment installed at all. Read the display log and check the session files before changing firewall or viewer settings.

What the gray screen tells you

A gray background is different from a VNC connection that fails immediately. If the viewer shows a gray surface and often a cursor, the VNC server has generally accepted the connection and created an X display. The failure is later in the startup chain: the command that should launch Xfce, GNOME, or another desktop either was not found, exited early, or was replaced by an incompatible user script.

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.

This distinction saves time. A firewall rule, VNC password, or SSH tunnel can prevent a connection, but those settings do not normally turn a successfully created display into a gray desktop. First prove that the virtual display and session are healthy; investigate transport only after the session starts normally.

Start with the affected display and its log

List running VNC displays

On the VPS, run:

tigervncserver -list

Record the display number, such as :1, and check whether an old session is already running. A stale process, PID file, or an occupied :1 can produce a different failure from a broken desktop, and repeatedly starting new servers can make diagnosis harder.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Open the newest per-display log

Inspect the newest file in ~/.vnc/. On current Ubuntu packaging it may be named:

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

Replace :1 with the display you actually listed. Read the log from the first startup line through the session exit. The useful evidence is usually near the end, where the desktop command reports why it stopped.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • “Unable to start X session” indicates that the selected desktop could not be launched.
  • An early session exit means the startup command ran and then terminated before presenting a desktop.
  • A missing command points to an uninstalled desktop, an incomplete package installation, or a script referring to a program that is not on the VPS.
  • Display already in use means you must deal with the existing display before interpreting later errors.

Do not change unrelated firewall settings while the log still shows a session-start failure. Transport troubleshooting cannot repair a desktop process that exits on the server.

Confirm that the configured session exists

List Ubuntu’s installed desktop sessions

Run:

ls /usr/share/xsessions

This directory contains desktop-entry files that Ubuntu can use as sessions. Typical examples are xfce.desktop and gnome.desktop. The name configured for TigerVNC must correspond to an installed desktop file. Selecting xfce when only GNOME is installed, or selecting a desktop that has no corresponding file, leaves the server with no valid session to launch.

Match the value, not the filename extension

Use the desktop name represented by the file. For example, xfce.desktop corresponds to the session value xfce; do not enter the complete filename unless the installed manpage specifically requires it. If the directory contains no usable desktop entry, install a desktop environment before trying to tune TigerVNC.

Check the package-specific documentation

Ubuntu’s TigerVNC implementation has changed configuration locations and syntax between releases. Read the documentation installed on the VPS:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
man tigervncserver
man tigervnc.conf

The manpages tell you which session-selection syntax your release accepts and which startup files have precedence. This matters when copying instructions written for an older Ubuntu release.

Remove an obsolete xstartup override

Why an old script causes a gray desktop

Many older tutorials create ~/.vnc/xstartup. Ubuntu’s packaged TigerVNC flow gives a user startup file precedence over the system startup script. That means the file can continue to run even after you install a desktop and configure a valid session. A script that launches a removed command, starts the wrong desktop, or exits immediately can leave the virtual display showing only its gray background.

Move the file aside, rather than deleting it

Stop the affected display, then preserve the old file under a different name:

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

Moving it makes the packaged startup path available while retaining the script for reference. If the file does not exist, continue with session configuration; do not create a replacement script merely because a tutorial used one.

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

When a custom script is appropriate

A custom startup script is useful for a deliberate minimal window-manager launch or a specialized environment, but it must start software that is installed and must terminate in the way TigerVNC expects. Keep one only when you understand every command in it and have confirmed that the chosen desktop does not already provide a supported packaged session. Ubuntu documents the -xstartup option for intentionally replacing the default startup script; avoid supplying that option accidentally during normal diagnosis.

Set the session in the configuration format your Ubuntu release uses

Current Ubuntu 24.04-style per-user configuration

For the current Ubuntu 24.04 packaging, configure the session in the per-user TigerVNC file ~/.vnc/tigervnc.conf. For Xfce, the setting is:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
$session="xfce";

The value must match an installed session in /usr/share/xsessions. Keep the punctuation shown by the installed configuration format; this is not interchangeable with every older blog’s syntax.

Alternative packaged syntax

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

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.
session=xfce

Use the form supported by your installed tigervncserver and tigervnc.conf manpages. Jammy-era and Noble-era packages can differ in filename and syntax, so do not assume that a configuration copied from another Ubuntu release will be parsed.

Check for conflicting configuration

Do not leave several competing session declarations while testing. Check both files, any startup script, and the command used to launch the server. A command-line -xstartup selection can intentionally replace the normal startup path, while a user Xtigervnc-session or xstartup file can take precedence over the system script. Remove or rename the obsolete override, then keep one clear session choice.

Install a desktop when the VPS has none

Recognize the no-desktop case

Minimal VPS images often contain a server-oriented Ubuntu install without a graphical desktop. If ls /usr/share/xsessions shows no suitable entry and the VNC log reports that the X session cannot start, configuring another session name will not help. Install a desktop environment first.

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

Install Xfce and TigerVNC on Ubuntu 24.04

The current Ubuntu 24.04 walkthrough uses Xfce and these packages:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
sudo apt update
sudo apt install xfce4 xfce4-goodies tigervnc-standalone-server

The package names are tied to Ubuntu’s repositories and release packaging. Confirm that your VPS is running the intended Ubuntu release and that the packages are available from its configured repositories. Xfce is commonly selected on a VPS because it has a lighter resource profile than a full desktop, but the important requirement is a working installed session, not the name of a particular desktop.

Use GNOME only when its session is installed and compatible

GNOME can work when the GNOME session package is present and its desktop entry appears in /usr/share/xsessions. Set the TigerVNC session value to the matching name rather than leaving the configuration at xfce. If the log shows that the selected session is absent, install the corresponding desktop or choose one that is already present.

Restart cleanly and verify the new session

Stop the old display

After correcting the session or startup file, stop the affected display using the stop operation documented by your installed tigervncserver. For a display numbered :1, the commonly used form is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
tigervncserver -kill :1

Use tigervncserver -list first so you do not terminate the wrong display. If the server reports that no such display exists, remove only stale state that the log identifies; do not delete unrelated files in ~/.vnc/.

Start the display again

Start TigerVNC with the normal command for your installed package and configured display. If :1 is still occupied, choose another display such as :2. Display :1 normally maps to TCP port 5901, while :2 normally maps to port 5902.

Read the fresh log before reconnecting repeatedly

Open the newly created per-display log and confirm that the selected desktop remains running. A clean startup should no longer end immediately with “unable to start X session,” a missing executable, or a display-in-use error. Only then reconnect with the viewer. Repeated viewer attempts against a session that is still exiting create noise without changing the server-side cause.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the right connection method for a VPS

Loopback listening is intentional in many setups

A secure Ubuntu 24.04 setup commonly keeps TigerVNC listening on the VPS loopback interface and forwards the connection through SSH. This prevents the VNC service from being directly reachable on the public network.

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

Connect through an SSH tunnel

With display :1, forward the VPS’s port 5901 to a local port over SSH. The VNC viewer then connects to the local end, commonly shown as:

localhost::5901

The exact SSH command and local forwarding port depend on your account and client, but the key relationship is the display-to-port mapping. If the tunnel works while a direct connection to the VPS address fails, the desktop session is probably healthy and the difference is the listener or firewall policy.

Do not expose VNC just to fix a gray screen

Changing the listener from loopback to a public interface, opening a firewall port, or switching viewers does not repair a failed X session. Consider direct exposure only when you deliberately configure listening and firewall rules and understand the security consequences. For a gray screen, return to the per-display log, session file, and startup precedence first.

Choose between the packaged session and a custom startup

Approach Best fit Advantages Risks and checks
Packaged session selection A normal Xfce or GNOME desktop installed through Ubuntu packages Uses the distribution’s startup flow; fewer commands to maintain; session name is visible in /usr/share/xsessions The configured value must exactly match an installed desktop entry; syntax varies by Ubuntu release
Custom xstartup A deliberate minimal window-manager or specialized launch Allows precise control over what starts A stale or incomplete script can exit immediately and produce a gray screen; it takes precedence over the system flow

For ordinary desktop access on a VPS, the packaged session is the maintainable choice. Reserve a custom script for a known requirement and keep it under version control or a documented backup so a future package upgrade does not leave an unexplained override.

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

Common symptoms and the corresponding fix

What you see Most likely cause First action
Gray background and cursor immediately after login Desktop session exited or an old startup script took precedence Read the newest ~/.vnc/ log and move ~/.vnc/xstartup aside
“Unable to start X session” in the log No usable desktop entry or a mismatched session value Run ls /usr/share/xsessions and set the value to an installed session
“Command not found” or a missing executable Desktop package is absent or the custom script calls an old command Install the required desktop or remove the obsolete script
Display already in use An existing :1 process or stale state Run tigervncserver -list, then stop the correct display or use :2
Direct connection fails but SSH forwarding works Loopback listener or firewall policy Keep using the tunnel, or deliberately configure external listening and firewall access
Viewer cannot connect at all Transport, port, authentication, or server-process problem Verify the server is running and check the display/port mapping before diagnosing the desktop

A repeatable repair checklist

  1. Run tigervncserver -list and identify the display you are troubleshooting.
  2. Open that display’s newest log under ~/.vnc/; on current packaging, check the hostname-based filename.
  3. Record whether the log shows an early session exit, missing command, display conflict, or “unable to start X session.”
  4. Run ls /usr/share/xsessions and note the exact installed desktop names.
  5. Move an old ~/.vnc/xstartup to ~/.vnc/xstartup.old unless you intentionally need a custom script.
  6. Set the session in the syntax supported by the local manpage: for example, $session="xfce"; in ~/.vnc/tigervnc.conf or session=xfce in ~/.vnc/config.
  7. If no desktop entry exists, install a supported environment such as xfce4 and xfce4-goodies, along with tigervnc-standalone-server where needed.
  8. Stop the affected display, start it again, and inspect the new log before reconnecting.
  9. If the desktop starts but a public connection fails, use the SSH tunnel and connect the viewer to the local forwarded endpoint.

Prevent the gray screen from returning

  • Keep the session value aligned with the files currently installed in /usr/share/xsessions.
  • After an Ubuntu release upgrade, reread man tigervncserver and man tigervnc.conf; configuration filenames and syntax can change between releases.
  • Do not leave an abandoned xstartup file in place after switching to the packaged startup flow.
  • When you do use a custom script, document the commands it launches and confirm that each command still exists after package updates.
  • Use tigervncserver -list before starting another display so an old session does not mask the result of a configuration change.
  • Keep VNC on loopback and use SSH forwarding unless you have a specific, secured reason to expose it directly.

What not to change first

Do not begin by reinstalling the viewer, opening every VNC port, changing desktop resolution, or switching to a different VNC client. Those actions address connection or presentation details, not the server-side process that launches the desktop. The fastest path is always the same: identify the display, read its log, verify the installed session, remove stale startup precedence, and restart cleanly.

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.