VirtualBox Commands

If you are new to  VirtaulBox then the below commands will  help you to gather information and control your VM’s :

How to show the VirtualBox VM info
[email protected][#] VBoxManage showvminfo <vmname>

for example

[email protected][#] VBoxManage showvminfo vm1
How to show the VM Harddrive info
[email protected][#] VBoxManage showhdinfo <filename>

for example

[email protected][#] VBoxManage showhdinfo vm1.vdi
How to list running VM
[email protected][#] VBoxManage list runningvms
How to list available VM
[email protected][#] VBoxManage list vms
How to list available VM Harddrives
[email protected][#] VBoxManage list hdds
How to list available ISO’s
[email protected][#] VBoxManage list dvds

How to Control VM

How to Start VM

 use nohup command and & to run process in background,
 so VM continues to run after exiting console.
[email protected][#] nohup VBoxHeadless --startvm <vmname> &

for example

[email protected][#] nohup VBoxHeadless --startvm vm1 &
How to pause VM
[email protected][#] VBoxManage controlvm <vmname> pause

for example

[email protected][#] VBoxManage controlvm vm1 pause

How to resume VM

[email protected][#] VBoxManage controlvm <vmname> resume

for example

[email protected][#] VBoxManage controlvm vm1 resume

How to reset VM

[email protected][#] VBoxManage controlvm <vmname> reset

for example

[email protected][#] VBoxManage controlvm vm1 reset

How to poweroff VM (hard poweroff eg. pull the plug)

[email protected][#] VBoxManage controlvm <vmname> poweroff

for example

[email protected][#] VBoxManage controlvm vm1

How to send poweroff single to VM (tells VM OS to shutdown)

[email protected][#] VBoxManage controlvm <vmname> acpipowerbutton

for example

[email protected][#] VBoxManage controlvm vm1 acpipowerbutton

How to attach a DVD / CD to a running vm

[email protected][#] VBoxManage controlvm <vmname> dvdattach <filename>

for example

[email protected][#] VBoxManage controlvm vm1 dvdattach CentOS-5.7-i386-bin-DVD-1of2.iso

How to de-attach a DVD / CD from a running vm

[email protected][#] VBoxManage controlvm <vmname> dvdattach none

for exampe

[email protected][#] VBoxManage controlvm vm1 dvdattach none

How to find out the VM IP

[email protected][#] VBoxManage guestproperty get <vmid>"/VirtualBox/GuestInfo/Net/0/V4/IP"

for example

[email protected][#] VBoxManage guestproperty get vm1  "/VirtualBox/GuestInfo/Net/0/V4/IP"

R1soft Kernel header error

While installing kernel package using the command 

/usr/bin/r1soft-setup --get-module

if you came across the  below errors :  

Unable to find a valid source directory.
Please install the kernel headers for 
your operating system.

Then don't panic  this can simply be resolved
 by running the below commands 
[email protected][#] yum install kernel-devel kernel-headers 

If you are running PAE kernel 

[email protected][#] yum install kernel-PAE-devel  

If you are running xen kernels 

[email protected][#]yum install kernel-xen-devel  
If you are running one of the beta kernels then,
 add --enablerepo=cloudlinux-updates-testing
 at the end of yum command, like this: 

yum install kernel-devel --enablerepo=cloudlinux-updates-testing 

Now, just re-execute the command : 
/usr/bin/r1soft-setup --get-module

That’s all.

How to disable SSH reverse mapping checking

If you want to disable reverse mapping checking getaddrinfo while connecting to a remote server via SSH then there two options :

 

local : /etc/hosts

 

If you want to resolve this locally then all you need to do is to add an entry for the remote host in the /etc/hosts file as :

 
[email protected][#] vi /etc/hosts 

Add the below line 

10.10.10.10 server.remotehost.com  save and quit.

 

remote : /etc/ssh/sshd_config

 

open the /etc/ssh/sshd_config file and then locate the entry

 

GSSAPI options

 

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

In the above entries you need to commend the line

 

GSSAPIAuthentication yes

to disable the reverse mapping authentication for SSH

 

#GSSAPIAuthentication yes

and then restart the sshd service

 

That’s all you are done.