Search This Blog

2013-03-27

CentOS 6.3 Install TigerVNC with Fixes or Xvfb Problem

Product: TigerVNC in CentOS 6.3 64-bit
Module: TigerVNC, CentOS

I encountered font loading problem when install TigerVNC server in fresh CentOS 6.3 64-bit in i386. Spent 4 days to look for solution especially in TigerVNC and CentOS forums, but nobody has a solution. Most people are either providing installation procedures, fonts installation, or symbolic link creation for fonts.

This eventually is Xvfb and pixman problem, and not VNC. If my post help, kindly donate CAD$5

Error message:

[dix] Could not init font path element /usr/share/X11/fonts/misc, removing from list!
[dix] Could not init font path element /usr/share/X11/fonts/100dpi, removing from list!
[dix] Could not init font path element /usr/share/X11/fonts/Type1, removing from list!
[dix] Could not init font path element /usr/share/fonts/default/Type1, removing from list!
[dix] Could not init font path element built-ins, removing from list!


Fatal server error:
could not open default font 'fixed'


So I have to reverse engineer the internal architecture of VNC by start thinking what are the core X Windows components used by VNC. The scope is just too wide and it is a long journey to do it. That's why I spent 4 days even though I have 4 years of extensive X Windows knowledge many years ago

Eventually I found Xvfb command will generate following error message which is identical when startup VNC. I spent nearly 3 hours to look for any known issues, but every answer does not lead to a solution

could not open default font 'fixed'

Today, I found a new lead from StackOverflow.com, which mention about X font library, although that is not the solution, which I get me thinking. This post mention about specifying font path, which is not the solution. It is just noise like many other

http://stackoverflow.com/questions/8817196/problems-with-bundling-xvfb-into-application

The thing that catch my eyes is that it mention about libXfont. So it let me think that it could be the bug in libXfont that shipped with CentOS 6.3 media that causing "Could not init font path element" error. It is impossible that I have installed so many different types of fonts and even redundant fixed fonts and none of them are able to be recognized by Xvfb (and certainly vncserver which relies on X Windows). Eventually, that is one of the trouble maker.

I used following command to upgrade libXfont, and I manged to move a step closer

$ sudo yum -y install libXfont

Then I encountered a different error caused by pixman It is another important X Windows library, and I upgraded pixman to resolve it

/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids

Finally I am able to start vncserver.

Following post is the commands and screen output I used. It started by solving pixman first, and libXfont last, but they can be in reverse

[root@sichenux01 ~]# mount -o ro /dev/xvdd /media/cdrom
[root@sichenux01 ~]# yum -y install tigervnc-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.mirror.freedomvoice.com
 * c6-media:
 * extras: linux.mirrors.es.net
 * updates: centos.sonn.com
file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml
Trying other mirror.
file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
Trying other mirror.
c6-media                                                 | 4.0 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-5.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch           Version              Repository    Size
================================================================================
Installing:
 tigervnc-server         x86_64         1.1.0-5.el6          base         1.0 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 1.0 M
Installed size: 2.6 M
Downloading Packages:
tigervnc-server-1.1.0-5.el6.x86_64.rpm                   | 1.0 MB     00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key)
 Package: centos-release-6-3.el6.centos.9.x86_64 (@anaconda-CentOS-201207061011.x86_64/6.3)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : tigervnc-server-1.1.0-5.el6.x86_64                           1/1
  Verifying  : tigervnc-server-1.1.0-5.el6.x86_64                           1/1

Installed:
  tigervnc-server.x86_64 0:1.1.0-5.el6

Complete!
[root@sichenux01 ~]#
[root@sichenux01 ~]# vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /root/.Xauthority

WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured.  Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.

/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids
[root@sichenux01 ~]# yum -y install pixman
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.mirror.freedomvoice.com
 * c6-media:
 * extras: linux.mirrors.es.net
 * updates: centos.sonn.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pixman.x86_64 0:0.18.4-1.el6_0.1 will be updated
--> Processing Dependency: pixman = 0.18.4-1.el6_0.1 for package: pixman-devel-0.18.4-1.el6_0.1.x86_64
---> Package pixman.x86_64 0:0.26.2-4.el6 will be an update
--> Running transaction check
---> Package pixman-devel.x86_64 0:0.18.4-1.el6_0.1 will be updated
---> Package pixman-devel.x86_64 0:0.26.2-4.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch           Version                 Repository    Size
================================================================================
Updating:
 pixman               x86_64         0.26.2-4.el6            base         200 k
Updating for dependencies:
 pixman-devel         x86_64         0.26.2-4.el6            base          18 k

Transaction Summary
================================================================================
Upgrade       2 Package(s)

Total download size: 218 k
Downloading Packages:
(1/2): pixman-0.26.2-4.el6.x86_64.rpm                    | 200 kB     00:00
(2/2): pixman-devel-0.26.2-4.el6.x86_64.rpm              |  18 kB     00:00
--------------------------------------------------------------------------------
Total                                           1.1 MB/s | 218 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : pixman-0.26.2-4.el6.x86_64                                   1/4
  Updating   : pixman-devel-0.26.2-4.el6.x86_64                             2/4
  Cleanup    : pixman-devel-0.18.4-1.el6_0.1.x86_64                         3/4
  Cleanup    : pixman-0.18.4-1.el6_0.1.x86_64                               4/4
  Verifying  : pixman-devel-0.26.2-4.el6.x86_64                             1/4
  Verifying  : pixman-0.26.2-4.el6.x86_64                                   2/4
  Verifying  : pixman-0.18.4-1.el6_0.1.x86_64                               3/4
  Verifying  : pixman-devel-0.18.4-1.el6_0.1.x86_64                         4/4

Updated:
  pixman.x86_64 0:0.26.2-4.el6

Dependency Updated:
  pixman-devel.x86_64 0:0.26.2-4.el6

Complete!
[root@sichenux01 ~]# vncserver

WARNING: The first attempt to start Xvnc failed, possibly because the font
catalog is not properly configured.  Attempting to determine an appropriate
font path for this system and restart Xvnc using that font path ...
Could not start Xvnc.


Xvnc TigerVNC 1.1.0 - built Feb 22 2013 22:28:37
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11300000, The X.Org Foundation

Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension VNC

Wed Mar 27 14:18:32 2013
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
[dix] Could not init font path element catalogue:/etc/X11/fontpath.d, removing from list!
[dix] Could not init font path element built-ins, removing from list!

Fatal server error:
could not open default font 'fixed'


Xvnc TigerVNC 1.1.0 - built Feb 22 2013 22:28:37
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11300000, The X.Org Foundation

Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension VNC

Wed Mar 27 14:18:35 2013
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
[dix] Could not init font path element /usr/share/X11/fonts/misc, removing from list!
[dix] Could not init font path element /usr/share/X11/fonts/100dpi, removing from list!
[dix] Could not init font path element /usr/share/X11/fonts/Type1, removing from list!
[dix] Could not init font path element /usr/share/fonts/default/Type1, removing from list!
[dix] Could not init font path element built-ins, removing from list!

Fatal server error:
could not open default font 'fixed'


[root@sichenux01 ~]#
[root@sichenux01 ~]# yum -y install libXfont
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.mirror.freedomvoice.com
 * c6-media:
 * extras: linux.mirrors.es.net
 * updates: centos.sonn.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libXfont.x86_64 0:1.4.1-2.el6_1 will be updated
---> Package libXfont.x86_64 0:1.4.5-2.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch             Version               Repository      Size
================================================================================
Updating:
 libXfont           x86_64           1.4.5-2.el6           base           136 k

Transaction Summary
================================================================================
Upgrade       1 Package(s)

Total download size: 136 k
Downloading Packages:
libXfont-1.4.5-2.el6.x86_64.rpm                          | 136 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : libXfont-1.4.5-2.el6.x86_64                                  1/2
  Cleanup    : libXfont-1.4.1-2.el6_1.x86_64                                2/2
  Verifying  : libXfont-1.4.5-2.el6.x86_64                                  1/2
  Verifying  : libXfont-1.4.1-2.el6_1.x86_64                                2/2

Updated:
  libXfont.x86_64 0:1.4.5-2.el6

Complete!
[root@sichenux01 ~]#
[root@sichenux01 ~]# vncserver

New 'sichenux01.guidewire.com:1 (root)' desktop is sichenux01.guidewire.com:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/sichenux01.guidewire.com:1.log
[root@sichenux01 ~]# ps -ef | grep Xvnc
root      1935     1  0 14:19 pts/0    00:00:00 /usr/bin/Xvnc :1 -desktop sichenux01.guidewire.com:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
root      2151  1804  0 14:19 pts/0    00:00:00 grep Xvnc


Before I end this post, I would like to include dependencies installation steps as well

yum -y groupinstall Desktop
yum -y install xorg-x11-fonts-Type1

I also modify /usr/bin/vncserver shell script to replace the creation of Xstartup file, which I prefer gnome-session instead of twm

Line: 85
Old: "twm &
New: "gnome-session &

Moreover, needs to modify internal firewall to allow remote connection to port 5800's and 5900's. I open for 20 ports

File: /etc/sysconfig/iptables
Line: 11

# VNC allows 20 virtual ports, 5800 - 5820 and 5900 - 5920
-A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 5800:5820,5900:5920 -j ACCEPT
 

File: /etc/sysconfig/vncservers

Create these entries so that root and oracle UNIX user will default to virtual VNC port 0 and 1 with screen resolution of 1024 * 768 without manually specifying it in command line

VNCSERVERS="0:root 1:oracle"
VNCSERVERARGS[0]="-geometry 1024x768"

VNCSERVERARGS[1]="-geometry 1024x768"

Auto run vncserver on boot up


/sbin/chkconfig vncserver on

I also wanted to replace the VNC with a login screen instead of desktop screen directly. So

rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install vnc-ltsp-config xinetd

chkconfig xinetd on
chkconfig vncts on
service xinetd restart
vi /etc/gdm/custom.conf
[daemon]

[security]
DisallowTCP=false

[xdmcp]
Enable=true

[greeter]

[chooser]

[debug]



File: /etc/xinetd.d/vncts

Adjust screen resolution. This is a quick and dirty change, which change the "-geometry" under section "service vnc-1024x768x16" instead of both /etc/services and this file. So if you want to be consistent, modify /etc/services to make them have a consistent "label"

Line 14:
Old: server_args    = -geometry 1024x768 -depth 16
New: server_args     = -geometry 1280x1024 -depth 24

Note: 1st section for virtual VNC port 0, next section is port 1, 2, 3, 4, 5, which represent what setup in /etc/services. Moreover, /etc/services represent the port configuration, while this file only for resolution, username, etc

If you see blank screen in VNC viewer, then restart xinetd switch the run level between 3 and 5 as shown below
# service xinetd stop
# init 3 (wait for 1 minute)
# init 5 (wait for 1 minute)
# service xinetd start

You should see the login screen after that, or reboot the Linux

Lastly, disable the annoying software update upon login to X Windows
# vi /etc/xdg/autostart/gpk-update-icon.desktop

Append following line to the end of the file
X-GNOME-Autostart-enabled=false

Reference:
http://wiki.centos.org/HowTos/VNC-Server

2 comments:

Jatal Lusad said...

Wow! can not even say how happy I was to find that a part of this blog solved my issue.

I have Oracle 6.3 and found that Xvfb refused to recognize the fontpath.d directory

"Could not init font path element catalogue:/etc/X11/fontpath.d"

I verified X was working by sending xclock to my display, so it was Xvfb centric problem.

I took your advice and did the following:

sudo yum -y install libXfont


This got rid of the error and Xvfb is now running!!!



So many thank you are being sent your way!

Unknown said...

Thank you very much...your blog helped me to resolve the issue....Keep up this great Work...