1

Short Version

I want to run Qemu on a remote machine using ssh. With this command I am able to see some boot messages but I can't manage to get vm the login prompt in my local terminal.

qemu-system-i386 -m 128 
-kernel bzImage -drive file=rootfs.ext2,if=virtio 
-append "console=ttyS0" 
-net nic,model=virtio 
-net user 
-nographic

I've also tried with -curses without success

Long Version

I have a raspberry with TinyCore where I want to run (using SSH) a BuildRoot distro on qemu.

When I run qemu locally (without SSH)

  • using -nographic, I can see some boot messages and nothing else
  • Using -curses, I see VGA Graphic Mode, then some boot messages and then it shows 1024 x 768 Graphic Mode and I can't interact with it anymore

When I run qemu remotely (with SSH) I can only see the boot messages and nothing else.

I don't want to use VNC, how can I do this?

EDIT:

On the remote host machine (piCore) I have this in /etc/inittab

tty1::respawn:/sbin/getty -nl /sbin/autologin 38400 tty1

And on the remote guest machine I have this in /etc/inittab

tty1::respawn:/sbin/getty -L tty1 0 vt100 
  • It’s not curses, but with -nographic the guest console is redirected to stdio. – phg Nov 25 '16 at 15:35
  • Hi, I've seen many suggesting both as possible solutions (here and here). Anyway, with -nographic or -curses passing -append "console=ttyS0" I can see some boot messages but still no login prompt. If I remove -curses` or -nographic I can see the login prompt, but I have to use VNC. – Devid Farinelli Nov 25 '16 at 15:48
  • 1
    Are you starting a getty on /dev/ttyS0 in the VM in the first place? – Stéphane Chazelas Nov 25 '16 at 16:03
  • Hi, I think the instruction that starts a getty is in /etc/inittab (I am not experienced on this, I may be wrong), so I have updated the question with the inittab of the remote host and guest. I have already tried -nographic -append "console=tty1" but It doesn't show any output. – Devid Farinelli Nov 25 '16 at 16:37
  • 1
    ttyS0 is the serial device. You do want the console to go there and you need a getty on it if you want to login on that virtual serial port. You don't need the tty1 line if you don't add a graphics card to that VM. – Stéphane Chazelas Nov 25 '16 at 16:51
3
+50

With -nographic, qemu doesn't add a virtual graphics card to the VM, still adds a serial controller but with the serial port connected to qemu's stdin/stdout (as opposed to a SDL window when not using -nographics).

You're telling the Linux kernel booted in that VM to send its console output to the serial port which is good, but if you also want to have a login prompt there, you need to have a getty issue it there.

So, you need to add a line for it in your inittab (or other relevant configuration file depending on which init system is being used in the VM):

ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100

Since that VM doesn't have a graphics card, you can also remove the tty1 line which is only for a virtual VGA terminal.

  • This works, thanks!! I've compiled buildroot setting: TTY Port = ttyS0, baudrate = 115200 and Terminal Environment = v100 in System Configs > Run getty login.. – Devid Farinelli Nov 25 '16 at 18:56
0

I think you want to use X11 tunneling with SSH.

Try to run "ssh -X -Y user@remot_host".

Then check the variable DISPLAY is defined : "echo $DISPLAY"

If this does not work, you should check the configuration of your sshd daemon in "/etc/ssh/sshd_config" on your serving host. Edit it in order to allow X11 forwarding, then restart your sshd daemon.

Run "xclock" to check whether X is tunneled.

Then QEMU should show its window on the client side of ssh.

  • I'm gonna try this and let you know, thanks! – Devid Farinelli Nov 25 '16 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.