Reputation: 125
I have a TinyCore 14 raw image, which I want to run with QEMU in multiple parallel instances as emulation, but not virtualization (because the target systems may lack CPU with virtualization ability).
If I avoid doing anything more advanced than pointing them to their boot image, I can access them with vnc and observe everything that happens in there, no matter if I have TinyCore's x-Server show its minimalist GUI, or if I stick to the console. So far, so good.
But I only need to access the console, that shows up after boot and auto-login is done.
The call to start this currently looks like this:
qemu-system-i386 -drive format=raw,if=virtio,media=disk,readonly=on,file=TinyCore-14.0.img -nographic -serial pty
This allows me to connect with screen after it started up:
screen /dev/pts/0
It's output looks a bit strange, but is usable.
If I enter the boot options and place a "console=ttyS0" at the boot parameters, I can observe the boot messages inside that screen:
Booting Core 14.0
unning Linux Kernel 6.1.2-tinycore.
Checking boot options... Done.
Starting udev daemon for hotplug support... Done.
Scanning hard disk partitions to create /etc/fstab
Setting Language to C Done.
Possible swap partition(s) enabled.
Loading extensions... Done.
Setting keymap to us Done.
Setting hostname to box Done.
login[416]: root login on 'tty1'
And... that's it. For reasons unknown to me, I cannot access that tty1 in any way. Happens too, if I replace pty with stdio, so it shows up in the terminal I used to enter the startup command. But there too it will not get past that "root login on 'tty1' " message.
I tried to connect to other pts ports (nope), used other means to connect than screen (minicom and picocom, nope), added tty1 instead of ttyS0 at the boot options (nope), tried to connect to tty1 with the qemu console (nope) and interact with it using a named pipe (with the parameter '-serial pipe:/path/pipe' after creating it with mkfifo, nope).
That tty1 is for some reason very elusive if I do not use vnc to look inside that QEMU emulation.
So, how can I access that tty1 after that root-login event? And if that works for one QEMU emulation, can it be scaled to be usable with up to 20 at the same time?
By the way, in the long run I am aiming to access that tty1 from a Java application, which may use this lib: jLine3. It uses in- and output streams for its terminal emulation, so if you have a solution at hand that will go along with this, that would be even greater! But its optional at the moment.
Upvotes: 0
Views: 1720
Reputation: 11523
tty1 on Linux (i.e. inside your guest) is the virtual console on a graphical display. If you want to look at it you need to configure QEMU to have some sort of GUI so you can see what the guest is outputting on its graphical output. Alternatively, if you don't want to use a graphical display then you need to configure your guest OS to put a login prompt on some tty other than the virtual console ones (eg on the ttyS0 serial port tty).
Upvotes: 0