Bug 1560276

Summary: dnf distro-sync tries to remove libvirt-daemon but fails
Product: [Fedora] Fedora Reporter: George R. Goffe <grgoffe>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: agedosier, berrange, clalancette, itamar, jforbes, jtomko, laine, libvirt-maint, veillard
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-26 08:56:37 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 George R. Goffe 2018-03-25 13:52:39 UTC
Description of problem:
I was attempting to run "dnf distro-sync" but got the messages below which tells me that the removal (why?) of libvirt-daemon failed. The code is still running. 

psg libvirt
F S UID          PID    PPID CLS PRI ADDR SZ WCHAN  STIME TTY          TIME CMD
5 S dnsmasq     1863       1 TS   19 - 17737 SyS_po Mar23 ?        00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper

Why is dnf trying to remove this package? rpm -qa says there are two packages with the same name on this system, see below.

Version-Release number of selected component (if applicable):

rpm -q libvirt-daemon
libvirt-daemon-4.1.0-1.fc29.x86_64
libvirt-daemon-4.1.0-3.fc29.x86_64

How reproducible:

always

Steps to Reproduce:
1.see below
2.
3.

Actual results:

see below

Expected results:

clean system upgrade  

Additional info:
dnf distro-sync
Last metadata expiration check: 0:18:42 ago on Sun 25 Mar 2018 06:14:57 AM PDT.
Dependencies resolved.
=============================================================================================================================================
 Package                              Arch                         Version                              Repository                      Size
=============================================================================================================================================
Removing dependent packages:
 libvirt-daemon                       x86_64                       4.1.0-1.fc29                         @rawhide                       2.8 M

Transaction Summary
=============================================================================================================================================
Remove  1 Package

Freed space: 2.8 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                     1/1 
  Running scriptlet: libvirt-daemon-4.1.0-1.fc29.x86_64                                                                                  1/1 
/var/tmp/rpm-tmp.TpUjlc: line 6: virtlogd.socket: command not found
error: %preun(libvirt-daemon-4.1.0-1.fc29.x86_64) scriptlet failed, exit status 127
Error in PREUN scriptlet in rpm package libvirt-daemon
Error in PREUN scriptlet in rpm package libvirt-daemon
libvirt-daemon-4.1.0-1.fc29.x86_64 was supposed to be removed but is not!
  Verifying        : libvirt-daemon-4.1.0-1.fc29.x86_64                                                                                  1/1 

Failed:
  libvirt-daemon.x86_64 4.1.0-1.fc29                                                                                                         

Error: Transaction failed

Comment 1 Ján Tomko 2018-03-25 17:44:32 UTC
Fixed upstream by:
commit 7495b1a7797df44b29201a3369adc2a42d89439e
Author:     Daniel P. Berrangé <berrange>
CommitDate: 2018-03-21 14:46:08 +0000

    rpm: fix incorrect expansion of macros with line continuations for args
    
    Macros in RPMs are expanded before line continuations, so when we write
    
       %systemd_preun foo \
                      bar
    
    What happens is that it expands to
    
       if [ $1 -eq 0 ] ; then
            # Package removal, not upgrade
            systemctl --no-reload disable --now foo \ > /dev/null 2>&1 || :
       fi
                     bar
    
    which is obviously complete garbage and not what we expected. It is
    simply not safe to ever use line continuations in combination with
    macros.
    
    Reviewed-by: Laine Stump <laine>
    Signed-off-by: Daniel P. Berrangé <berrange>

git describe: v4.1.0-249-g7495b1a77

But you might need to remove the broken package manually:
rpm -e --noscripts libvirt-daemon-4.1.0-1.fc29

Comment 2 George R. Goffe 2018-03-25 18:52:39 UTC
Ján,

Thank you for your hard work and this info.

G'day,

George...

Comment 3 Daniel Berrangé 2018-03-26 08:56:37 UTC

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