Bug 1963271

Summary: file conflict when installing usbguard on rhel-8.3
Product: Red Hat Enterprise Linux 8 Reporter: Alois Mahdal <amahdal>
Component: usbguardAssignee: Zoltan Fridrich <zfridric>
Status: CLOSED ERRATA QA Contact: Dalibor Pospíšil <dapospis>
Severity: medium Docs Contact: Jan Fiala <jafiala>
Priority: medium    
Version: 8.3CC: alakatos, dapospis, JONATHAN.SATTELBERGER, rsroka, vmojzis, zfridric
Target Milestone: betaKeywords: AutoVerified, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: usbguard-1.0.0-3.el8 Doc Type: Bug Fix
Doc Text:
.The `usbguard-selinux` package is no longer dependent on `usbguard` Previously, the `usbguard-selinux` package was dependent on the `usbguard` package. This, in combination with other dependencies of these packages, led to file conflicts when installing `usbguard`. As a consequence, this prevented the installation of `usbguard` on certain systems. With this version, `usbguard-selinux` no longer depends on `usbguard`, and as a result, `yum` can install `usbguard` correctly.
Story Points: ---
Clone Of:
: 1986785 (view as bug list) Environment:
Last Closed: 2022-05-10 13:36:46 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:
Bug Depends On:    
Bug Blocks: 1986785    

Description Alois Mahdal 2021-05-21 21:17:41 UTC
Description of problem
======================

I cannot install usbguard on a fresh RHEL-8.3 registered to production CDN:

    [root@localhost ~]# yum install usbguard
    Updating Subscription Management repositories.
    Beaker Client - RedHatEnterpriseLinux8                                                                                                                         77 kB/s |  11 kB     00:00    
    Beaker harness                                                                                                                                                1.9 MB/s | 418 kB     00:00    
    Copr repo for beakerlib-libraries owned by bgoncalv                                                                                                            29 kB/s | 2.7 kB     00:00    
    Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                                        418 kB/s | 612 kB     00:01    
    Copr repo for jats owned by netvor                                                                                                                             42 kB/s | 9.6 kB     00:00    
    Copr repo for shellfu owned by netvor                                                                                                                          57 kB/s | 8.9 kB     00:00    
    Copr repo for tests owned by oam-group                                                                                                                        437 kB/s |  22 kB     00:00    
    Copr repo for qa-tools owned by lpol                                                                                                                          2.3 MB/s | 111 kB     00:00    
    Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                          42 MB/s |  32 MB     00:00    
    Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                                                                       37 MB/s |  30 MB     00:00    
    Dependencies resolved.
    ==============================================================================================================================================================================================
     Package                                 Architecture                  Version                                                  Repository                                               Size
    ==============================================================================================================================================================================================
    Installing:
     usbguard                                x86_64                        1.0.0-2.el8                                              rhel-8-for-x86_64-appstream-rpms                        538 k
    Installing dependencies:
     audit-libs                              i686                          3.0-0.17.20191104git1c2f876.el8                          rhel-8-for-x86_64-baseos-rpms                           121 k
     glibc                                   i686                          2.28-127.el8                                             rhel-8-for-x86_64-baseos-rpms                           3.4 M
     libcap-ng                               i686                          0.7.9-5.el8                                              rhel-8-for-x86_64-baseos-rpms                            34 k
     libgcc                                  i686                          8.3.1-5.1.el8                                            rhel-8-for-x86_64-baseos-rpms                            86 k
     libgcrypt                               i686                          1.8.5-4.el8                                              rhel-8-for-x86_64-baseos-rpms                           446 k
     libgpg-error                            i686                          1.31-1.el8                                               rhel-8-for-x86_64-baseos-rpms                           247 k
     libqb                                   i686                          1.0.3-12.el8                                             rhel-8-for-x86_64-baseos-rpms                           121 k
     libqb                                   x86_64                        1.0.3-12.el8                                             rhel-8-for-x86_64-baseos-rpms                           113 k
     libstdc++                               i686                          8.3.1-5.1.el8                                            rhel-8-for-x86_64-baseos-rpms                           488 k
     protobuf                                i686                          3.5.0-13.el8                                             rhel-8-for-x86_64-appstream-rpms                        978 k
     protobuf                                x86_64                        3.5.0-13.el8                                             rhel-8-for-x86_64-appstream-rpms                        892 k
     usbguard                                i686                          0.7.8-7.el8                                              rhel-8-for-x86_64-appstream-rpms                        575 k
     zlib                                    i686                          1.2.11-16.el8_2                                          rhel-8-for-x86_64-baseos-rpms                           105 k
    Installing weak dependencies:
     usbguard-selinux                        noarch                        0.7.8-7.el8                                              rhel-8-for-x86_64-appstream-rpms                         27 k

    Transaction Summary
    ==============================================================================================================================================================================================
    Install  15 Packages

    Total download size: 8.1 M
    Installed size: 27 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/15): libcap-ng-0.7.9-5.el8.i686.rpm                                                                                                                        139 kB/s |  34 kB     00:00    
    (2/15): audit-libs-3.0-0.17.20191104git1c2f876.el8.i686.rpm                                                                                                   489 kB/s | 121 kB     00:00    
    (3/15): libgpg-error-1.31-1.el8.i686.rpm                                                                                                                      963 kB/s | 247 kB     00:00    
    (4/15): libqb-1.0.3-12.el8.i686.rpm                                                                                                                           915 kB/s | 121 kB     00:00    
    (5/15): libstdc++-8.3.1-5.1.el8.i686.rpm                                                                                                                      2.9 MB/s | 488 kB     00:00    
    (6/15): glibc-2.28-127.el8.i686.rpm                                                                                                                            15 MB/s | 3.4 MB     00:00    
    (7/15): libqb-1.0.3-12.el8.x86_64.rpm                                                                                                                         396 kB/s | 113 kB     00:00    
    (8/15): libgcc-8.3.1-5.1.el8.i686.rpm                                                                                                                         602 kB/s |  86 kB     00:00    
    (9/15): libgcrypt-1.8.5-4.el8.i686.rpm                                                                                                                        871 kB/s | 446 kB     00:00    
    (10/15): zlib-1.2.11-16.el8_2.i686.rpm                                                                                                                        233 kB/s | 105 kB     00:00    
    (11/15): protobuf-3.5.0-13.el8.i686.rpm                                                                                                                       6.1 MB/s | 978 kB     00:00    
    (12/15): usbguard-selinux-0.7.8-7.el8.noarch.rpm                                                                                                              196 kB/s |  27 kB     00:00    
    (13/15): protobuf-3.5.0-13.el8.x86_64.rpm                                                                                                                     5.6 MB/s | 892 kB     00:00    
    (14/15): usbguard-1.0.0-2.el8.x86_64.rpm                                                                                                                      3.8 MB/s | 538 kB     00:00    
    (15/15): usbguard-0.7.8-7.el8.i686.rpm                                                                                                                        2.4 MB/s | 575 kB     00:00    
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                         6.5 MB/s | 8.1 MB     00:01     
    warning: /var/cache/dnf/rhel-8-for-x86_64-baseos-rpms-51b3b78d5698246b/packages/libgpg-error-1.31-1.el8.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
    Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                         2.5 MB/s | 5.0 kB     00:00    
    Importing GPG key 0xFD431D51:
     Userid     : "Red Hat, Inc. (release key 2) <security>"
     Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    Is this ok [y/N]: y
    Key imported successfully
    Importing GPG key 0xD4082792:
     Userid     : "Red Hat, Inc. (auxiliary key) <security>"
     Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    Is this ok [y/N]: y
    Key imported successfully
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    The downloaded packages were saved in cache until the next successful transaction.
    You can remove cached packages by executing 'yum clean packages'.
    Error: Transaction test error:
      file /usr/lib/systemd/system/usbguard.service conflicts between attempted installs of usbguard-1.0.0-2.el8.x86_64 and usbguard-0.7.8-7.el8.i686
      file /usr/share/doc/usbguard/CHANGELOG.md conflicts between attempted installs of usbguard-1.0.0-2.el8.x86_64 and usbguard-0.7.8-7.el8.i686
      file /usr/share/man/man1/usbguard.1.gz conflicts between attempted installs of usbguard-1.0.0-2.el8.x86_64 and usbguard-0.7.8-7.el8.i686
      file /usr/share/man/man5/usbguard-daemon.conf.5.gz conflicts between attempted installs of usbguard-1.0.0-2.el8.x86_64 and usbguard-0.7.8-7.el8.i686
      file /usr/share/man/man5/usbguard-rules.conf.5.gz conflicts between attempted installs of usbguard-1.0.0-2.el8.x86_64 and usbguard-0.7.8-7.el8.i686
      file /usr/share/man/man8/usbguard-daemon.8.gz conflicts between attempted installs of usbguard-1.0.0-2.el8.x86_64 and usbguard-0.7.8-7.el8.i686

    [root@localhost ~]# 



Version-Release number of selected component
============================================

usbguard-1.0.0-2.el8


How reproducible
================

Always


Steps to Reproduce
==================

 1. Get RHEL-8.3
 2. Subscribe to CDN
 3. yum -y install usbguard


Actual results
==============

installation failure due to file conflict


Expected results
================

successful installation

Comment 1 Zoltan Fridrich 2021-07-12 10:39:10 UTC
The problem is that on rhel-8.3 there is an older version of selinux-policy package installed and this package is not a direct dependency of usbguard, but it is a dependency of usbguard-selinux. The new version of usbguard-selinux requires a newer version of selinux-policy. Usbguard-selinux is a weak dependency for usbguard. When you try to install usbguard (1.0.0 in this case) it tries to find the best fitting usbguard-selinux package which is in this case an old version (0.7.8) because of the old selinux-policy. But, usbguard-selinux 0.7.8 requires an old usbguard to function, therefore it also tries to install usbguard 0.7.8 which of course results in a file conflict, because it tries to install both usbguard 1.0.0 and usbguard 0.7.8. This does not happen on newer rhel version like 8.4 and 8.5 because the new selinux-policy is already present. I will see what I can do about this.

The current workaround is to simply update selinux-policy before installing usbguard or just install usbguard-selinux which will install usbguard as a dependency:
$ sudo dnf install selinux-policy usbguard
$ sudo dnf install usbguard-selinux

Comment 2 Vit Mojzis 2021-07-13 12:16:18 UTC
This seems to be caused by cyclic dependency between usbguard and usbguard-selinux.
Please remove
Requires:       %{name} = %{version}-%{release}
from selinux sub-package and use
Requires: (%{name}-selinux if selinux-policy-%{selinuxtype})
instead of 
Recommends: %{name}-selinux
where possible (rich dependency syntax may not be supported on some older versions of RHEL).

Comment 3 Vit Mojzis 2021-07-13 12:41:24 UTC
Also, %{release} contains {?dist}, which means that you are binding a "noarch" usbguard-selinux package to a specific architecture of usbguard. That is probably why yum tried to install i686 version of usbguard on an x86_64 system (or vice versa).

Comment 4 Vit Mojzis 2021-07-13 15:06:22 UTC
Please disregard Comment 3. {?dist} doesn't contain architecture.

Comment 5 Dalibor Pospíšil 2021-07-14 15:22:41 UTC
The following will prevent one from downgrading or upgrading just usbguard-selinux and so getting an inconsistent state of usbguard vs usbguard-selinux

Recommends: (%{name}-selinux if selinux-policy-%{selinuxtype})
Conflicts: (%{name}-selinux < %{version}-%{release})
Conflicts: (%{name}-selinux > %{version}-%{release})

Comment 23 errata-xmlrpc 2022-05-10 13:36:46 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 (usbguard bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2022:1779