For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. The steps involved were exactly the same as I was following earlier, with one exception: the setup of xstartup in the ~/.vnc folder.
For your xstartup file in ~/.vnc (the “.vnc” folder in
your home directory), you need the following:
—————————–
#!/bin/sh# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session &
# twm &
————————instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session
make sure restart vnc4server
The line which got Gnome working was “gnome-session &”
========================================
Now for all the steps involved (works in Karmic Koala Alpha 2, Ubuntu 9.10, kernel 2.6.30-10)
1. Install ssh server, ssh client, VNC viewer, VNC server, and xinetd
sudo apt-get install openssh-server openssh-client vnc4server xinetd vncviewer
2. Setup the ssh password for your login
ssh-keygen
3. Test out the ssh server by typing in
ssh localhost or ssh your_login@your_ip_address
4. Then create a vnc password
sudo vncpasswd ~/.vncpasswd
5. Edit the xstartup file in ~/.vnc directory
For your xstartup file in ~/.vnc (the “.vnc” folder in
your home directory), you need the following:
—————————–
#!/bin/sh# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session &
# twm &
————————instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session
6. Create a VNC desktop
vnc4server :1 -geometry 1024×768
7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the comand:
ssh -L 5901:your_ip_address:5901 your_username@your_ipaddress
8. Finally, load up your VNC desktop
vncviewer localhost:1
And now you are ready to use connect to your machine remotely and use administer the computer remotely.
P.S: If you are using a firewall (hardware or software, you need to get enable port forwarding and unblock ports 22 and 5900-5999 on the Ubuntu machine to allow SSH and VNC to be accessed.
Yea, I tried out everything you said, but the client side screen won’t refresh. Do you have any suggestions?
If you have established a connection and are able to see the GUI of the machine that you are connected to, you have done everything possible on your side. The slow refresh rates or the screen not refreshing at all can be attributed to lower network speeds.
[…] VNC server setup for Ubuntu 10.04 (Lucid Lynx) […]
Mr. Boot, Thanks for the tip. my xstartup file looks a little different than yours but you gave me the general direction. Screw vino and its cpu consumption. vnc4server is the best.
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#x-window-manager &
gnome-session &
I can sort of see how this works. Too bad that all I get is a X shaped mouse that I can move around. Sort of looks cool though. Wish it had a little more functionality/utility.
It would be way cool if there was some way I could open an X-terminal on a dumb terminal. I know it has been done, I have seen it. About 15 years ago, I used a Solaris system that was one machine that had about 20 graphical terminals attached. All the users had their own logins and that old machine actually allowed all these users to be logged into the GUI simultaneously, each with their own customizations. The terminals didn’t even need a hard disk. It didn’t require that much for resources either since the machine had 4 25Mhz processors and some 30-40MB RAM. Now that was plain cool.
I spent a couple hours on google looking how to implement this between my powerful, application-laden desktop with my slow, energy-saving netbook but I am starting to fear that this technology has been forgotten due to the prevalence of inexpensive, high-powered machines.
Of course, I meant X client. Not necessarily meaning that I was running XTerm, but experiencing the entire graphical client.
Just curious…did you guys have any keyboard layout issues with ‘gnome-session &’ input into xstartup? I sure do….
@sinner
If you are wondering about how windows keep on minimizing when you are logged into a VNC session, yes, there was an issue. It has to do with keyboard shortcuts. Pressing the ‘D’ minimized all the open windows on that session. You need to disable that shortcut (Hide Windows shortcut) or replace it with a key-combo that would be hard to replicate accidentally.
The above xstartup configuration did not work for me and I was seeing a grey screen with the following error “could not acquire name on session bus”.
To fix this, I have added the following line just after the # exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
and I could get a full blown desktop now without any issues
Hope this helps
I used to get a grey screen on rare occasions, but in most circumstances it worked fine.
The small hack with “unset DBUS_SESSION_BUS_ADDRESS” is quite useful in cases when you can’t make the grey screen go away.
Thanks for the helpful suggestion.
Thanks for the tips. I started a VNC server with you xstartup and I can connect to it with the gnome session. Although the desktop background is all grey without any icons. It doesn’t respond to right-button click either. I have unset “SESSION_MANAGER” and “DBUS_SESSION_BUS_ADDRESS” to no avail. Note that the default gnome terminals which were started via xstartup work fine (even with multiple tabs).
Hi Anand:
I have encountered similar problems when the network speeds have been painfully slow. If your server or client are using upload speeds less than 512 kbps, you can get the unresponsive gray screen.