libvirt's apparmor profile denies access to sgabios.bin

Bug #1393548 reported by Adam Gandelman
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Fix Released
High
Serge Hallyn
Trusty
Fix Released
High
Unassigned
Utopic
Won't Fix
High
Unassigned

Bug Description

=====================================
Impact: unable to get earli bios messages.
Test case: see below
Reression potential: the patch only grants access to the romfile, so no new bugs should be introduced.
=====================================
Attempting to use the sgabios ROM to capture early boot BIOS messages on the serial console. Typically this can be done via libvirt domain configuration:

<os>
  <bios useserial='yes'/>
</os>

Resulting in the qemu process being launched with a '-device sga' argument that should load the optional ROM.

The sgabios package installs the ROM @ /usr/share/misc/sgabios.bin and symlinks to it from /usr/share/qemu/sgabios.bin

I noticed the expected serial output was missing and found that apparmor is preventing sgabios from loading when spawning the VM:

[ 1378.106921] type=1400 audit(1416255684.049:23): apparmor="DENIED" operation="open" profile="libvirt-c08c4756-2e2c-4c62-a519-0e3ac0cf643d" name="/usr/share/misc/sgabios.bin" pid=13182 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=110 ouid=0

Worked around by manually installing the sgabios.bin file directly to /usr/share/qemu/sgabios.bin

Changed in libvirt (Ubuntu):
status: New → In Progress
assignee: nobody → Serge Hallyn (serge-hallyn)
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.8-0ubuntu15

---------------
libvirt (1.2.8-0ubuntu15) vivid; urgency=medium

  * libvirt-qemu: add r to sgabios.bin (LP: #1393548)
 -- Serge Hallyn <email address hidden> Mon, 17 Nov 2014 15:05:22 -0600

Changed in libvirt (Ubuntu):
status: In Progress → Fix Released
description: updated
Changed in libvirt (Ubuntu Trusty):
importance: Undecided → High
Changed in libvirt (Ubuntu Utopic):
importance: Undecided → High
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Adam, or anyone else affected,

Accepted libvirt into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/libvirt/1.2.2-0ubuntu13.1.9 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libvirt (Ubuntu Trusty):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Hi Adam,

could you please give this package a test? I tried to test it, but I don't know which messages are the ones which were missing. (If you can just tel me what those are i'll test it)

Revision history for this message
Adam Gandelman (gandelman-a) wrote :
Download full text (3.5 KiB)

Confirmed this fixes the issue:

Current version shows the following apparmor errors when spinning up a virtual machine with '-device sga', and the console log does not contain any early boot stuff:

adam@trusty:~$ dpkg -l | grep libvirt
ii libvirt-bin 1.2.2-0ubuntu13.1.8 amd64 programs for the libvirt library
ii libvirt0 1.2.2-0ubuntu13.1.8 amd64 library for interfacing with different virtualization systems
ii python-libvirt 1.2.2-0ubuntu2 amd64 libvirt Python bindings
adam@trusty:~$
adam@trusty:~$ ps aux | grep libvirt | grep sga
libvirt+ 13477 61.8 6.8 1234328 559852 ? Sl 18:30 0:24 /usr/bin/qemu-system-x86_64 -name baremetalbrbm_0 -S -machine pc-1.0,accel=tcg,usb=off -m 512 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 6a8f6fb0-afc7-4474-8cc8-63b529068a95 -no-user-config -nodefaults -device sga -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/baremetalbrbm_0.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot menu=off,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/libvirt/images/baremetalbrbm_0.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=writeback -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,fd=24,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:ad:8f:fb,bus=pci.0,addr=0x4,bootindex=1 -chardev file,id=charserial0,path=/home/adam/data/ironic/logs//baremetalbrbm_0_console.log -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 -vnc 127.0.0.1:0 -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7
adam@trusty:~$ dmesg | grep sgab
[ 3356.326341] type=1400 audit(1422498639.571:21): apparmor="DENIED" operation="open" profile="libvirt-6a8f6fb0-afc7-4474-8cc8-63b529068a95" name="/usr/share/misc/sgabios.bin" pid=13477 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=110 ouid=0

Upgrading to 1.2.2-0ubuntu13.1.9, after spawning a machine there DENIED errors dont show up and my console logs contain early boot stuff:

$ sudo head -n 200 /home/adam/data/ironic/logs//baremetalbrbm_0_console.log

Google, Inc.
Serial Graphics Adapter 12/07/13
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (buildd@allspice) Sat Dec 7 23:13:17 UTC 2013
4 0
 eaBIOS (version 1.7.4-20140219_122710-roseapple)
 achine UUID 6a8f6fb0-afc7-4474-8cc8-63b529068a95
M

iPXE (http://ipxe.org) 00:04.0 CA00 PCI2.10 PnP PMM+1FFC2360+1FF22360 CA00

Booting from ROM...
iPXE (PCI 00:04.0) starting execution...ok
iPXE initialising devices...ok

iPXE 1.0.0+git-20131111.c3d1e78-2ubuntu1 -- Open Source Network Boot Firmware --
 http://ipxe.org
Features: HTTP HTTPS iSCSI DNS TFTP ...

Read more...

tags: added: verification-done
removed: verification-needed
Timo Aaltonen (tjaalton)
tags: added: verification-done-trusty
removed: verification-done
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libvirt - 1.2.2-0ubuntu13.1.9

---------------
libvirt (1.2.2-0ubuntu13.1.9) trusty-proposed; urgency=medium

  * apparmor libvirt-qemu template: allow reading charm-specific ceph config
    and allow reading under /tmp and /var/tmp (for SRU only) (LP: #1403648)
  * numa-cgroups-fix-cpuset-mems-init.patch - cherrypicked, refreshed patch
    (by Richard Laager) to fix failure to start on numa node 1 (LP: #1404388)
  * libvirt-qemu: add r to sgabios.bin (LP: #1393548)
 -- Serge Hallyn <email address hidden> Tue, 06 Jan 2015 10:39:15 -0600

Changed in libvirt (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for libvirt has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

utopic has seen the end of its life and is no longer receiving any updates. Marking the utopic task for this ticket as "Won't Fix".

Changed in libvirt (Ubuntu Utopic):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.