From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EZoPq-0003sb-Pd for qemu-devel@nongnu.org; Wed, 09 Nov 2005 06:46:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EZoPn-0003sG-F3 for qemu-devel@nongnu.org; Wed, 09 Nov 2005 06:46:57 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZoPl-0003sB-3Q for qemu-devel@nongnu.org; Wed, 09 Nov 2005 06:46:54 -0500 Received: from [62.27.20.150] (helo=koniczek.de) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EZoPk-0001BV-OY for qemu-devel@nongnu.org; Wed, 09 Nov 2005 06:46:53 -0500 Received: from [192.168.1.156] (p54AD3C82.dip0.t-ipconnect.de [84.173.60.130]) (authenticated bits=0) by koniczek.de (8.13.5/8.13.5) with ESMTP id jA9Bklgq030307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 9 Nov 2005 12:46:48 +0100 Message-ID: <4371E1A0.9040402@koniczek.de> Date: Wed, 09 Nov 2005 12:46:40 +0100 From: Martin Koniczek MIME-Version: 1.0 Subject: Re: [Qemu-devel] Login a guest use commandline References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org zheng sw wrote: > when I run the command in bash: > "sudo qemu -hda testaa.img -boot c -localtime -serial stdio -pidfile > pidfile1.txt && sleep 300 && root && 123456 && ifconfig" > > root is the guest's user, 123456 is password, > Why can't I login in the guest and run the ifconfig? and run you intend to queue commands to be executed within the qemu guest? && is not suitable for "entering commands", it is a sh/bash control operator (which executes whatever comes after && if the previous command returned true, read "man bash" to learn more about this) furthermore, what you intent to do seems to rely on a linux guest kernel where kernel console (and login shell like agetty) is redirected to ttyS0, so make sure your guests kernel configuration and /etc/inittab are set up properly. but even if you "correctly" pipe commands to your linux guest, i doubt you get the results you want - agetty clears any stdinput before the password prompt etc, so you'd need an "interactive" script to parse stdin and generate stdout (from remote controls script view), for example "expect", see "man expect" and if you expect to interact on the serial console after your "startup commands", you would be lost with classical piping anyway. perhaps screen helps you there? see "man screen" if what you showed in your example is really what you want to to, how about a simple script within the guest executed in the end of the startup process, which shows you the current ifconfig? (see your guests /etc/rc* scripts for that) running sshd in the guest and queing commans via ssh is of course the most stable (and not-qemu-specific) solution, but required correctly set-up networking between guest and qemu. sincerly, martin koniczek