Date: Tue, 4 Feb 2014 20:39:26 -0300 From: Mario Lobo <lobo@bsd.com.br> To: freebsd-emulation@freebsd.org Subject: Fw: VirtualBox 4.3.6 headless startup script (WAS:keyboard repeats keystrokes) Message-ID: <20140204203926.45115b26@Papi>
next in thread | raw e-mail | index | archive | help
FYI Sorry! Forgot to reply to the list. My bad. -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since 2.2.8 [not Pro-Audio.... YET!!] (99% winblows FREE) "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." Begin forwarded message: Date: Tue, 4 Feb 2014 20:26:16 -0300 From: Mario Lobo <lobo@bsd.com.br> To: Aryeh Friedman <aryeh.friedman@gmail.com> Subject: Re: VirtualBox 4.3.6 headless startup script (WAS:keyboard repeats keystrokes) On Tue, 4 Feb 2014 17:30:07 -0500 Aryeh Friedman <aryeh.friedman@gmail.com> wrote: > On Tue, Feb 4, 2014 at 5:24 PM, Mario Lobo <lobo@bsd.com.br> wrote: > > > On Tue, 4 Feb 2014 04:58:28 -0500 > > Aryeh Friedman <aryeh.friedman@gmail.com> wrote: > > > > [snip..] > > > > > > > >... the > > > other option is vbox but I simply can't figure out how to run it > > > headless (from a boot script specifically) this combined with the > > > fact that unclear from Oracle's documentation if such a mode is > > > possible > > > > Aryeh; > > > > Could you elaborate more on that?. I ask this because I've been > > running different windows vbox vms on a freeBSD host, no X installed > > (initially) , and they boot headless whenever the server boots. I > > created service scripts to start/stop them from /usr/local/etc/rc.d. > > > > I said initially because I wasn't too akin to creating VMs from > > command line, and opted for the vbox qt GUI to create them. > > > > Last summer when I was attempting to do a ground up install of open > stack (something that later provided impossible due to outright > errors and missing information in the openstack manuals and that and > the testing requirements of an other project lead to petitecloud) I > did so (at least for the first few attempts) use vbox and every time > I tried to run a client headless after I installed it with -gui it > refused to start (windows much more often linux but both did the > same)... I was never able to get a full working fbsd boot->vbox > boot->vm box sequence working automatically (I also knew a lot less > about virtualization then so it might be just confused memory that > makes me believe this is not possible)... either way if you can > either send me the scripts or post them and I can intergrate them > into petitecloud I will be asking about how to send you $50. Sure thing, Aryeh ! I'll share to the list so everyone can benefit from it, if useful. I created the script x-vms (bellow) and placed it in /usr/local/etc/rc.d. Added the line "vms_anable=YES" to /etc/rc.conf In our environment, the script starts (after network REQUIRE) 4 different VMs: W2008, PfSense, W7 and W2012. For the shutdown, the VM OSes must "respect" the ACPI command. These four do, but I've come across some that didn't. 3 of the VMs have RDP/VNC disabled so the only way to access them is via the OS mechanisms (RDP/web interface) The win7 VM, I enabled VBOX vnc interface on the host, by running these: VBoxManage setproperty vrdeextpack VNC VBoxManage modifyvm Win7 --vrdeproperty VNCPassword=whatever VBoxManage modifyvm Win7 --vrdeproperty VNCAddress4=172.16.3.1 VBoxManage modifyvm Win7 --vrdeproperty VNCPort4=5901 VBoxManage modifyvm Win7 --vrdeauthlibrary null which actually adds this to the VM config file: <RemoteDisplay enabled="true" authType="Null" authTimeout="5000" authLibrary="null"> <VRDEProperties> <Property name="TCP/Address" value="172.16.3.1"/> <Property name="TCP/Ports" value="5901"/> <Property name="VNCPassword" value="whatever"/> </VRDEProperties> </RemoteDisplay> I did this because a needed to access the VM from outside its internal interface methods. There is one thing that I should mention, which probably has more to do with X-forwarding in ssh than with Vbox. When all the VMs are running and I ssh to the FBSD host, I start up the qt GUI (VirtualBox). It comes up fine. I can create and do everything from it EXCEPT start any machine. If I try to start (to see/test if it comes up fine), it complains tha it could no allocate an X session for it. But if I close VirtualBox GUI and start the machine from VBoxSDL, it comes up fine !! Well, there you have it. As for the $50, if what I posted proves useful to you, please save it! If we ever meet some day, a nice cold beer for both of us will be on you :) ! Best wishes, -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since 2.2.8 [not Pro-Audio.... YET!!] (99% winblows FREE) "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." [ script x-vms ]================================== #!/bin/sh # # # PROVIDE: vms # REQUIRE: DAEMON pf # KEYWORD: shutdown . /etc/rc.subr name="vms" rcvar=${name}_enable start_cmd="vms_start" stop_cmd="vms_stop" vms_start() { echo "Starting VMs." /usr/X11R6/bin/VBoxHeadless -startvm vrecallen24 --vrde off & /usr/X11R6/bin/VBoxHeadless -startvm pfSense --vrde off & /usr/X11R6/bin/VBoxHeadless -startvm Win7 & /usr/X11R6/bin/VBoxHeadless -startvm Win2012 --vrde off& } vms_stop() { echo "Shutdown VMs." /usr/X11R6/bin/VBoxManage controlvm vrecallen24 acpipowerbutton /usr/X11R6/bin/VBoxManage controlvm pfSense acpipowerbutton /usr/X11R6/bin/VBoxManage controlvm Win7 acpipowerbutton /usr/X11R6/bin/VBoxManage controlvm Win2012 acpipowerbutton } load_rc_config $name run_rc_command "$1" =========================================================
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140204203926.45115b26>