Solved qemu ; -curses garbled output

Hi,
I'm trying to use qemu-system-i386 on FreeBSD 10.3. I've installed it from current ports, qemu-devel-2.6.0_2. Problem is I can't get the normal output from a console, it seems like it prints only 1st character of each line. Though blindly I'm able to switch to the console (esc-2) and exit it.

The basic command I'm trying to run:

qemu-system-i386 -s -curses

I'm able to put the monitor on serial console like this:
qemu-system-i386 -s -nographic -serial mon:stdio

And switch with ctrl-a+c , but I really need to see the output as in curses output. I tried to downgrade to the emulators/qemu version but the issue is the same. I even tried to reinstall ncurses, but it yielded no change.
 
Thanks cpm@ for reply. Actually from past experience I have somewhat negative experience from opening PR so I'm not sure if it's worth a trouble. I saw that thread in question before I opened the thread here ; it seems OP there has the same problem but the solution suggested there is not a solution at all.

What I do as a workaround is far from OK. I've started Virtualbox VM on FreeBSD running Debian where I start the qemu. Inception comes into mind, I know ..
 
Last edited by a moderator:
I was able to determine the solution myself. The explanation is there in PR, but I will share briefly what is the problem here too.

emulators/qemu has an option to use NCURSES or not. It seems though it does use ncurses from ports nevertheless what is selected.

Currently ports have ncurses6 which doesn't seem to be working with qemu. I had to break package dependency (manual uninstall), recompile qemu so it uses system ncurses and then install ncurses back so I don't have broken ports.

This way qemu is using ncurses shipped with FreeBSD.
 
I was able to determine the solution myself. The explanation is there in PR, but I will share briefly what is the problem here too.

emulators/qemu has an option to use NCURSES or not. It seems though it does use ncurses from ports nevertheless what is selected.

Currently ports have ncurses6 which doesn't seem to be working with qemu. I had to break package dependency (manual uninstall), recompile qemu so it uses system ncurses and then install ncurses back so I don't have broken ports.

This way qemu is using ncurses shipped with FreeBSD.

Good catch, Martin! I'm sure that PR 211973 will be fixed favorably and others will benefit from it.

Please, provide a patch with all changes that you made in emulators/qemu.
 
I did this manually, no Makefile modification. I did try to modify the Makefile so it has:

Code:
64c64
< NCURSES_USES=     ncurses:base
---
> NCURSES_USES=     ncurses
But it didn't help. It still used the port one. So I had to do all the changes manually.
 
I could paste it here too as google might point somebody here with the same problem.

Situation just after qemu was installed:

Code:
$ pkg info qemu
qemu-2.6.1
Name  : qemu
Version  : 2.6.1
Installed on  : Fri Aug 19 23:46:14 2016 CEST
Origin  : emulators/qemu
Architecture  : freebsd:10:x86:64
Prefix  : /usr/local
Categories  : emulators
Licenses  : GPLv2
Maintainer  : bofh@FreeBSD.org
WWW  : http://wiki.qemu.org/Main_Page
Comment  : QEMU CPU Emulator
Options  :
     CDROM_DMA  : on
     CURL  : on
     DOCS  : on
     GNS3  : off
     GNUTLS  : on
     GTK2  : off
     JPEG  : on
     NCURSES  : on                         <--- ncurses selected
     OPENGL  : off
     PCAP  : on
     PNG  : on
     SAMBA  : off
     SASL  : on
     STATIC_LINK  : off
     USBREDIR  : off
     X11  : off
     X86_TARGETS  : off
Shared Libs required:
     libpng16.so.16
     libintl.so.8
     libgnutls.so.30
     libtinfo.so.6
     libpixman-1.so.0
     libncurses.so.6
     libgthread-2.0.so.0
     libglib-2.0.so.0
     libnettle.so.6
     libcurl.so.4
Annotations  :
     cpe  : cpe:2.3:a:qemu:qemu:2.6.1:::::freebsd10:x64
Flat size  : 142MiB

$ pkg info ncurses*
ncurses-6.0_2

$ ldd `which qemu-system-i386`|grep curs
     libncurses.so.6 => /usr/local/lib/libncurses.so.6 (0x8018bc000)
$
No matter if ncurses is selected or not qemu is always built against the ncurses from ports. FYI, as I didn't know this , FreeBSD does ship its own ncurses in the base system.

Fix was to remove the ncurses from ports, rebuild the qemu and install the ncurses again. You can remove ports either with pkg or in ports.

Remove ncurses but leave other packages which depend on ncurses as is (effectively breaking those packages):
Code:
pkg delete -f ncurses
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
     ncurses-6.0_2

Number of packages to be removed: 1

The operation will free 11 MiB.

Proceed with deinstalling packages? [y/N]: y
Rebuild qemu:
Code:
cd /usr/ports/emulators/qemu && make deinstall && make install clean
Verify qemu is using system ncurses:
Code:
ldd `which qemu-system-i386` | grep curs
  libncurses.so.8 => /lib/libncurses.so.8 (0x80164a000)    <-- lib from /lib not /usr/local/*
and install back ncurses:
Code:
cd /usr/ports/devel/ncurses && make install clean
You can verify the status of the installed packages (shared libs) by:
Code:
pkg check --shlibs
Checking all packages: 100%
 
Last edited:
Back
Top