Page 1 of 1
Howto boot images in virtualbox using parameters or config files
Posted: 27. Sep 2017, 13:58
by cesarjorgemartinez
Hi,
I have a vdi image in VirtualBox (linux image in my case, and my host is Windows 7).
Then sometimes I need to boot (using command line VBoxManage start in headless mode) using a script from the host, but using specific configuration, or using other boot parameters that default, or replacing one config file as grub.cfg, etc.
For example, I need to start one vdi using specific kernel parameter (without enter in the console manually providing).
Or, start the VM but overwriting one file in the VM.
Howto do this in VBox if possible?
Regards
Re: Howto boot images in virtualbox using parameters or config files
Posted: 27. Sep 2017, 15:01
by mpack
Why does it have to be one VM? Why not have several different ones?
p.s. Please mention the host, otherwise I don't see how anyone can easily answer questions about scripting.
Re: Howto boot images in virtualbox using parameters or config files
Posted: 27. Sep 2017, 15:14
by cesarjorgemartinez
Hi,
Several VMs require multiply disk space in my PC, and after, is difficult to maintain these multiple images.
My host is a Windows 7, and guest is linux, but I think that if my host is linux if exist a solution then it will look like.
Regards
Re: Howto boot images in virtualbox using parameters or config files
Posted: 28. Sep 2017, 10:15
by mpack
Yes, it takes more disk space - though you can use linked clones.
ISTM maintenance is the same regardless of the method.
In any case, returning to the original question: have a read of the VBoxManage chapter in the user manual (chapter 8). Particular the modifyvm and controlvm commands. You would call these commands from a Windows batch file or Powershell script.
Re: Howto boot images in virtualbox using parameters or config files
Posted: 28. Sep 2017, 16:47
by cesarjorgemartinez
Hi,
Yes, I already have work with scripts.
Specific, I use CygWin (then, I have a great compatibility if not use Windows), and I have built ond module for: start, stop, clone and configure, and drop, one or any machines.
I have come to do a service (starting before network service) that performs other tasks, but this form, only will work for me (not work for all people, and forces to modify standard OS images, and do complex checks: machine is inside VM type, etc).
The only thing I could not get to do, is parameterize the guest OS boot (entering parameters at boot time, but automated), and replace files before boot, from source file in the host, also in a automated form.
For replace files: Can I do that by a second disk?
Ex: I have one VM already created from my image. Then, with one disk containing only one file, in the same location, example /etc/default/grub with my own config, attach this second disk, overwritten the original file?
But I do not know how create that second disk used for configurations
Regards