From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ea7Z4-00075e-6x for qemu-devel@nongnu.org; Thu, 10 Nov 2005 03:13:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ea7Yy-00074F-FC for qemu-devel@nongnu.org; Thu, 10 Nov 2005 03:13:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ea7Yx-00073t-Ju for qemu-devel@nongnu.org; Thu, 10 Nov 2005 03:13:39 -0500 Received: from [221.122.43.98] (helo=fw.exoweb.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ea7Yw-00078v-J0 for qemu-devel@nongnu.org; Thu, 10 Nov 2005 03:13:39 -0500 Received: from [192.168.0.126] (helo=exo126.exoweb.net ident=shunwen) by fw.exoweb.net with esmtp (Exim 3.36 #1 (Debian)) id 1Ea7Yk-0002p8-00 for ; Thu, 10 Nov 2005 16:13:26 +0800 Subject: Re: [Qemu-devel] Login a guest use commandline From: shunwen In-Reply-To: <4371E1A0.9040402@koniczek.de> References: <4371E1A0.9040402@koniczek.de> Content-Type: text/plain; charset=GB2312 Date: Thu, 10 Nov 2005 16:13:45 +0800 Message-Id: <1131610425.3554.22.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Reply-To: shunwen@exoweb.net, 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 On =C8=FD, 2005-11-09 at 12:46 +0100, Martin Koniczek wrote: > > "sudo qemu -hda testaa.img -boot c -localtime -serial stdio -pidfile > > pidfile1.txt && sleep 300 && root && 123456 && ifconfig" > >=20 >=20 > you intend to queue commands to be executed within the qemu guest? Yes! >=20 > && is not suitable for "entering commands", it is a sh/bash control=20 > operator (which executes whatever comes after && if the previous command=20 > returned true, read "man bash" to learn more about this) I know it now, I make a mistake about it, thank you! >=20 > furthermore, what you intent to do seems to rely on a linux guest kernel=20 > where kernel console (and login shell like agetty) is redirected to=20 > ttyS0, so make sure your guests kernel configuration and /etc/inittab=20 > are set up properly. Yes, I have make the line: #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 in guests kernel available, and it work success in terminal. >=20 > but even if you "correctly" pipe commands to your linux guest, i doubt=20 > you get the results you want - agetty clears any stdinput before the=20 > password prompt etc, so you'd need an "interactive" script to parse=20 > stdin and generate stdout (from remote controls script view), for=20 > example "expect", see "man expect" This is the substance of the problem should solved. So I use a nonBlockingIO script to do it. (If anyone interested in it, I can send she/her the script) Thank you for you suggest. >=20 > and if you expect to interact on the serial console after your "startup=20 > commands", you would be lost with classical piping anyway. perhaps=20 > screen helps you there? see "man screen" I have try it, but it's no help to me. Beause I must use program.=20 >=20 > if what you showed in your example is really what you want to to, how=20 > about a simple script within the guest executed in the end of the=20 > startup process, which shows you the current ifconfig? (see your guests=20 > /etc/rc* scripts for that) This way I also bethink of, But the problem is the guest don't know the host IP. and the host IP is no static. >=20 > running sshd in the guest and queing commans via ssh is of course the=20 > most stable (and not-qemu-specific) solution, but required correctly=20 > set-up networking between guest and qemu. My net work is work. I use TUN/TAP, bridge-util, DHCP. and it work ok. >=20 > sincerly, > martin koniczek Thank you very muck Best regards Zheng SW