Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old September 17th, 2006   #1
paperdiesel
Way Too Much Ubuntu
 
Join Date: Oct 2005
Beans: 244
Ubuntu 9.10 Karmic Koala
HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

This guide is very similar to the Gnome Ubuntu HOWTO, located here:

http://ubuntuforums.org/showthread.php?t=122402

I have borrowed a lot of the notes from that author, only changing things to work for Kubuntu users. Most of the credit for the info goes to the author of that post. If you are having problems, I strongly recommend browsing through that thread first.

This guide is intended for Kubuntu users, and details how to enable Xdmcp for your KDE session. It was written using Kubuntu 6.06 (i386) as a reference. In the steps, I use kate as the text editor, but you can use whatever editor you prefer. In reality I use vi, but most people don't know vi commands so I stick with kate in these examples.

Required packages:

To make sure you have the proper software installed, execute the following:

Type in a terminal:
Code:
sudo apt-get install vnc4server xinetd xvncviewer
The latest versions are:
vnc4server: Xvnc Free Edition 4.1.1
xinetd: xinetd Version 2.3.14 libwrap loadavg
xvncviewer: VNC viewer version 3.3.7 - built Feb 20 2006 12:04:05

If you're using previous versions of any of these packages, there's no guarantee this will work. (Actually, there's no guarantee this will work anyway, but if you use versions below what I indicated, then you're just making it harder on yourself )

WARNING: Make sure you install vnc4server and NOT vncserver. These packages ARE different, and the latter will NOT work correctly.

Note to AMD64 users: The current version of vnc4server in the repositories has a bug, so you need to download and install the fixed vnc4 packages as shown below:
Code:
wget http://qt1.iq.usp.br/download/vnc4server_4.0-7.3_amd64.deb
wget http://qt1.iq.usp.br/download/xvnc4viewer_4.0-7.3_amd64.deb
sudo dpkg -i vnc4server_4.0-7.3_amd64.deb
sudo dpkg -i xvnc4viewer_4.0-7.3_amd64.deb
THE STEPS:

1. ENABLE XDMCP IN KDE

Type in a terminal:
Code:
sudo kate /etc/kde3/kdm/kdmrc
At the very bottom of the file, you'll see this section:

Code:
[Xdmcp]
Enable=false
Willing=/etc/kde3/kdm/Xwilling
Change it to look exactly like this:
Code:
[Xdmcp]
Enable=true
Port=177
Xaccess=/etc/kde3/kdm/Xaccess
Willing=/etc/kde3/kdm/Xwilling
Save the file and quit. Then type this in your terminal:

Code:
sudo kate /etc/kde3/kdm/Xaccess
This is a big file and can be confusing, so make sure you do this exactly as shown. Scroll down and find this line:

Code:
#*                                       #any host can get a login window
Remove the # from the beginning of that line, so it looks like this:

Code:
*                                       #any host can get a login window
Then find this line:
Code:
#*               CHOOSER BROADCAST       #any indirect host can get a chooser
Remove the # from the beginning of that line, so it looks like this:
Code:
*               CHOOSER BROADCAST       #any indirect host can get a chooser
Save the file and quit out of KATE.

Now we need to restart the KDM process so it will re-read the configuration file. The easiest way to do this is to just reboot the machine. The quickest is to do the following:

Code:
ps -ef | grep kdm
This will print out a list of processes with the letters 'kdm' in the name. Find the one that looks like the following (Specifically the one that ends in /usr/bin/kdm):

Code:
root    4530      1     0 0:09:20 ?          00:00:00 /usr/bin/kdm
See the number right after root? 4530 in my example, you will almost certainly have a different number. That's the process ID or PID. Type the following command to restart kdm (Substituting the PID number you have for the 4530 in my example):

Code:
sudo kill -HUP 4530

2. SET THE VNC PASSWORD

Type this in a terminal:
Code:
sudo vncpasswd /root/.vncpasswd

3. ADD VNC SERVICE TO XINETD

Type this in a terminal:
Code:
sudo kate /etc/xinetd.d/Xvnc
Enter this in to the new file:
Code:
service Xvnc
{
        type = UNLISTED
        disable = no
        socket_type = stream
        protocol = tcp
        wait = yes
        user = root
        server = /usr/bin/Xvnc
        server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd
        port = 5901
}
I recommend leaving all of that code alone, but you can safely change the 1024x768 to be a bigger or smaller resolution for your Xvnc window, depending on what you want. You can also change the depth, but understand that increasing the depth bits will cause more bandwidth to be used over your network, which could slow down your VNC experience considerably.


4. RESTART XINETD

If the following code does not work, try rebooting:
Code:
sudo /etc/init.d/xinetd stop
sudo killall Xvnc
sudo /etc/init.d/xinetd start
Don't worry if you see a message like "Xvnc: no process killed". This just means there was no open, active session of VNC running at the time. This is expected and is normal.


5. TEST

If you followed all of the above steps correctly, you should now be able to test your VNC server. Type the following in a terminal:
Code:
vncviewer localhost:1
You should be prompted for the VNC password, and then see the KDM login screen where you can login and start a new X session. If that works, you can now go ahead and try to connect from remote machine using your favorite VNC client (remember to first close the local vncviewer we started above). Remember to use the VNC server machine's domain name or IP address, followed by :1 (e.g. 192.168.0.100:1). If connecting locally as shown above works, but connecting remotely fails, then this means you have a problem with a firewall which is blocking some ports. See the notes below about how to deal with that.

Note about ports: The VNC server set up as shown uses TCP port 5901. If you are using firewall software (e.g. firestarter) on that machine, you need to allow incoming connections on this port. If you are using a router which assigns your machine a private address (e.g. 192.168.0.100) which is not accessible from the internet, then you need to forward TCP port 5901 from the router to this machine.

Note about security: This setup allows any user to start an X-session remotely by logging in using his regular password (after starting the VNC connection using the VNC password), so if the user disconnects without logging out, any other user which knows the VNC password can connect afterwards and resume the same session that the first user started. So if you do not want to log out before disconnecting, it's advisable to at least lock your VNC X-session screen. Also note that while a remote user is connected thru VNC, no other connection will be accepted. An idle VNC client will be disconnected after one hour, but this can be changed by using the "-IdleTimeout" option in the server_args line in /etc/xinetd.d/Xvnc. For example, you can add "-IdleTimeout 300" to change it to 5 minutes.


reference links:
Gnome VNC howto: http://ubuntuforums.org/showthread.php?t=122402
Xdmcp in kdm: http://klomdark.servebeer.com:8081/M...px?MsgNum=1967


Good luck!

Last edited by paperdiesel; September 29th, 2006 at 02:22 PM..
paperdiesel is offline   Reply With Quote
Old September 26th, 2006   #2
master_b
A Carafe of Ubuntu
 
Join Date: Aug 2005
Beans: 77
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Hi paperdiesel

Thanks for the Kubuntu HowTo for vnc4server.

I've been trying to get remote access (over my home LAN) to desktop:0 ( actual desktop) of a remote "headless" PC ie no monitor, mouse or keyboard, but its NVidea TV out is connected to a TV and I can view the "cloned" desktop ( and TV output) on that.

Can successfully remotely access the pc using NX ( better than vnc, Krfb etc in my opinion) but none of those allow access to desktop:0, whereas vnc4 will ( at least according to its website).

Will post re my success or otherwise.

Bill
master_b is offline   Reply With Quote
Old September 27th, 2006   #3
master_b
A Carafe of Ubuntu
 
Join Date: Aug 2005
Beans: 77
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Follow-up:-

Worked perfectly except that I get a grey desktop. Remember having same problem eons ago with vnc but forget fix. Will figure it out and post.

In addittion, NX still works without problems, whereas when I had plain vnc installed, NX wouldn't work when the vncserver was running.

Bill
master_b is offline   Reply With Quote
Old September 27th, 2006   #4
paperdiesel
Way Too Much Ubuntu
 
Join Date: Oct 2005
Beans: 244
Ubuntu 9.10 Karmic Koala
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Hey Bill,

If you want to use VNC to view display :0, I'd recommend x11vnc. I used it a while back, and if I remember correctly, it acts as a VNC extension to the X server, and loads inside your xorg.conf file and allows you to VNC in to the main display.

I've also heard about people using vnc4server and getting grey screens. But if you're trying to use vnc4server to display :0, that might be why you're getting a grey screen. Try x11vnc and let me know if it works.
paperdiesel is offline   Reply With Quote
Old September 27th, 2006   #5
master_b
A Carafe of Ubuntu
 
Join Date: Aug 2005
Beans: 77
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Hi paperdiesel

thanks for the reply.

Have tried several "HowTos" for remote connecting to desktop:0, including x11vnc, but your instructions herewith are the only one's that I've found for Kubuntu.

Problem is that many of the Ubuntu "Howtos" give instructions to use various Gnome Menu items that just don't exist with Kubuntu/KDE, and fail to name the actual config files that are altered.

From past experience with vnc, which I haven't used since discovering NX, I have vague recollections that in order to fix the "grey screen" problem, a config file has to be altered to include the starting of the desired window manager, in this case kde.

When I get time I'll dig through my old install notes and try to find the info. Have "googled" to no avail. I think that this "grey screen" problem can occur regardless of whether you are using Krdc, vnc, x11vnc etc.

Bill
master_b is offline   Reply With Quote
Old September 28th, 2006   #6
paperdiesel
Way Too Much Ubuntu
 
Join Date: Oct 2005
Beans: 244
Ubuntu 9.10 Karmic Koala
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Ah, well if that's the case, the only config file I know that sounds similar to what you describe is the xstartup file, located in ~/.vnc/

Open up ~/.vnc/xstartup and scroll to the bottom of the file. If you see a line that looks like:

Code:
twm &
Change it to:

Code:
startkde &
.

See if that helps.
paperdiesel is offline   Reply With Quote
Old September 29th, 2006   #7
master_b
A Carafe of Ubuntu
 
Join Date: Aug 2005
Beans: 77
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Hi paperdiesel

Yep, thats the file I was looking for, though I now believe that that isn't my problem.

Did an nmap of both the Client PC:-

PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
631/tcp open ipp
693/tcp open unknown
782/tcp open hp-managed-node
2049/tcp open nfs

and the Server PC:-

PORT STATE SERVICE
22/tcp open ssh
5901/tcp open vnc-1
6001/tcp open X11:1

Don't seem to be able to open/forward any more ports on my modem/router ( 10 forwarded at present)

I'm not sure where the problem is - I'm still getting a grey screen with vncviewer from the Client pc. Am thinking that it may be related to 6001 X11.

Will keep trying. If I can find a cross-over cable I'll try direct from pc to pc without the modem/router.

Bill
master_b is offline   Reply With Quote
Old September 29th, 2006   #8
paperdiesel
Way Too Much Ubuntu
 
Join Date: Oct 2005
Beans: 244
Ubuntu 9.10 Karmic Koala
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Can you get a successful vnc session running on the server machine? Test it on the server with

Code:
xvncviewer localhost:1
If it works on the server and not from a remove client, it has to be a network issue. But if you get a grey screen testing it form the server itself, it's most likely a vnc settings issue.
paperdiesel is offline   Reply With Quote
Old September 29th, 2006   #9
master_b
A Carafe of Ubuntu
 
Join Date: Aug 2005
Beans: 77
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

Hi paperdiesel

Getting closer to success.

Have determined that NX is running on remote pc, so when I start vnc4server I need to log-in remotely to desktop:2.( I had been logging into desktop:1 which is the NX remote desktop).

I then was getting a grey screen with a white terminal.

Editing ~/.vnc/xstartup with "startkde &" and remotely logging in to desktop:2 has kde start automatically but crash while loading the desktop.

Will continue to attempt to fix problem - first by removing NX. I'd prefer to keep it installed and running, but I'll try to get xvnc4viewer accessing desktop:0 first.

Bill
master_b is offline   Reply With Quote
Old September 30th, 2006   #10
Al_maverick
Gee! These Aren't Roasted!
 
Al_maverick's Avatar
 
Join Date: Nov 2005
Location: Buenos Aires, Argentina
Beans: 216
Kubuntu 7.04 Feisty Fawn
Re: HOWTO: Set up VNC server with resumable sessions - KUBUNTU VERSION

I get an error while trying to dpkg vnc4server

Quote:
al@maverick:~/tmp$ sudo dpkg -i vnc4server_4.0-7.3_amd64.deb
Selecting previously deselected package vnc4server.
(Reading database ... 142996 files and directories currently installed.)
Unpacking vnc4server (from vnc4server_4.0-7.3_amd64.deb) ...
dpkg: dependency problems prevent configuration of vnc4server:
vnc4server depends on xserver-common; however:
Package xserver-common is not installed.
dpkg: error processing vnc4server (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
vnc4server
I tried to install xserver-common but it says it depends on xorg-common, or something. I just dont want to go any further without if Im gonna mess my X installation.
Al_maverick is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:18 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry