From: Martin Koniczek <martin@koniczek.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Login a guest use commandline
Date: Wed, 09 Nov 2005 12:46:40 +0100 [thread overview]
Message-ID: <4371E1A0.9040402@koniczek.de> (raw)
In-Reply-To: <f4ca181e0511090140u8d206e4s@mail.gmail.com>
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
next prev parent reply other threads:[~2005-11-09 11:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-09 9:40 [Qemu-devel] Login a guest use commandline zheng sw
2005-11-09 11:46 ` Martin Koniczek [this message]
2005-11-09 22:52 ` Henrik Nordstrom
2005-11-10 8:13 ` shunwen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4371E1A0.9040402@koniczek.de \
--to=martin@koniczek.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.