Ubuntu

[Maverick] SDL local window broken in last update

Reported by Dave Gilbert on 2010-08-08
98
This bug affects 15 people
Affects Status Importance Assigned to Milestone
Release Notes for Ubuntu
Undecided
Unassigned
libvirt
Fix Released
Undecided
Unassigned
virtinst
Fix Released
Undecided
Unassigned
libvirt (Ubuntu)
Medium
Unassigned
Maverick
Medium
Unassigned
qemu-kvm (Ubuntu)
Medium
Unassigned
Maverick
Medium
Unassigned
virtinst (Ubuntu)
Medium
Unassigned
Maverick
Medium
Unassigned

Bug Description

Binary package hint: qemu-kvm

I've got a few guests that are setup to use the local SDL window rather than VNC. With the last update to kvm it has broken in one of two ways (which one it decides to use seems random)

1) My whole console goes black and the music player I'm running stops
2) The guest fails to start with an error of 'failed to retrieve chardev info' from qemu

In /var/log/libvirt/qemu/fiddle2.log I see:

LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin XAUTHORITY=/home/dg/.Xauthority DISPLAY=:0.0 /usr/bin/kvm -S -M pc-0.11 -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -name fiddle2 -uuid fd06659e-3354-cb8e-71d9-cfeeff86e60f -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/fiddle2.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot dc -drive file=/media/more/isos/ubuntu-10.10-alpha3-desktop-amd64.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -drive file=/dev/main/fiddle2disk,if=none,id=drive-virtio-disk0,boot=on -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 -device virtio-net-pci,vlan=0,id=net0,mac=54:52:00:32:5a:59,bus=pci.0,addr=0x5 -net tap,fd=43,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -sdl -vga cirrus -device ES1370,id=sound0,bus=pci.0,addr=0x6 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
char device redirected to /dev/pts/6
No protocol specified
No protocol specified
Could not initialize SDL - exiting

This was working fine yesterday prior to the kvm 1:84+dfsg-0ubuntu16+0.12.4+noroms+0ubuntu8 upgrade (or one of the other packages that landed at the same time).

Dave

== Regression details ==
Discovered in version: qemu-kvm 0.12.4+noroms-0ubuntu8
Last known good version: qemu-kvm 0.12.4+noroms-0ubuntu7

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: qemu-kvm 0.12.4+noroms-0ubuntu8
ProcVersionSignature: Ubuntu 2.6.35-14.20-generic 2.6.35
Uname: Linux 2.6.35-14-generic x86_64
Architecture: amd64
CheckboxSubmission: f2d10bd9f943a85b486a282e7840a570
CheckboxSystem: 0531969bcfd4f03af7405c98dc94a948
Date: Sun Aug 8 18:58:30 2010
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
KvmCmdLine: Error: command ['ps', '-C', 'kvm', '-F'] failed with exit code 1: UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
MachineType: To Be Filled By O.E.M. To Be Filled By O.E.M.
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.35-14-generic root=UUID=d8314979-8ace-401c-88df-728ad6b89cb5 ro ignore_loglevel netconsole=4444@192.168.66.33/eth0,514@192.168.66.25/00:a0:d1:63:68:a6 crashkernel=384M-2G:64M,2G-:128M nointremap
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.utf8
 SHELL=/bin/bash
SourcePackage: qemu-kvm
dmi.bios.date: 09/10/2009
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: P1.50
dmi.board.name: P55M Pro
dmi.board.vendor: ASRock
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrP1.50:bd09/10/2009:svnToBeFilledByO.E.M.:pnToBeFilledByO.E.M.:pvrToBeFilledByO.E.M.:rvnASRock:rnP55MPro:rvr:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.name: To Be Filled By O.E.M.
dmi.product.version: To Be Filled By O.E.M.
dmi.sys.vendor: To Be Filled By O.E.M.

Dave Gilbert (ubuntu-treblig) wrote :
Dave Gilbert (ubuntu-treblig) wrote :

Oops, forgot to say. I'm running this from virt-manager and the exact text of the chardev error is:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 814, in run_domain
    vm.startup()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1286, in startup
    self._backend.create()
  File "/usr/lib/python2.6/dist-packages/libvirt.py", line 333, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: operation failed: failed to retrieve chardev info in qemu with 'info chardev'

Dave

Mathias Gug (mathiaz) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Could you add the guest xml definition from libvirt?

Changed in qemu-kvm (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Dustin Kirkland  (kirkland) wrote :

Also, do you have compiz enabled? If so, can you disable it and retry?

There were some issues recently where compiz was breaking SDL...

Dave Gilbert (ubuntu-treblig) wrote :

In reverse order; no I'm not running SDL - I'm running metacity.

Config attached; it's doing it on all my guests that have sdl and doesn't on the one that uses vnc.
OK ok, so it's pasted below - Launchpad for some strange reason believes this file is empty whatever I do to it.

Dave

--------------------------
<domain type='kvm'>
  <name>fiddle2</name>
  <uuid>fd06659e-3354-cb8e-71d9-cfeeff86e60f</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.11'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='cdrom'>
      <source file='/media/more/isos/ubuntu-10.10-alpha3-desktop-amd64.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <source dev='/dev/main/fiddle2disk'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='54:52:00:32:5a:59'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='sdl' display=':0.0' xauth='/home/dg/.Xauthority'/>
    <sound model='es1370'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
  </devices>
</domain>

--------------------------

Changed in qemu-kvm (Ubuntu):
status: Incomplete → New
Nigel Jones (dev-nigelj) wrote :

I can confirm this on a clean install from the Maverick 20100816 Desktop CD Build (will update shortly in case another update has fixed it), I have a feeling that this might be an X bug.

Running via virt-manager I get exactly the same output as Dave, however when running from a gnome-terminal session I get the following output:

root@njones-laptop:~# LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin XAUTHORITY=/root/.Xauthority DISPLAY=:0.0 /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name sdl-test -uuid ea5b78aa-3611-fdbb-8d94-219b01bb6e7f -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/sdl-test.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -drive file=/var/lib/libvirt/images/sdl-test.img,if=none,id=drive-virtio-disk0,boot=on,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:9a:c7:b7,bus=pci.0,addr=0x3 -net tap,fd=44,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -sdl -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/4
TUNGETIFF ioctl() failed: Bad file descriptor
TUNSETOFFLOAD ioctl() failed: Bad file descriptor
pci_add_option_rom: failed to find romfile "pxe-virtio.bin"
No protocol specified
No protocol specified
init kbd.
Could not open SDL display

(notice extra line 'init kbd', I have a feeling that the TUNGETIFF and TUNSETOFFLOAD issues are unrelated, but will check shortly as well)

When run from the CLI, the screen goes blank (LCD backlight is still powered though) & if I say SSH in and reboot, the machine goes down but instead of the normal shutdown animation, the graphics are dirty like zebra (corrupted quite badly, and very colourful).

Certainly feels like an X bug to me, especially as there doesn't seem to have been any changes in upstream sdl.c. Rationale is that my Xorg logs show:

[ 1004.863] (II) AIGLX: Suspending AIGLX clients for VT switch

at around time of the crash & the graphics corruption.

Changed in qemu-kvm (Ubuntu):
status: New → Confirmed
Nigel Jones (dev-nigelj) wrote :

More testing: only happens if XAUTHORITY is set as an environment variable it seems, an interesting thing to note is that xhost doesn't work either, so it doesn't look like an AIGLX bug (I disabled it) but it does look X related.

Nigel Jones (dev-nigelj) on 2010-08-31
tags: added: regression-potential
Nigel Jones (dev-nigelj) wrote :

I've tagged the bug regression-potential as it looks like a regression between Lucid & Maverick, here is what I know from reproducing:

Reproduction:
Bug can be reproduced by creating (in virt-manager) on a clean Maverick install, by creating a virtual machine, editing the configuration (using virt-manager), remove the VNC device, and replace it with an SDL Local device. Upon starting the machine, it will not start and after a period will display an error to such effect.

If you access /var/log/libvirt/qemu/<vmname>.log and copy & paste the kvm command (along w/ environment variables, you will likely crash X completely.

I have also successfully reproduced this issue w/ upstream git HEAD & qemu-kvm_0.12.4+noroms-0ubuntu6_amd64.deb (earlier version that what Dave suggested the issue started with).

Observations:
When $XAUTHORITY is set correctly (when running the command manually - also likely if you 'virsh edit $vmname' and set the path there as well), an strace looks fairly normal, and similar to that of under Lucid, no framebuttle calls etc.

When $XAUTHORITY is not set correctly and is run from the terminal (gnome-terminal for instance) it looks like the KVM command attempts to open the framebuffer (/dev/fb) and perform a lot of ioctl calls on it (http://www.linuxjournal.com/article/2783 for a good explanation in laymans terms of what the ioctls are calling for), as a result Xorg pretty much dies, the screen goes blank (but backlight is still on), but there is no ability to switch VTs etcs, it is only possible to SSH into the machine. The KVM process also dies.

I found that generating an X configuration disabling AIGLX & booting w/ 'nomodeset' (and removing the quiet & splash in the process) allowed me to recover w/ Ctrl+Alt+F1, Ctrl+Alt+F7, and Ctrl+C the process (it is still running, unlike w/ modesetting/aiglx).

For reference, this machine is running a fairly bog standard fresh installation (now fully up to date) and has a ATI Mobility Radeon HD 4500 Series card, using the open source modules/etc, I've had no problems w/ KVM/etc on this laptop (under both Ubuntu & Fedora) in the past, both using the open source graphics.

I'll upload strace output in a moment...

Nigel Jones (dev-nigelj) wrote :
Nigel Jones (dev-nigelj) wrote :
Geoffrey Pursell (geoffp) wrote :

I'm having this issue as well, and for what it's worth, the same thing happens whether I'm in metacity or compiz.

Marc Deslauriers (mdeslaur) wrote :

There are two issues here:

1- virtinst creates the libvirt xml file with a hardcoded Xauthority file set to ~/.Xauthority. The version of gdm that comes with Maverick now sets the xauthority file to a dynamic directory in /var/run/gdm. Every time you log in, your Xauthority file will be in a different directory, it is therefore not possible to fix virtinst. libvirt would need to be substantially modified to omit having the xauthority file specified directly in the xml, and would need to obtain it from the user's environment each time he starts a VM.

2- libvirt now runs with reduced privileges. When kvm is spawned, it is now done so under the libvirt-qemu user, which does not have the appropriate permissions required to access the user's xauthority file.

Changed in virtinst (Ubuntu):
status: New → Confirmed
Changed in libvirt (Ubuntu):
status: New → Confirmed
Serge Hallyn (serge-hallyn) wrote :

Please see the description of bug 643583, a duplicate of this one,
for a start to / information for proposed text for the release notes.

Jamin W. Collins (jcollins) wrote :

I reported #656531, which was marked as a duplicate of this. Indeed it is covered by this. However, I believe this is a much larger issue than this report makes it out to be. Importance on all components except qemu-kvm is still listed as undecided, and the problem isn't even with qemu-kvm. This problem is with virtinst and libvirt and is much higher than "medium". This is a full on regression, configurations that worked under lucid will not work under maverick. This strikes me as a very severe or critical issue.

Changed in libvirt (Ubuntu Maverick):
importance: Undecided → Medium
Changed in virtinst (Ubuntu Maverick):
importance: Undecided → Medium
Thierry Carrez (ttx) on 2010-10-08
Changed in ubuntu-release-notes:
assignee: nobody → Thierry Carrez (ttx)
status: New → Fix Released
Jamie Strandboge (jdstrand) wrote :

Marking the qemu-kvm task as Invalid. The problem is with the upper layers (eg libvirt).

Changed in qemu-kvm (Ubuntu Maverick):
status: Confirmed → Invalid
tags: added: maverick regression-release
removed: regression-potential
description: updated
Bruce Hohl (brucehohl) wrote :

This is in reference to comments made for bug 643583 which was marked as a duplicate of this bug:

(1) libvirt + sdl does work if the lxdm is used as lxdm writes .Xauthority into the users home directory as expected by libvirt.

(2) A script like the following run with sudo might provide a work-around if gdm is used. Might be possible to add to "System > Preferences > Startup Applications" with some permissions adjustments.

xauth_virt_sudo.sh
   #!/bin/sh
   # Create .Xauthority link for libvirt 0.8.3 on Ubuntu Maverick 10.10
   user=admin1
   auth=`exec ls /var/run/gdm | grep auth-for-$user`
   if [ -h "/home/$user/.Xauthority" ]
   then rm /home/$user/.Xauthority
   fi
   ln -s /var/run/gdm/$auth/database /home/$user/.Xauthority

Hi, I also encountered that problem:
I'm running Maverik Merkat 10.10:
Same message "operation failed: failed to retrieve chardev info in qemu with 'info chardev'"
I played around like when you have a physical machine, that won't work: You remove piece by piece until it boots to figure out the faulty hardware:
So I figured out, that when I reduce the used physical memory from 3072 MB RAM to 2048 the machine booted again.
Remains the question: why did it work before with 3072MB and suddenly it stoops.
BTW: I have 12GB physical memory in my server as well as 12 CPU Cores which gives me 24 threads.
I had this problem before, and then usually a reboot of the machine did it also, of course, I can't reboot a host that runs 4 productive machines during business hours...
What I'm curious about: The error message says error to retrieve chardev info... which console command could I use to directly check for "info chardev"?

I think this is a mayor issue, as else kvm/libvirt or what ever else is responsible to cause that, is not to be run in productive environments.
For me I switched from vmware-server to kvm to use pure open source... but I'm already thinking on going back as these issues, as well as still sometimes guests looses their network while still showing an up-state link within the guest - and so far there is no solution for that either.

Thank you for solving those issues!

Thierry Carrez (ttx) on 2010-11-29
Changed in ubuntu-release-notes:
assignee: Thierry Carrez (ttx) → nobody
dave b. (d+b) wrote :

I gave libvirt access to my .Xauthority file and then tried via virt-manager to launch a vm using a local sdl window. I opened virt-manager with --debug.

On 'starting the vm' I got an error message like this:
"commandline read: virtio-blk-pci,b : Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 808, in run_domain
    vm.startup()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1296, in startup
    self._backend.create()
  File "/usr/lib/python2.6/dist-packages/libvirt.py", line 333, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error process exited while connecting to monitor: char device redirected to /dev/pts/18
"
(the vm doesn't boot).

Jamie Strandboge (jdstrand) wrote :

FYI, it looks like if you add the following to your xhost, then you will be able to use an SDL window:
xhost +SI:localgroup:kvm

If you've configured libvirt to run kvm as root, you would use:
xhost +SI:localgroup:root

See 'man Xsecurity' for details.

Marc Deslauriers (mdeslaur) wrote :

This now works properly in Precise, as the Xauthority file is now back in the user's home directory.

Also, Maverick is now EoL.

Changed in libvirt:
status: New → Fix Released
Changed in virtinst:
status: New → Fix Released
Changed in libvirt (Ubuntu):
status: Confirmed → Fix Released
Changed in libvirt (Ubuntu Maverick):
status: Confirmed → Fix Released
status: Fix Released → Won't Fix
Changed in virtinst (Ubuntu):
status: Confirmed → Fix Released
Changed in virtinst (Ubuntu Maverick):
status: Confirmed → Won't Fix
Dave Gilbert (ubuntu-treblig) wrote :

Hi Mark,
  Sorry - I've just confirmed this problem still exists on my Quantal host; if I use SDL I get the error:

Could not initialize SDL(No available video device) - exiting

in /var/log/libvirt/qemu/fiddle3.log

If I do the xhost's in #19 then it works; so sorry - still broken.

(Unlike when I reported this originally on Maverick, I'm now running Kubuntu, although still with lightdm)

dg@major:~$ ls -l .Xauthority
-rw------- 1 dg dg 50 Aug 4 12:01 .Xauthority
dg@major:~$ echo $XAUTHORITY
/tmp/kde-dg/xauth-1000-_0

dg@major:~$ ls -l /tmp/kde-dg/xauth-1000-_0
-rw-rw-r-- 1 dg dg 50 Aug 4 12:01 /tmp/kde-dg/xauth-1000-_0

dg@major:~$ md5sum .Xauthority
e0f1fb4c6ab09fa230e44bbd28c95648 .Xauthority
dg@major:~$ md5sum /tmp/kde-dg/xauth-1000-_0
e0f1fb4c6ab09fa230e44bbd28c95648 /tmp/kde-dg/xauth-1000-_0

so, not quite sure how .Xauthority works any more, but it's still broken.

Changed in libvirt (Ubuntu):
status: Fix Released → New
Serge Hallyn (serge-hallyn) wrote :

(Marked invalid in libvirt as this seems to be related mainly to virtinst)

Changed in libvirt (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers