How to use the command 'vboxmanage-startvm' (with examples)
The vboxmanage-startvm
command is used to start a virtual machine in Oracle VM VirtualBox. This command allows you to start a virtual machine with various options, such as specifying the UI mode, providing a password file or ID for encrypted virtual machines, and defining environment variables.
Use case 1: Start a virtual machine
Code:
VBoxManage startvm vm_name|uuid
Motivation:
- This use case is useful when you want to start a specific virtual machine.
Explanation:
vm_name|uuid
: Specifies either the name or UUID of the virtual machine you want to start.
Example output:
- The specified virtual machine will start and its console will appear.
Use case 2: Start a virtual machine with the specified UI mode
Code:
VBoxManage startvm vm_name|uuid --type headless|gui|sdl|separate
Motivation:
- This use case is useful when you want to define the UI mode in which the virtual machine should start.
Explanation:
vm_name|uuid
: Specifies either the name or UUID of the virtual machine you want to start.--type
: Specifies the UI mode in which the virtual machine should start. Options include:headless
: Starts the virtual machine without a visible user interface.gui
: Starts the virtual machine with the GUI.sdl
: Starts the virtual machine with SDL (Simple DirectMedia Layer) graphical output.separate
: Starts the virtual machine in a separate window.
Example output:
- The specified virtual machine will start in the specified UI mode.
Use case 3: Specify a password file to start an encrypted virtual machine
Code:
VBoxManage startvm vm_name|uuid --password path/to/password_file
Motivation:
- This use case is useful when you want to start an encrypted virtual machine that requires a password.
Explanation:
vm_name|uuid
: Specifies either the name or UUID of the encrypted virtual machine you want to start.--password
: Specifies the path to the password file containing the password for the encrypted virtual machine.
Example output:
- The specified virtual machine will start after providing the password from the specified password file.
Use case 4: Specify a password ID to start an encrypted virtual machine
Code:
VBoxManage startvm vm_name|uuid --password-id password_id
Motivation:
- This use case is useful when you want to start an encrypted virtual machine that requires a password ID.
Explanation:
vm_name|uuid
: Specifies either the name or UUID of the encrypted virtual machine you want to start.--password-id
: Specifies the password ID for the encrypted virtual machine.
Example output:
- The specified virtual machine will start after providing the password associated with the specified password ID.
Use case 5: Start a virtual machine with an environment variable pair name value
Code:
VBoxManage startvm vm_name|uuid --put-env=name=value
Motivation:
- This use case is useful when you want to start a virtual machine with specific environment variables.
Explanation:
vm_name|uuid
: Specifies either the name or UUID of the virtual machine you want to start.--put-env
: Specifies the environment variable pair in the formatname=value
.
Example output:
- The specified virtual machine will start with the specified environment variable set.
Conclusion
The vboxmanage-startvm
command provides several options to start a virtual machine in Oracle VM VirtualBox. Whether you need to define the UI mode, provide a password for encrypted virtual machines, or set environment variables, this command allows you to customize the starting behavior of your virtual machines.