From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MxwAZ-0002Yw-Q4 for qemu-devel@nongnu.org; Wed, 14 Oct 2009 01:13:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MxwAU-0002XV-Pu for qemu-devel@nongnu.org; Wed, 14 Oct 2009 01:13:02 -0400 Received: from [199.232.76.173] (port=45492 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxwAU-0002XL-HY for qemu-devel@nongnu.org; Wed, 14 Oct 2009 01:12:58 -0400 Received: from 217-162-29-130.static.cablecom.ch ([217.162.29.130]:58612 helo=x41.ch) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxwAU-0006Rv-2T for qemu-devel@nongnu.org; Wed, 14 Oct 2009 01:12:58 -0400 Received: from [193.201.33.73] (account bolle@geodb.org) by x41.ch (CommuniGate Pro WebUser 5.0.10) with HTTP id 1432056 for qemu-devel@nongnu.org; Wed, 14 Oct 2009 07:12:56 +0200 From: "Bolle" Date: Wed, 14 Oct 2009 07:12:56 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] Re: Starting QEMU by PHP/Apache List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org qemu-devel@nongnu.org Re: Starting QEMU by PHP/Apache Hello all First, I forgot to say, that I use the QEMU stable version 11.0 on a Gentoo box. I did some more testings. The QEMU instance is starting and sometimes the OS starts to load, but then QEMU stucks and consumes 100% CPU. I checked the startup it with strace. The start of QEMU itself produces the same output in strace, regardless if started by the PHP CLI or by mod_php from Apache. I then attached strace to the QEMU process, and there is a big difference. When starting QEMU with the PHP script from the CLI (as the same user as the web server), it works and I get something like that: ... select(12, [6 11], [], [], {4, 993369}) = ? ERESTARTNOHAND (To be restarted) --- SIGALRM (Alarm clock) @ 0 (0) --- write(7, "\0"..., 1) = 1 sigreturn() = ? (mask now []) clock_gettime(CLOCK_MONOTONIC, {2818001, 146485529}) = 0 clock_gettime(CLOCK_MONOTONIC, {2818001, 146548886}) = 0 timer_gettime(0, {it_interval={0, 0}, it_value={0, 0}}) = 0 timer_settime(0, 0, {it_interval={0, 0}, it_value={0, 250000}}, NULL) = 0 clock_gettime(CLOCK_MONOTONIC, {2818001, 146758750}) = 0 clock_gettime(CLOCK_MONOTONIC, {2818001, 146819115}) = 0 clock_gettime(CLOCK_MONOTONIC, {2818001, 146879549}) = 0 clock_gettime(CLOCK_MONOTONIC, {2818001, 146938839}) = 0 --- SIGALRM (Alarm clock) @ 0 (0) --- write(7, "\0"..., 1) = 1 sigreturn() = ? (mask now []) ... If QEMU has been started by the web server with the same script and user, I get: ... select(11, [5 10], [], [], {3, 767239}) = 0 (Timeout) clock_gettime(CLOCK_MONOTONIC, {2817617, 818297714}) = 0 clock_gettime(CLOCK_MONOTONIC, {2817617, 818382772}) = 0 clock_gettime(CLOCK_MONOTONIC, {2817617, 818444894}) = 0 timer_gettime(0, {it_interval={0, 0}, it_value={0, 0}}) = 0 timer_settime(0, 0, {it_interval={0, 0}, it_value={0, 250000}}, NULL) = 0 clock_gettime(CLOCK_MONOTONIC, {2817617, 818698197}) = 0 clock_gettime(CLOCK_MONOTONIC, {2817617, 818759263}) = 0 timer_gettime(0, {it_interval={0, 0}, it_value={0, 67453}}) = 0 clock_gettime(CLOCK_MONOTONIC, {2817617, 818894002}) = 0 clock_gettime(CLOCK_MONOTONIC, {2817617, 818954673}) = 0 timer_gettime(0, {it_interval={0, 0}, it_value={0, 0}}) = 0 timer_settime(0, 0, {it_interval={0, 0}, it_value={0, 250000}}, NULL) = 0 ... There are no SIGALRM executed. What can be the reason for that ? Andreas On Tue, 13 Oct 2009 13:26:25 +0200 "Bolle" wrote: > Hello > > Did anybody had success to start a QEMU instance by a >PHP script under the Apache web server ? > > I allow the Apache user with the help of sudoers to >start the QEMU binary as root. I've hacked the >"qemu-socket.c" to set the access mode to allow >communication for the monitor socket (only add >"chmod(path, )"). > > I'm able to successfully start the QEMU instance from a >PHP CLI script as the user under which Apache is running >like "sudo -u sudo ". But when >I run the same script by the web server, QEMU starts up >to the BIOS, telling me to press F12 for a start device. >The "info cpus" tells "CPU #0: pc=0x000f08b5 (halted)". > > The full command executed by PHP is: > /usr/bin/sudo /usr/bin/qemu -L /usr/share/qemu -M isapc >-m 16 -hda -net none -serial >none -parallel none -vnc :0,password -monitor >unix:,server,nowait -name "QEMU >TEST" -pidfile -chroot > -runas > /dev/null & > > Any idea about where to look for more information ? > > Andreas