【VM】VirtualBox

Posted by 西维蜀黍 on 2022-02-26, Last Modified on 2023-05-02

Observing Existing Virtual Machines

$ VBoxManage list vms
"default" {48f22168-64fb-4ebd-85c4-d6e2a753ca5a}
"mymachine" {1e49ad7e-1c9f-4ae2-bcf3-236dc94c258a}

To view the VMs that are running at the moment,

$ VBoxManage list runningvms
"default" {48f22168-64fb-4ebd-85c4-d6e2a753ca5a}

The VBoxManage list command can be used with option -l,

$ VBoxManage list runningvms -l
Name:                        default
Groups:                      /
Guest OS:                    Linux 2.6 / 3.x / 4.x (64-bit)
UUID:                        48f22168-64fb-4ebd-85c4-d6e2a753ca5a
Config file:                 /Users/shiwei/.docker/machine/machines/default/default/default.vbox
Snapshot folder:             /Users/shiwei/.docker/machine/machines/default/default/Snapshots
Log folder:                  /Users/shiwei/.docker/machine/machines/default/default/Logs
Hardware UUID:               48f22168-64fb-4ebd-85c4-d6e2a753ca5a
Memory size:                 1024MB
Page Fusion:                 disabled
VRAM size:                   8MB
CPU exec cap:                100%
HPET:                        enabled
CPUProfile:                  host
Chipset:                     piix3
Firmware:                    BIOS
Number of CPUs:              1
PAE:                         enabled
Long Mode:                   enabled
Triple Fault Reset:          disabled
APIC:                        enabled
X2APIC:                      disabled
Nested VT-x/AMD-V:           disabled
CPUID Portability Level:     0
CPUID overrides:             None
Boot menu mode:              disabled
Boot Device 1:               DVD
Boot Device 2:               DVD
Boot Device 3:               HardDisk
Boot Device 4:               Not Assigned
ACPI:                        enabled
IOAPIC:                      enabled
BIOS APIC mode:              APIC
Time offset:                 0ms
RTC:                         UTC
Hardware Virtualization:     enabled
Nested Paging:               enabled
Large Pages:                 enabled
VT-x VPID:                   enabled
VT-x Unrestricted Exec.:     enabled
Paravirt. Provider:          Default
Effective Paravirt. Prov.:   KVM
State:                       running (since 2022-02-26T14:30:05.602000000)
Graphics Controller:         VBoxVGA
Monitor count:               1
3D Acceleration:             disabled
2D Video Acceleration:       disabled
Teleporter Enabled:          disabled
Teleporter Port:             0
Teleporter Address:
Teleporter Password:
Tracing Enabled:             disabled
Allow Tracing to Access VM:  disabled
Tracing Configuration:
Autostart Enabled:           disabled
Autostart Delay:             0
Default Frontend:
VM process priority:         default
Storage Controller Name (0):            SATA
Storage Controller Type (0):            IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  30
Storage Controller Port Count (0):      30
Storage Controller Bootable (0):        on
SATA (0, 0): /Users/shiwei/.docker/machine/machines/default/boot2docker.iso (UUID: eff75843-dac4-41a5-b810-708d7b031153)
SATA (1, 0): /Users/shiwei/.docker/machine/machines/default/disk.vmdk (UUID: 1306dcf0-f81f-4d47-b2be-8daf2e590978)
NIC 1:                       MAC: 0800276AB7B7, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = dockerdaemon, protocol = tcp, host ip = 127.0.0.1, host port = 2376, guest ip = , guest port = 2376
NIC 1 Rule(1):   name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 64094, guest ip = , guest port = 22
NIC 2:                       MAC: 080027D52D1B, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 3:                       MAC: 08002756FC5E, Attachment: Bridged Interface 'en0: Ethernet', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 4:                       disabled
NIC 5:                       disabled
NIC 6:                       disabled
NIC 7:                       disabled
NIC 8:                       disabled
Pointing Device:             PS/2 Mouse
Keyboard Device:             PS/2 Keyboard
UART 1:                      disabled
UART 2:                      disabled
UART 3:                      disabled
UART 4:                      disabled
LPT 1:                       disabled
LPT 2:                       disabled
Audio:                       enabled (Driver: CoreAudio, Controller: AC97, Codec: STAC9700)
Audio playback:              disabled
Audio capture:               disabled
Clipboard Mode:              disabled
Drag and drop Mode:          disabled
Session name:                headless
VRDE:                        disabled
OHCI USB:                    disabled
EHCI USB:                    disabled
xHCI USB:                    disabled

USB Device Filters:

<none>

Bandwidth groups:  <none>

Shared folders:

Name: 'Users', Host path: '/Users' (machine mapping), writable, auto-mount

Capturing:                   not active
Capture audio:               not active
Capture screens:             0
Capture file:                /Users/shiwei/.docker/machine/machines/default/default/default.webm
Capture dimensions:          1024x768
Capture rate:                512kbps
Capture FPS:                 25kbps
Capture options:

Guest:

Configured memory balloon size: 0MB

Start a VM

$ VBoxManage startvm debian --type headless

Starting the Autostart Service With launchd

On Mac OS X, launchd is used to start the Oracle VM VirtualBox autostart service. An example configuration file can be found in /Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist. To enable the service copy the file to /Library/LaunchDaemons and change the Disabled key from true to false.

Refer to https://docs.oracle.com/en/virtualization/virtualbox/6.0/admin/autostart.html

Enable Virtual Machine Autostart

As a user, you can enable autostart for individual machines. This requires that you define the path to the database directory first.

VBoxManage setproperty autostartdbpath /etc/vbox/

Once that is done, you can now setup the virtual machine to automatically start on system boot.

vboxmanage modifyvm fedora30 --autostart-enabled on

Where fedora30 is the UUID or the name of your virtual machine.

Install Linux (e.g., Ubuntu/Debian) in VirtualBox

Refer to https://brb.nci.nih.gov/seqtools/installUbuntu.html

Reference