Bug 742646 - libvirtd fails to start - Failed to find group record for name 'qemu'
Summary: libvirtd fails to start - Failed to find group record for name 'qemu'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: x86_64
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 743557 771720
TreeView+ depends on / blocked
 
Reported: 2011-09-30 21:40 UTC by Pierre Larsson
Modified: 2012-01-04 18:36 UTC (History)
11 users (show)

Fixed In Version: libvirt-0.9.2-1.el6
Doc Type: Bug Fix
Doc Text:
Due to a programming error in the initialization code of the libvirtd daemon, the QEMU driver could have failed to find the user or group ID of the qemu application on the system. As a result, libvirtd failed to start. With this update, the error has been corrected and libvirtd now works as expected.
Clone Of:
: 771720 (view as bug list)
Environment:
Last Closed: 2011-12-06 11:34:55 UTC
Target Upstream Version:


Attachments (Terms of Use)
Full debug log (459.16 KB, text/plain)
2011-09-30 21:59 UTC, Pierre Larsson
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Pierre Larsson 2011-09-30 21:40:29 UTC
Description of problem:
Trying to start libvirtd fails. This started after upgrading my host from 6.0 -> 6.1

Version-Release number of selected component (if applicable):
libvirt 0.8.7-18.el6_1.1
qemu-img 2:0.12.1.2-2.160.el6_1.2

How reproducible:
100%

Steps to Reproduce:
1. service libvirtd start
  
Actual results:
libvirtd fails to start.

Expected results:
libvirtd starts.

Additional info:
messages log:
Sep 30 22:35:58 kvm libvirtd: 22:35:58.907: 5356: info : libvirt version: 0.8.7, package: 18.el6_1.1 (Unknown, 2011-09-01-11:22:40, sl6.fnal.gov)
Sep 30 22:35:58 kvm libvirtd: 22:35:58.907: 5356: error : virGetGroupID:2858 : Failed to find group record for name 'qemu': Numerical result out of range 
Sep 30 22:35:58 kvm libvirtd: 22:35:58.907: 5356: error : virStateInitialize:1038 : Initialization of QEMU state driver failed
Sep 30 22:35:58 kvm libvirtd: 22:35:58.948: 5356: error : main:3326 : Driver state initialization failed
Sep 30 22:35:58 kvm libvirtd: 22:35:58.949: 5357: warning : qemudDispatchSignalEvent:403 : Shutting down on signal 3

Comment 2 Pierre Larsson 2011-09-30 21:59:16 UTC
Created attachment 525842 [details]
Full debug log

Comment 3 Dave Allan 2011-09-30 23:10:58 UTC
Do you have a user and group qemu on your system?  Also, if you have a support contract with Red Hat, you should open a ticket.

Comment 4 Pierre Larsson 2011-09-30 23:26:24 UTC
Yes the user/group exists. I tried rolling back to the previous version of libvirt and still get the same error. I have an identical host which is working fine and was upgraded in the same fashion. The user id's and group id's are also identical on both hosts.

cat /etc/passwd |grep qemu
qemu:x:107:107:qemu user:/:/sbin/nologin

cat /etc/group |grep qemu
kvm:x:36:qemu
qemu:x:107:

Comment 5 Michal Privoznik 2011-10-03 15:46:20 UTC
We need to backport this commit:

commit b3918fabda42e3aecf1b0bfe1079a05e6cad62f7
Author: Eric Blake <eblake@redhat.com>
Date:   Mon May 16 15:37:15 2011 -0600

    build: tolerate unlimited group size
    
    POSIX allows sysconf(_SC_GETPW_R_SIZE_MAX) to return -1 if there
    is no fixed limit, and requires ERANGE errors to track real size.
    Model our behavior after the example in POSIX itself:
    http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwuid_r.html
    
    Also, on error for get*_r functions, errno is undefined, and the
    real error was the return value.
    
    * src/util/util.c (virGetUserEnt, virGetUserID, virGetGroupID)
    (virSetUIDGID):  Cope with sysconf failure or too small buffer.
    Reported by Matthias Bolte.

https://www.redhat.com/archives/libvir-list/2011-May/msg01074.html

Problem we are facing here is: we use getgrnam_r() to get group ID for qemu. But this function can return ERANGE in case an insufficient buffer was supplied. However, there are not many ways to tell how big buffer should be sufficient, besides iterating over and over until something else than ERANGE is returned.

Comment 8 Pierre Larsson 2011-10-04 09:31:29 UTC
So is there any workaround or do I have to wait for the backported package or newer package?

Comment 10 Eric Blake 2011-10-04 16:46:29 UTC
Short of backporting the patch, or abusing LD_PRELOAD to replace the failing getgrnam_r in a way that works around unpatched libvirt's misuse of the function, I don't see any easy way to work around the failure.  I'm not in charge of release decisions, but I can at least ask around to see whether it is possible to get this backport out sooner rather than later.

Comment 15 Huang Wenlong 2011-10-10 02:06:35 UTC
Verify this bug with  :
libvirt-0.9.4-16.el6.x86_64


1) restart libvirtd service 

2) check messages log:

*No* find  message like "Sep 30 22:35:58 kvm libvirtd: 22:35:58.907: 5356: info : libvirt version:
0.8.7, package: 18.el6_1.1 (Unknown, 2011-09-01-11:22:40, sl6.fnal.gov)
Sep 30 22:35:58 kvm libvirtd: 22:35:58.907: 5356: error : virGetGroupID:2858 :
Failed to find group record for name 'qemu': Numerical result out of range 
Sep 30 22:35:58 kvm libvirtd: 22:35:58.907: 5356: error :
virStateInitialize:1038 : Initialization of QEMU state driver failed
Sep 30 22:35:58 kvm libvirtd: 22:35:58.948: 5356: error : main:3326 : Driver
state initialization failed
Sep 30 22:35:58 kvm libvirtd: 22:35:58.949: 5357: warning :
qemudDispatchSignalEvent:403 : Shutting down on signal 3 "

Comment 16 Pierre Larsson 2011-10-11 16:54:28 UTC
Has the package libvirt-0.9.4-16.el6.x86_64 been released yet?

Comment 17 Eric Blake 2011-10-11 17:09:12 UTC
The fix is publicly available as part of the RHEL 6.2 beta (https://www.redhat.com/about/news/blog/red-hat-announces-the-beta-release-of-red-hat-enterprise-linux-6-2), or you can wait for the fix to be backported to RHEL 6.1.z (tracked by bug 743557), or wait for the GA release of RHEL 6.2.

Comment 18 Miroslav Svoboda 2011-10-20 13:51:48 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Due to a programming error in the initialization code of the libvirtd daemon, the QEMU driver could have failed to find the user or group ID of the qemu application on the system. As a result, libvirtd failed to start. With this update, the error has been corrected and libvirtd now works as expected.

Comment 19 errata-xmlrpc 2011-12-06 11:34:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1513.html


Note You need to log in before you can comment on or make changes to this bug.