Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-06-2003, 04:56 PM   #1
LQ Newbie
Registered: Aug 2003
Posts: 10

Rep: Reputation: 0
Cannot start vnc server because the USER environment variable is not set

We cannot load vnc server on startup. The only way we can get to run is to stop and start the service once were in KDE. This is unacceptable because we need to remotely administrate it.

How do we set the USER environment variable for VNC server?

Startup error looks like this

“Starting vncserver: Starting VNC server: 3: root vncserver: The USER environments variable is not set”

Old 08-06-2003, 05:18 PM   #2
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335

Rep: Reputation: 32
I am guessing this is you:

/root/.vnc/xstartup: !/bin/sh: No such file or directory
sh: /lib/cpp: No such file or directory
xset: bad font path element (#37), possible causes are:
Directory does not exist or has wrong permissions
Directory missing fonts.dir
Incorrect font server address or syntax
This message tells me that the file /root/.vnc/xstartup doesn't exist. If it does, do chown root:root /root/.vnc/xstartup and make sure you own it. Not sure of rights needed on it but I would guess 722 would do it.

I was hoping I could find you an answer. I have not ever had that problem on any distro. I know you have to log in least once and start vncserver from command line to build required dirs and files and configure passwords.

Please let us know what happens and what the problem was.
Old 08-06-2003, 05:45 PM   #3
LQ Newbie
Registered: Aug 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for the quick reply.
that is me

the file xstartup does exist and it looks like this


xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &

As far as permissions go im not that knowledgable. But in the permissions tab root is the owner and ive given read write and exec permissions to user, group, and others
Old 08-06-2003, 05:57 PM   #4
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Have you tried creating a small rc script with USER and HOME in it? Something like:
export USER HOME
vncserver :2

Of course you may want to reconsider running it as root.
Old 11-21-2009, 09:10 PM   #5
LQ Newbie
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
the reason for this is that when the vncserver was started the login user is not the one who executed the vncserver at startup.

to solve this, do this:

edit your /etc/rc.local
and add this: su -c "vncserver -depth 32 -geometry 1024x768" your_username

save and close then reboot your pc.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set a value of environment variable? ukrainet Linux - Newbie 1 12-28-2004 05:33 AM
How to set an environment variable? dantemarmol Linux - Newbie 7 08-22-2003 11:59 AM
Set Environment Variable lloyd_stevens Linux - Software 1 07-30-2003 01:38 PM
How to set a environment variable in rh? yenonn Linux - Newbie 11 02-21-2003 11:24 PM
how to set CC environment variable General 2 12-18-2001 02:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration