This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1468302 - 'rpm-ostree install' not respecting disabled repos
'rpm-ostree install' not respecting disabled repos
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rpm-ostree-client (Show other bugs)
7.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Colin Walters
atomic-bugs@redhat.com
: Extras
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-06 11:56 EDT by Micah Abbott
Modified: 2017-08-01 19:48 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 19:48:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Micah Abbott 2017-07-06 11:56:07 EDT
On the latest 7.4 Atomic Host, when trying to do an 'rpm-ostree install', the command is fetching metadata for repos that are disabled.  The command ultimately fails because one of the disabled repos does not appear to be valid/functional.


1.  Boot into 7.4 (8018f95c2f)
2.  Register via subscription-manager
3.  Use subscription-manager to disable all repos
4.  Use subscription-manager to enable server, extras, optional
5.  Try to 'rpm-ostree install wget'
6.  Observe the fetching of disable repos



# atomic host status
State: idle
Deployments:
● 7.4_latest:rhel-atomic-host/7/x86_64/standard
                Version: 7.4.0 (2017-06-30 18:37:40)
                 Commit: 8018f95c2f2f38a79e68f174dd5888b53769c0e4adcd89c87a802219091c9d0e

# rpm -q subscription-manager rpm-ostree-client                                                                                                                                       
subscription-manager-1.19.21-1.el7.x86_64
rpm-ostree-client-2017.6-4.atomic.el7.x86_64

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-extras-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/extras/os
Enabled:   1

Repo ID:   rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os
Enabled:   1

Repo ID:   rhel-7-server-optional-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Optional (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/os
Enabled:   1

# rpm-ostree install wget                                                                                                                                                             
Checking out tree 8018f95... done

Updating metadata for 'rhel-7-server-dotnet-debug-rpms': [=======================================================] 100%

Updating metadata for 'rhel-7-server-satellite-tools-6.2-rpms': [=======================================================] 100%

Updating metadata for 'rhel-7-server-v2vwin-1-debug-rpms': [======================================================= 100%

Updating metadata for 'rhel-7-server-openstack-11-tools-debug-rpms': [======================================================] 100%

Updating metadata for 'rhel-server-rhscl-7-eus-source-rpms': [======================================================] 100%

Updating metadata for 'rhel-7-server-rhceph-2-tools-rpms': [=====================================================] 100%

Updating metadata for 'rhel-7-server-extras-rpms': [=====================================================] 100%

Updating metadata for 'rhel-7-server-satellite-tools-6.1-source-rpms': [=====================================================] 100%

Updating metadata for 'rhel-atomic-host-beta-debug-rpms': [=====================================================] 100%

Updating metadata for 'rhel-7-server-rhn-tools-beta-rpms': [=====================================================] 100%

Updating metadata for 'rhel-7-server-supplementary-debug-rpms': [=====================================================] 100%

Updating metadata for 'rhel-7-server-satellite-tools-6.1-debug-rpms': [=====================================================] 100%

Updating metadata for 'rhel-server-rhscl-7-beta-source-rpms': [=====================================================] 100%
error: cannot update repo 'rhel-7-server-satellite-maintenance-6-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried; Last error: Status code: 404 for https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-maintenance/6/os/repodata/repomd.xml
Comment 2 Colin Walters 2017-07-06 14:10:40 EDT
There are two causes to this.

First, this ancient commit:
https://github.com/rpm-software-management/libdnf/commit/f754f5803b5553857a2e3fe875ca1273adcac095
for some reason introduces hardcoded behavior where *every* repo in a `redhat.repo` file is explicitly forced on to enable metadata.

Then, much later:
https://github.com/projectatomic/rpm-ostree/pull/736
caused us to start actually honoring that flag.

I don't offhand know why we're forcing on enabled metadata.  Is that really necessary?
Comment 3 Colin Walters 2017-07-06 14:18:22 EDT
For now, I propose this for RHELAH 7.4:

From 133b7585854858e96e6861b75bf8509e65341d3e Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 6 Jul 2017 14:14:27 -0400
Subject: [PATCH] repo: Remove redhat.repo special case

https://bugzilla.redhat.com/show_bug.cgi?id=1468302
---
 libdnf/dnf-repo.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libdnf/dnf-repo.c b/libdnf/dnf-repo.c
index cb5fce8..3da74d0 100644
--- a/libdnf/dnf-repo.c
+++ b/libdnf/dnf-repo.c
@@ -1018,11 +1018,6 @@ dnf_repo_setup(DnfRepo *repo, GError **error)
     if (g_key_file_has_key(priv->keyfile, priv->id, "enabled_metadata", NULL)) {
         if (dnf_repo_get_boolean(priv->keyfile, priv->id, "enabled_metadata", NULL))
             enabled |= DNF_REPO_ENABLED_METADATA;
-    } else {
-        g_autofree gchar *basename = g_path_get_basename(priv->filename);
-        /* special case the satellite and subscription manager repo */
-        if (g_strcmp0(basename, "redhat.repo") == 0)
-            enabled |= DNF_REPO_ENABLED_METADATA;
     }
 
     dnf_repo_set_enabled(repo, enabled);
-- 
2.13.2
Comment 4 Colin Walters 2017-07-06 14:25:43 EDT
@hughsie: Do you remember why that code exists?
Comment 5 Jonathan Lebon 2017-07-06 14:27:33 EDT
Wait, I'm confused. That PR is doing what we want right? It's filtering by DNF_REPO_ENABLED_PACKAGES rather than METADATA.

/me looks at source

Ahh, looks like this was changed in https://github.com/projectatomic/rpm-ostree/pull/791 to also look for METADATA repos. So I think what we want is

https://github.com/projectatomic/rpm-ostree/pull/863

instead, right?
Comment 8 Micah Abbott 2017-07-10 14:29:20 EDT
Verified in rpm-ostree-client-2017.6-5.atomic.el7.x86_64

# rpm -q rpm-ostree-client
rpm-ostree-client-2017.6-5.atomic.el7.x86_64

# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-extras-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Extras (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/extras/os
Enabled:   1

Repo ID:   rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os
Enabled:   1

Repo ID:   rhel-7-server-optional-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Optional (RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/os
Enabled:   1

# rpm-ostree install httpd
Checking out tree 8018f95... done
Enabled rpm-md repositories: epel rhel-7-server-extras-rpms rhel-7-server-rpms rhel-7-server-optional-rpms

Updating metadata for 'epel': [============================] 100%
rpm-md repo 'epel'; generated: 2017-07-09 03:46:59

Updating metadata for 'rhel-7-server-extras-rpms': [==============================] 100%
rpm-md repo 'rhel-7-server-extras-rpms'; generated: 2017-07-04 09:24:58

Updating metadata for 'rhel-7-server-rpms': [==============================] 100%
rpm-md repo 'rhel-7-server-rpms'; generated: 2017-07-05 09:16:57

Updating metadata for 'rhel-7-server-optional-rpms': [=============================] 100%
rpm-md repo 'rhel-7-server-optional-rpms'; generated: 2017-07-05 07:23:20

Importing metadata [=============================] 100%
Resolving dependencies... done
Will download: 5 packages (1.5 MB)

  Downloading from rhel-7-server-rpms: [====================================] 100%

Importing: [==================================] 100%
Overlaying... done
Writing rpmdb... done
Writing OSTree commit... done
Copying /etc changes: 31 modified, 4 removed, 115 added
Transaction complete; bootconfig swap: no deployment count change: 0
Freed objects: 15.4 kB
Added:
  apr-1.4.8-3.el7.x86_64
  apr-util-1.5.2-6.el7.x86_64
  httpd-2.4.6-45.el7_3.4.x86_64
  httpd-tools-2.4.6-45.el7_3.4.x86_64
  mailcap-2.1.41-2.el7.noarch
Run "systemctl reboot" to start a reboot
Comment 9 Richard Hughes 2017-07-11 05:01:31 EDT
(In reply to Colin Walters from comment #4)
> @hughsie: Do you remember why that code exists?

It makes subscription manager work, as the repo is always disabled and we can't modify the project to write a modified redhat.repo file.
Comment 10 Colin Walters 2017-07-11 09:33:19 EDT
@hughsie: Let's take this upstream: https://github.com/rpm-software-management/libdnf/issues/306
Comment 12 errata-xmlrpc 2017-08-01 19:48:29 EDT
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.

https://access.redhat.com/errata/RHBA-2017:2396

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