Howto boot images in virtualbox using parameters or config files

This is for discussing general topics about how to use VirtualBox.
Post Reply
cesarjorgemartinez
Posts: 17
Joined: 7. Jul 2016, 11:53

Howto boot images in virtualbox using parameters or config files

Post 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
Last edited by cesarjorgemartinez on 27. Sep 2017, 15:19, edited 1 time in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Howto boot images in virtualbox using parameters or config files

Post 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.
cesarjorgemartinez
Posts: 17
Joined: 7. Jul 2016, 11:53

Re: Howto boot images in virtualbox using parameters or config files

Post 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
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Howto boot images in virtualbox using parameters or config files

Post 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.
cesarjorgemartinez
Posts: 17
Joined: 7. Jul 2016, 11:53

Re: Howto boot images in virtualbox using parameters or config files

Post 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
Post Reply