1

I am trying to use VBoxManage to create and manage CentOS 7 virtual machines on a CentOS 7 server. The commands below first result in the following conflicting statements:

1.) that the virtual machine has been started successfully,
2.) but then there are no virtual machines listed when a command is subsequently given to list running VMs.
3.) And then a further command to describe the new virtual machine states that it is not running, and that it does not have an operating system.

The boot sequence involves starting an installation of CentOS into the virtual machine from a DVD that is in the dvd drive. So how do I modify the VBoxManage code below to trigger the installation of CentOS 7 into a virtual machine in a terminal-only installation of a CentOS 7 host OS? I imagine the answer is the same for any Linux OS, because this is VBoxManage code.

Here is what I have typed so far, without throwing any errors:

[root@localhost ~]# VBoxManage createvm --name "testvm" --register    
[root@localhost ~]# VBoxManage storagectl testvm --name "IDE Controller" --add ide
[root@localhost ~]# VBoxManage createhd --filename testvm.vdi --size 500000
[root@localhost ~]# VBoxManage storageattach testvm --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium testvm.vdi 
[root@localhost ~]# VBoxManage modifyvm testvm –boot1 dvd
[root@localhost ~]# VBoxManage startvm testvm  
Waiting for VM "testvm" to power on...
VM "testvm" has been successfully started.
[root@localhost home]# VBoxManage list runningvms
[root@localhost home]# VBoxManage showvminfo testvm
Name:            testvm
Groups:          /
Guest OS:        Other/Unknown
UUID:            00c5408d-6394-4baa-af27-9e52203db029
Config file:     /root/VirtualBox VMs/testvm/testvm.vbox
Snapshot folder: /root/VirtualBox VMs/testvm/Snapshots
Log folder:      /root/VirtualBox VMs/testvm/Logs
Hardware UUID:   00c5408d-6394-4baa-af27-9e52203db029
Memory size:     128MB
Page Fusion:     off
VRAM size:       8MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
PAE:             on
Long Mode:       on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): DVD
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          off
Time offset:     0ms
RTC:             local time
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Default
State:           powered off (since 2015-09-29T00:09:23.000000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration: 
Autostart Enabled: off
Autostart Delay: 0
Default Frontend: 
Storage Controller Name (0):            IDE Controller
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
IDE Controller (0, 0): /root/testvm.vdi (UUID: f6eef452-6003-47a5-ad89-fcd973a52304)
NIC 1:           disabled
NIC 2:           disabled
NIC 3:           disabled
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
LPT 1:           disabled
LPT 2:           disabled
Audio:           disabled
Clipboard Mode:  disabled
Drag and drop Mode: disabled
VRDE:            disabled
USB:             disabled
EHCI:            disabled
XHCI:            disabled

USB Device Filters:

<none>

Bandwidth groups:  <none>

Shared folders:  <none>

Video capturing:    not active
Capture screens:    0
Capture file:       /root/VirtualBox VMs/testvm/testvm.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25

Guest:

Configured memory balloon size:      0 MB


[root@localhost home]# 
2

Yes, a VM is "started" when it is running any code, BIOS, boot, OS or user.

You selected -boot1 dvd but didn't put any virtual DVD drive in your VM. You need to storageattach a virtual DVD to an .iso file or to a real (host) DVD drive with a real DVD. For CentOS 7 obviously you want a CentOS 7 installer DVD/image. Once you have the installer running IME it needs a (virtual) display; if you have no display on the server, but can connect from a machine with one, you can use VRDP, if you have the "extension pack" installed. This is explained (somewhat briefly) in sections 7.1.1-3 of the VirtualBox manual (online at http://www.virtualbox.org/manual/UserManual.html if you don't have it locally).

If you don't have a virtual display using either a real display or VRDP, I think you'll need a CentOS installer (and a resulting installed system) that runs "headless", using a virtual serial port connected to what it thinks is a terminal which is actually some emulation you use. You're on your own there. It might be easier to build the VM and instal CentOS in it on a machine with a display, get it to work without the display (probably with everything over ssh), and then export/import the VM to the server where you want to run it.

  • Thank you. I showed code in my OP. Can you please show code in your answer? Specifically, the steps around your storageattach suggestion. Also, if I create the virtual machines on my devbox using the GUI. what specifically would I be transferring from the devbox to the development server via ssh? – CodeMed Sep 30 '15 at 22:10
  • @CodeMed the example in the manual is VBoxManage storageattach (yourvmname) --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium /full/path/to/iso.iso. For a host drive, 8.18 says to use --medium host:<drive>. I don't have host CentOS, but on a virtual CentOS6 drive is /dev/dvd1 or /dev/sr0. The export subcommand creates a compressed, standardized form of the VM files which you copy and import at the destiation; scp is a good way to copy over ssh. – dave_thompson_085 Oct 2 '15 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.