All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Login a guest use commandline
@ 2005-11-09  9:40 zheng sw
  2005-11-09 11:46 ` Martin Koniczek
  0 siblings, 1 reply; 4+ messages in thread
From: zheng sw @ 2005-11-09  9:40 UTC (permalink / raw)
  To: qemu-devel

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

"sudo qemu -hda testaa.img -boot c -localtime -serial stdio -pidfile
pidfile1.txt && root && 123456 && ifconfig" is same

Is the command like "ssh"?

Thank you!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Login a guest use commandline
  2005-11-09  9:40 [Qemu-devel] Login a guest use commandline zheng sw
@ 2005-11-09 11:46 ` Martin Koniczek
  2005-11-09 22:52   ` Henrik Nordstrom
  2005-11-10  8:13   ` shunwen
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Koniczek @ 2005-11-09 11:46 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Login a guest use commandline
  2005-11-09 11:46 ` Martin Koniczek
@ 2005-11-09 22:52   ` Henrik Nordstrom
  2005-11-10  8:13   ` shunwen
  1 sibling, 0 replies; 4+ messages in thread
From: Henrik Nordstrom @ 2005-11-09 22:52 UTC (permalink / raw)
  To: qemu-devel

On Wed, 9 Nov 2005, Martin Koniczek wrote:

> 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"

expect is the tool in such situations as well.. an expect script can at 
any time drop into interactive mode.

Regards
Henrik

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Login a guest use commandline
  2005-11-09 11:46 ` Martin Koniczek
  2005-11-09 22:52   ` Henrik Nordstrom
@ 2005-11-10  8:13   ` shunwen
  1 sibling, 0 replies; 4+ messages in thread
From: shunwen @ 2005-11-10  8:13 UTC (permalink / raw)
  To: qemu-devel

On 三, 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"
> > 
> 
> you intend to queue commands to be executed within the qemu guest?
Yes!
> 
> && 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)
I know it now, I make a mistake about it, thank you!
> 
> 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.
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.
> 
> 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"
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.
> 
> 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"
I have try it, but it's no help to me. Beause I must use program. 
> 
> 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)
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.
> 
> 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.
My net work is work. I use TUN/TAP, bridge-util, DHCP. and it work ok.
> 
> sincerly,
> 	martin koniczek

Thank you very muck

Best regards
Zheng SW

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-10  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-09  9:40 [Qemu-devel] Login a guest use commandline zheng sw
2005-11-09 11:46 ` Martin Koniczek
2005-11-09 22:52   ` Henrik Nordstrom
2005-11-10  8:13   ` shunwen

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.