From owner-freebsd-emulation@FreeBSD.ORG Mon Jun 25 09:08:29 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01B671065674; Mon, 25 Jun 2012 09:08:29 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) by mx1.freebsd.org (Postfix) with ESMTP id AF9DF8FC19; Mon, 25 Jun 2012 09:08:28 +0000 (UTC) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 15D9928427; Mon, 25 Jun 2012 10:58:58 +0200 (CEST) Received: from [192.168.1.2] (static-84-242-120-26.net.upcbroadband.cz [84.242.120.26]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 0F10828423; Mon, 25 Jun 2012 10:58:57 +0200 (CEST) Message-ID: <4FE82850.6020104@quip.cz> Date: Mon, 25 Jun 2012 10:58:56 +0200 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1.19) Gecko/20110420 Lightning/1.0b1 SeaMonkey/2.0.14 MIME-Version: 1.0 To: freebsd-emulation@freebsd.org Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-rc@FreeBSD.org Subject: rc.d/vboxheadless doesn't show running VMs X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 09:08:29 -0000 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