• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

vncserver fails with “Starting VNC server: no displays configured”

By admin

Question

When I try to start/restart the “vncserver” service, it fails with the below error.

# service vncserver restart
Starting VNC server: no displays configured

Solution

Check for the Syntax of the /etc/sysconfig/vncservers file

1. The above error mostly occurs when you syntax error in the vncserver configuration file /etc/sysconfig/vncservers. You can verify if you have the configuration entries in below format.

# vi /etc/sysconfig/vncservers
VNCSERVERS="2:myusername"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

2. One of the most common mistake users do is that they use unnecessary spaces in the configuration file. For example, following line exists in /etc/sysconfig/vncservers, and have typos such as space between “N” and “[user]”

# cat /etc/sysconfig/vncservers
...
VNCSERVERS="N: [user]"

3. Sometimes you copy the configuration file lines from some book or website, which may also copy some junk characters. These are hard to find. You can use the below command to see if the file contains any junk characters.

# cat -evt /etc/sysconfig/vncservers | grep -v "#"

4. Another useful tip is to edit the below commented lines by hand which are already present in the configuration file /etc/sysconfig/vncservers.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

The above 2 lines are present by default for sample configuration. Make sure you remove the “#” in front of these lines before using them.

5. You should see output similar to shown below when the configuration file is with correct syntax.

# service vncserver start
Starting VNC server: 2:root 
New 'geek.mylabserver.com:2 (root)' desktop is geek.mylabserver.com:2

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/geek.mylabserver.com:2.log

3:user 
New 'geek.mylabserver.com:3 (user)' desktop is geek.mylabserver.com:3

Creating default startup script /home/user/.vnc/xstartup
Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/user/.vnc/geek.mylabserver.com:3.log

                                                           [  OK  ]
How to configure VNC Server on CentOS/RHEL 6

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 6 : how to start the services interactively during boot (to disable/abort some services)
  2. How to Mount NFS File Systems Using ‘autofs’ in CentOS/RHEL
  3. Beginners Guide to Samba (Installation and Configuration)
  4. CentOS / RHEL : How to assemble a software RAID in Rescue mode
  5. RHEL / CentOS : How to rebuild LVM from Archive (metadata backups)
  6. How to create and mount Btrfs file system (explained with examples)
  7. CentOS / RHEL 7 : How to boot into Rescue Mode or Emergency Mode
  8. fdisk: Unable to write /dev/sdg: Bad file descriptor – error while formatting USB disk
  9. CentOS / RHEL 6 : How to completely remove device mapper multipath (dm-multipath)
  10. CentOS / RHEL : How to create new LVM based swap partition

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary