Page 1 of 1

Redirecting video and sound to another machine

Posted: 27. Jul 2009, 21:47
by fernandoc1
I have a server with Ubuntu Intrepid, where I have installed a Virtual Machine with Windows XP. I wanna know if is possible to run this machine using the resources of the server, like processor and memory, and get the display and sound redirected to a Laptop that is also running Ubuntu.
If it is possible, could someone tell me how to do it?

Re: Redirecting video and sound to another machine

Posted: 27. Jul 2009, 21:53
by vbox4me2
I thought ubuntu had a rdp server and client??

Re: Redirecting video and sound to another machine

Posted: 27. Jul 2009, 22:33
by fernandoc1
But with rdesktop I need to start manually the machine in the server, and it is not reasonable, becouse there will be other people using the server and I don't want them to see what is running in the VM.

Re: Redirecting video and sound to another machine

Posted: 27. Jul 2009, 22:46
by Perryg
Well then why not set up the VBox guest for VDRP and ssh in to start and stop when you want. Then you can used RDP to remotely access it. If you start it headless then no one will be able to see what you are doing unless you give them access to the Windows client.

Re: Redirecting video and sound to another machine

Posted: 28. Jul 2009, 00:39
by fernandoc1
The last post sounds more reasonable, but I fear it will use lots of bandwidth only to start the Virtual Machine in the server through ssh, because to start the VirtualBox, we need to redirect the X and it consumes lots of bandwidth.
Is there a program or a plugin in the VirtualBox that could start the virtual machine and redirect its outputs to another machine?
This would be a great feature, because in a place where there is a powerful computer (server) and others not so powerful computers (workstations) people can take advantages of the resources of this powerful computer in their workstations.

Re: Redirecting video and sound to another machine

Posted: 28. Jul 2009, 01:08
by Perryg
fernandoc1,

Evidently I don't understand what it is you want to do.
If you have a server that is running VBox and you have a guest setup already then the only thing that you should be concerned with is how to start the VM and how to access it.
I have provided you with the information to do just that. Nothing about starting the X or what ever you are talking about.
If you are running an Ubuntu server you already should have ssh access to it or it would not be much of a server.
You say that the guest is Windows XP and it is already setup on the server. Why then would you want to do anything else but to remote into the service and use it?
I have just this setup and use it every day. It does not take that much bandwidth but anytime you try to access anything other than what is on your local machine will require a slight overhead on the network, even mapping file servers take resources.

Anyway if this is not what it is you are wanting to do you are going to need to paint a better picture for us to understand.

Re: Redirecting video and sound to another machine

Posted: 28. Jul 2009, 16:31
by fernandoc1
I understood your point. Thanks for the help. It worked here with the headless VM start.
Another question: Can you help me create a script that the user can only click on it and the VM is shown to him without having to type any line of command on the prompt?

Re: Redirecting video and sound to another machine

Posted: 28. Jul 2009, 17:04
by Perryg
I would think that you would want the person that is starting the VM to be a part of the Admin group. I never give access to the server to anyone, so starting this should not be done by a normal user.
Now once started it will stay going until someone tells it to shut down. Users should not be allowed to shut down the running VM, simply use it. This can be controlled by the group policy of the Windows machine. As for how the user will see this machine they simply need to remote in and use it via RDP client. Nothing fancy here if you setup the connection and then save it to their desktop.

All of this is pretty basic though and you should be able to handle it.

Re: Redirecting video and sound to another machine

Posted: 28. Jul 2009, 18:37
by fernandoc1
My idea is to put a VM machine for each user, so they can use it as their please, without any restrictions. But I fear that the process to start the VM is to complicated for their "windowed mind" : ) . So I would like to put a script in their desktop to start the virtual machine when they need to do something on Window$.
With this I can contribute to my employee happiness and if any problem happens to a VM, I can fix it only replacing the Virtual Hard Disk, with a preinstalled system.
In this case, I think that I have to use a ssh script to log on the server and start the VM headlessly and after that I need to execute the local call of rdesktop to bring the display to the user.
I think that it should be like:
#!/bin/bash
#On the client machine
ssh server -l user

#On the server
<password of the user>
VBoxHeadless -s Windows

#On the client machine
rdesktop-vrdp server -r sound:local

But I don't know how to make this happen. Can someone gimme a help on this?

Re: Redirecting video and sound to another machine

Posted: 31. Jul 2009, 01:29
by chronoboy
This script will work just fine, if the client and server systems are set-up correctly to use SSH RSA keys for authentication, no terminal window needs to be opened at all.

Code: Select all

#!/bin/sh

ssh -f vboxuser@vboxsrv VBoxHeadless -startvm "Windows XP - %USER%"
sleep 5
rdesktop -r sound:local <IP Address of Windows Guest VM>
sleep 3
ssh -f vboxuser@vboxsrv VBoxManage controlvm "Windows XP - %USER%" savestate
Sorry, I am not currently in front of a Linux box at the moment, please change the %USER% to the correct environment variable for the username.
Basically, what this does, is remotely launch the VM using SSHs background option, we wait at least 5 seconds for the VM to restore from a saved state. After, we launch the "standard" Linux rdesktop client and connect to the guests terminal server which allows the re-direction of sound and overall operates much more efficent for end-users, perhaps even using the GNOME client would also work. You can also tweak the other settings in rdesktop, such as the e[xp]erience level, and other options. After the user simply disconnects from the terminal server, we wait about 3 seconds for the session to either log off or disconnect and safely save the state back for easy access next time the user connects.

Any questions on this method? You can read online how the .ssh/authorized_keys file works for the RSA authentication to work to avoid having to enter in a password from specific client logins.

This would be the most user-friendly method, as everything is completely transparent to the user, they won't know a VM is even being loaded and saved remote(as long as you use the RSA authentication method). You may want to make a simple GTK2 app or something which implies that it is loading, so the user doesn't keep constantly double-clicking on the icon(although, a VM can only be started once, one rdesktop session will timeout and essentially kick the user as the VM state is saved right after).

A script to add to the servers shutdown would be:

Code: Select all

#!/bin/sh

for vm in `VBoxManage -q list runningvms | cut -f2 -d \"`; do
  echo "$vm"
  VBoxManage controlvm "$vm" savestate &>/dev/null
done
This script has not been tested with every type of VM naming scheme, feel free to change what you need to make it work for your set-up.