Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jun 2012 10:58:56 +0200
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        freebsd-emulation@freebsd.org
Cc:        freebsd-rc@FreeBSD.org
Subject:   rc.d/vboxheadless doesn't show running VMs
Message-ID:  <4FE82850.6020104@quip.cz>

next in thread | raw e-mail | index | archive | help
Hi,

I am using VirtualBox-OSE and phpVirtualBox. If I use "Save the machine 
state" from phpVirtualBox and then "Start", the state of the VM is not 
recognized by rc script vboxheadless:

# service vboxheadless status
                   Machine Status
------------------------- ------------
               FreeBSD_one Powered Off
               FreeBSD_two Powered Off
             FreeBSD_three Powered Off
              FreeBSD_four Powered Off
              FreeBSD_five Powered Off
               FreeBSD_six Powered Off
              SmartOs_live Powered Off


But the VM FreeBSD_four is still running:


# /usr/local/bin/VBoxManage showvminfo FreeBSD_four | grep -i state
State:           running (since 2012-06-20T21:30:56.211000000)

# /usr/local/bin/VBoxManage list runningvms
"FreeBSD_four" {14d0f837-bd84-432a-8a8b-ee48b247d3ef}


The FreeBSD_four VM is really running, I can log in to it by ssh.


One problem I found is different PID of running process and in PID file:


# ps auxwww | grep -i vboxheadless
root    61699 200.0  8.6 2228216 2157712  ??  I    Wed11PM 10707:27.35 
/usr/local/lib/virtualbox/VBoxHeadless --comment FreeBSD_four --startvm 
14d0f837-bd84-432a-8a8b-ee48b247d3ef --vrde config


# cat /var/run/vboxheadless_FreeBSD_four.pid
61275


rc script contains this check:


/usr/bin/su ${vmuser} -c "/usr/local/bin/VBoxManage showvminfo 
'${vmname}' >/dev/null" 2>/dev/null

if [ $? != 0 ]; then
     /usr/bin/printf "%20s %s\n" "${vmname}" "Unknown Machine"
elif [ -n "${pid}" ]; then
     /usr/bin/printf "%25s %s\n" "${vmname}" "Running"
else
     /usr/bin/printf "%25s %s\n" "${vmname}" "Powered Off"
fi


Is it really right way to check it? Why not use something, that checks 
real state of the VM reported by

VBoxManage showvminfo FreeBSD_four | grep 'State:'


This is on FreeBSD 8.3-RELEASE amd64 GENERIC with 
virtualbox-ose-4.1.16_1 and phpvirtualbox-4.1.7


Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FE82850.6020104>