Bug 853100

Summary: %pre script of libvirt-daemon fails
Product: [Fedora] Fedora Reporter: Mike FABIAN <mfabian>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: berrange, clalancette, itamar, jforbes, jyang, laine, libvirt-maint, mfabian, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-06 19:02:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike FABIAN 2012-08-30 14:09:43 UTC
I tried to use "yum install @virtualization" to install the virtualization
stuff, but it didn’t install the libvirt-daemon package.

When I tried to install that seperately, it didn’t install
either because the %pre script failed:

    $ LANG=en_GB.UTF-8 sudo yum install --disablerepo=updates libvirt-daemon
    Loaded plugins: langpacks, presto, refresh-packagekit
    Resolving Dependencies
    --> Running transaction check
    ---> Package libvirt-daemon.x86_64 0:0.9.11.3-1.fc17 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package               Arch          Version                Repository     Size
    ================================================================================
    Installing:
     libvirt-daemon        x86_64        0.9.11.3-1.fc17        fedora        1.8 M
    
    Transaction Summary
    ================================================================================
    Install  1 Package
    
    Total download size: 1.8 M
    Installed size: 3.7 M
    Is this ok [y/N]: y
    Downloading Packages:
    libvirt-daemon-0.9.11.3-1.fc17.x86_64.rpm                | 1.8 MB     00:01     
    Running Transaction Check
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Error in PREIN scriptlet in rpm package libvirt-daemon-0.9.11.3-1.fc17.x86_64
    error: %pre(libvirt-daemon-0.9.11.3-1.fc17.x86_64) scriptlet failed, exit status 6
      Verifying  : libvirt-daemon-0.9.11.3-1.fc17.x86_64                        1/1 
    
    Failed:
      libvirt-daemon.x86_64 0:0.9.11.3-1.fc17                                       
    
    Complete!

    mfabian@ari:/local/mfabian/qemu-images
    $ LANG=en_GB.UTF-8 rpm -q libvirt-daemon
    package libvirt-daemon is not installed
    mfabian@ari:/local/mfabian/qemu-images
    $

Comment 1 Mike FABIAN 2012-08-30 14:32:38 UTC
I checked the contents of the %pre script, it is the same on f17 and master
and contains:

    %if %{with_libvirtd}
    %pre daemon
    %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
    # Normally 'setup' adds this in /etc/passwd, but this is
    # here for case of upgrades from earlier Fedora/RHEL. This
    # UID/GID pair is reserved for qemu:qemu
    getent group kvm >/dev/null || groupadd -g 36 -r kvm
    getent group qemu >/dev/null || groupadd -g 107 -r qemu
    getent passwd qemu >/dev/null || \
      useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
        -c "qemu user" qemu
    %endif

If I run

    getent group kvm >/dev/null || groupadd -g 36 -r kvm
    getent group qemu >/dev/null || groupadd -g 107 -r qemu
    getent passwd qemu >/dev/null || \
      useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
        -c "qemu user" qemu

manually as root, it works without error. And after doing that,
“yum install libvirt-daemon” works just fine:

    $ LANG=en_GB.UTF-8 sudo yum install --disablerepo=updates libvirt-daemon
    Loaded plugins: langpacks, presto, refresh-packagekit
    Resolving Dependencies
    --> Running transaction check
    ---> Package libvirt-daemon.x86_64 0:0.9.11.3-1.fc17 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package               Arch          Version                Repository     Size
    ================================================================================
    Installing:
     libvirt-daemon        x86_64        0.9.11.3-1.fc17        fedora        1.8 M
    
    Transaction Summary
    ================================================================================
    Install  1 Package
    
    Total download size: 1.8 M
    Installed size: 3.7 M
    Is this ok [y/N]: y
    Downloading Packages:
    libvirt-daemon-0.9.11.3-1.fc17.x86_64.rpm                | 1.8 MB     00:01     
    Running Transaction Check
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : libvirt-daemon-0.9.11.3-1.fc17.x86_64                        1/1 
      Verifying  : libvirt-daemon-0.9.11.3-1.fc17.x86_64                        1/1 
    
    Installed:
      libvirt-daemon.x86_64 0:0.9.11.3-1.fc17                                       

    Complete!

I don’t understand why it does not work until I run that %pre script manually.

Comment 2 Laine Stump 2012-09-06 19:02:16 UTC
(In reply to comment #1)
 
> I don’t understand why it does not work until I run that %pre script
> manually.

Because when you run those commands from a root shell, they are running in an unrestricted context, but when they're run from an rpm %pre script they are restricted. For more details, see the Bug 844167 (which this is a duplicate of).

(BTW, sorry for taking so long to comment here - I had seen the nag email, but from a quick glance at the subject assumed it was just another response to 844167)

*** This bug has been marked as a duplicate of bug 844167 ***