use virtualbox on a remote machine
-
simonchennj
- Posts: 5
- Joined: 7. Jul 2008, 23:21
use virtualbox on a remote machine
Hi,
I am wondering whether I can ssh to a remote server, start a VM on that server and somehow directly access the console of the VM? I don't want to tunnel the graphic interface...
thanks.
-Simon
I am wondering whether I can ssh to a remote server, start a VM on that server and somehow directly access the console of the VM? I don't want to tunnel the graphic interface...
thanks.
-Simon
-
Sasquatch
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
You can with the headless command. Run VBoxHeadless, wait for it to start completely and then you can SSH to it if you set it right. Why shouldn't it be possible?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
simonchennj
- Posts: 5
- Joined: 7. Jul 2008, 23:21
In this case, you still need to know the IP address of the VM. It's possible that the machine is not properly configured with DHCP.Sasquatch wrote:You can with the headless command. Run VBoxHeadless, wait for it to start completely and then you can SSH to it if you set it right. Why shouldn't it be possible?
I want to see the boot up message of the VM as soon as it starts. At that time, no ssh is available...
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
No, if you
I explain in a little more detail in http://forums.virtualbox.org/viewtopic.php?t=7580
- ssh from your PC to fred, say, and type in VBoxHeadless -s yourVM -p 4000 & but don't hit enter yet
- now again from your PC, RDP to fred:4000 but again don't enter
- now hit enter on the VBoxHeadless and as soon as the "listening on port" mesage comes up, switch to the RDP command on your PC and hit enter.
I explain in a little more detail in http://forums.virtualbox.org/viewtopic.php?t=7580
-
simonchennj
- Posts: 5
- Joined: 7. Jul 2008, 23:21
Emm... This sounds like an interesting solution. Is it possible to log into the machine without using RDP? I only want console access...TerryE wrote:No, if youYour RDP session will now connect to the VM console and you can watch the entire boot sequence.
- ssh from your PC to fred, say, and type in VBoxHeadless -s yourVM -p 4000 & but don't hit enter yet
- now again from your PC, RDP to fred:4000 but again don't enter
- now hit enter on the VBoxHeadless and as soon as the "listening on port" mesage comes up, switch to the RDP command on your PC and hit enter.
I explain in a little more detail in http://forums.virtualbox.org/viewtopic.php?t=7580
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
Siggghhh. I know RDP is M$'s acronym for Remote Desktop Protocol, but it really means scraping the Graphics Adapter output, and redirecting the keyboard and mouse. It works just as well for a text based console (actually better) as a GUI.
I am an old hack. I tend to stick to console/ssh access to my server VMs. I have my Workstation VMs configured not to start up X by default.
Your last Q is a bit like saying can I do console access without using the protocol designed to give me console access. Of course, you could always take the OSE build and develop your own text based console access implementation, but believe me RDP works well, though I only tend to use it if I am diagnosing the boot sequence on the fly, because like you I prefer ssh.
I am an old hack. I tend to stick to console/ssh access to my server VMs. I have my Workstation VMs configured not to start up X by default.
Your last Q is a bit like saying can I do console access without using the protocol designed to give me console access. Of course, you could always take the OSE build and develop your own text based console access implementation, but believe me RDP works well, though I only tend to use it if I am diagnosing the boot sequence on the fly, because like you I prefer ssh.
-
simonchennj
- Posts: 5
- Joined: 7. Jul 2008, 23:21
Thanks for your replyTerryE wrote:Siggghhh. I know RDP is M$'s acronym for Remote Desktop Protocol, but it really means scraping the Graphics Adapter output, and redirecting the keyboard and mouse. It works just as well for a text based console (actually better) as a GUI.
I am an old hack. I tend to stick to console/ssh access to my server VMs. I have my Workstation VMs configured not to start up X by default.
Your last Q is a bit like saying can I do console access without using the protocol designed to give me console access. Of course, you could always take the OSE build and develop your own text based console access implementation, but believe me RDP works well, though I only tend to use it if I am diagnosing the boot sequence on the fly, because like you I prefer ssh.
The main reason is that using RDP from a remote site is kind of slow... ssh cannot be guaranteed because the guest may not have network properly configured. I am looking into how to configure the serial port as a way to access console...
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
Simon,
I am not sure how to say this politely so forgive me, I'll be blunt. You need your head examined. If you are on the same LAN segment then text based RDP is really fast; even over a reasonable internet link its still OK; far, FAR faster than any serial comms. The RDP protocol uses compression and this is very efficient for text and you can tweak the framing parameters to optimize performance. And you are only watching the boot sequence for goodness sake!!! So before you start stringing up RS232 cables and posting to ask how to get serial ports working, why don't you just park your preconceptions and try it!!!
I am not sure how to say this politely so forgive me, I'll be blunt. You need your head examined. If you are on the same LAN segment then text based RDP is really fast; even over a reasonable internet link its still OK; far, FAR faster than any serial comms. The RDP protocol uses compression and this is very efficient for text and you can tweak the framing parameters to optimize performance. And you are only watching the boot sequence for goodness sake!!! So before you start stringing up RS232 cables and posting to ask how to get serial ports working, why don't you just park your preconceptions and try it!!!
-
simonchennj
- Posts: 5
- Joined: 7. Jul 2008, 23:21
Maybe I am not explaining myself clearly...TerryE wrote:Simon,
I am not sure how to say this politely so forgive me, I'll be blunt. You need your head examined. If you are on the same LAN segment then text based RDP is really fast; even over a reasonable internet link its still OK; far, FAR faster than any serial comms. The RDP protocol uses compression and this is very efficient for text and you can tweak the framing parameters to optimize performance. And you are only watching the boot sequence for goodness sake!!! So before you start stringing up RS232 cables and posting to ask how to get serial ports working, why don't you just park your preconceptions and try it!!!
I have remote machine, which I can ssh to and where all the VMs run.
I can configure the VM so that its console can be accessed through its (VM's) serial port. That serial port is accessed as a pipe file on the remote machine. So, I can ssh to the remote machine, use the pipe file to access the VM's console. This only requires ssh connection, not RDP - no matter how efficient it is, it is still bouncing graphical data around...
Is this clear enough?
Running VirtualBox Remotely
Hi,
I can run VIrtualBox remotely by using VBoxVRDP command but when i try to save the state of the Virtual Machine the process is aborted in the middle.
I google it but still not able to find any clue regarding the same
Any help will be highly appriciated
I have copied my scripts below which i m using remotely via SSH'ing into the Virtual Server
Scripts to start the VirtualBox
Script to save state of a running VIrtual Machine remotely
If i run these scripts on the virtual server then it works perfectly fine but remotely it abort the savestate process in middle
Modbreak:
Please use code blocks next time, that saves the whole format.
I can run VIrtualBox remotely by using VBoxVRDP command but when i try to save the state of the Virtual Machine the process is aborted in the middle.
I google it but still not able to find any clue regarding the same
Any help will be highly appriciated
I have copied my scripts below which i m using remotely via SSH'ing into the Virtual Server
Scripts to start the VirtualBox
Code: Select all
#!/bin/sh
#ensure that the server name is entered
if [ -z $1 ] ; then
echo "Please enter the server you wish to start"
echo "usage cmd <server>"
exit 1
fi
showvminfo=`VBoxManage showvminfo $1`
showvminfoline=`echo $showvminfo | cut -d":" -f13`
status=`echo $showvminfoline | cut -d" " -f1`
if [[ "$status" = "running" ]] ; then
echo VM Guest $1 is already powered on!
exit 1
else
VBoxVRDP -startvm "$1" &
fi
Code: Select all
#!/bin/sh
#ensure that the server name is entered
if [ -z $1 ] ; then
echo "Please enter the server you wish to stop"
echo "usage cmd <server>"
exit 1
fi
showvminfo=`VBoxManage showvminfo $1`
showvminfoline=`echo $showvminfo | cut -d":" -f13`
power=`echo $showvminfoline | cut -d" " -f1`
status=`echo $showvminfoline | cut -d" " -f2`
vm="$power $status"
if [[ "$vm" = "powered off" ]] ; then
echo VM Guest $1 is already powered off!
exit 1
else
VBoxManage controlvm "$1" savestate
fi
Modbreak:
Please use code blocks next time, that saves the whole format.
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
Two comments: first to Simonchennj, I know exactly what you're trying to Simon. I am sure that we will be interested in a write-up if you get it working. It's just that you are going to an awful log of trouble to do this. Most of the console content is logged directly anyway. Once SSH is up then you can use it. The only time you need to watch the boot sequence is if something it failing and you need to drop into init 1 to fix something -- a mount prob or a config setting. This is once in a blue moon. OK so the display is a bit sluggish, but I've done this across continents. Its workable. Price up the cost of your hourly rate to get your solution working, then price up the seconds delay caused by the RDP overheads and extra cost of the network traffic then decide which is most cost effective.
Now to kunaljain I just want want to clarify something: when you say "remotely via SSH'ing into the Virtual Server", I take it you really mean "remotely via SSH'ing into the physical Server which is acting as the VM host". That you connect to the server using SSH do something like a startVM myVM, then on a later session you reconnect and do a stopVM myVM. I thought that this might be a nohup issue so I did a quick search and came across this http://forums.virtualbox.org/viewtopic.php?t=2817.
Now to kunaljain I just want want to clarify something: when you say "remotely via SSH'ing into the Virtual Server", I take it you really mean "remotely via SSH'ing into the physical Server which is acting as the VM host". That you connect to the server using SSH do something like a startVM myVM, then on a later session you reconnect and do a stopVM myVM. I thought that this might be a nohup issue so I did a quick search and came across this http://forums.virtualbox.org/viewtopic.php?t=2817.
Running VirtualBox Remotely
Hey TerryE,
Let me clarify one thing i have installed CentOS 5.2 on my Dell PowerEdge R200 Server and i installed VIrtualBox on it and now i m using that VIrtualBox to run Two different Guest OS (Both Debian) and i ssh into my CentOS system through other machine to run Guest OS
Using VBoxVRDP command I can run both the Guest OS but if i try to save their state usting VBoxManage controlvm <Guest OS> savestate remotely then the process is aborted in the middle. Message shown there is
VirtualBox Command Line Management Interface Version 1.6.1
(C) 2005-2008 Sun Microsystems, Inc.
0%...
Any Idea why this is happening
Thanks in advance.
Let me clarify one thing i have installed CentOS 5.2 on my Dell PowerEdge R200 Server and i installed VIrtualBox on it and now i m using that VIrtualBox to run Two different Guest OS (Both Debian) and i ssh into my CentOS system through other machine to run Guest OS
Using VBoxVRDP command I can run both the Guest OS but if i try to save their state usting VBoxManage controlvm <Guest OS> savestate remotely then the process is aborted in the middle. Message shown there is
VirtualBox Command Line Management Interface Version 1.6.1
(C) 2005-2008 Sun Microsystems, Inc.
0%...
Any Idea why this is happening
Thanks in advance.
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
I'd better come clean. At the moment both the machines I use as hosts are XP, though I am about to upgrade one to Linux. I don't run VBox on the current "bare metal" Linux boxes that I use, because they are "production" systems. So I can only provide limited help because I can't replicated this in my current environments. I've has a thorough search of the VBox site and can't find any discussions or tickets relating to savestate aborts other than this one. So it looks as if it might be worth raising a ticket on this one.
However before you do, I assume that you also start VboxHeadless (VboxVRDP just symlinks to this now) by ssh? Could you try doing something like:
However before you do, I assume that you also start VboxHeadless (VboxVRDP just symlinks to this now) by ssh? Could you try doing something like:
- nohup VboxHeadless -s yourMachine -p yourPort >/tmp/$$VRDP.log 2>&1 &
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Google your Q site:VirtualBox.org or search for the answer before posting.
Hey TerryE,
Thanks for your reply.
Yup! i tried all possible combination's but still in black hole. In fact if i run the same shell script on the Cent OS machine (where i installed VirtualBox and Guest OS) It runs perfectly Fine but if i try to run the same script (For Saving State) by SSH'ing into the Cent OS Machine ( I mean Remotely) then Script to start the Guest OS work perfectly Fine for me but i m not able to save the state remotely.
Thanks
Thanks for your reply.
Yup! i tried all possible combination's but still in black hole. In fact if i run the same shell script on the Cent OS machine (where i installed VirtualBox and Guest OS) It runs perfectly Fine but if i try to run the same script (For Saving State) by SSH'ing into the Cent OS Machine ( I mean Remotely) then Script to start the Guest OS work perfectly Fine for me but i m not able to save the state remotely.
Thanks
-
TerryE
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
OK, so what you are saying is you have explicitly tried all of the four following scenarios with the following results:
- console startvm, console savestate: works
- ssh startvm, console savestate: works
- console startvm, ssh savestate: fails
- ssh startvm, ssh savestate: fails
- console startvm, console initiated at savestate
- console startvm, ssh initiated at savestate
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Google your Q site:VirtualBox.org or search for the answer before posting.