Bug 1554995

Summary: dnf download broken: PermissionError: [Errno 13] Permission denied: '/etc/dnf/modules.d'
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: dnfAssignee: Martin Hatina <mhatina>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: high    
Version: rawhideCC: bkircher, crobinso, dmach, james.antill, mhatina, packaging-team-maint, ptoscano, qe-baseos-security, rjones, tdawson, vmukhame, zjedrzej
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1547655 Environment:
Last Closed: 2018-04-16 12:21:02 UTC Type: ---
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: 910269    

Description Richard W.M. Jones 2018-03-13 18:04:52 UTC
+++ This bug was initially created as a clone of Bug #1547655 +++

Cloning to Fedora since it is now also broken in F29.

This is bug in dnf.

======================================================================
ERROR: test_wildcard_with_multilib_blacklist (tests.test_gather.DNFDepsolvingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pungi-4.1.22/tests/test_gather.py", line 850, in test_wildcard_with_multilib_blacklist
    pkg_map = self.go(packages, None, multilib_blacklist=['dummy-glibc*'])
  File "/builddir/build/BUILD/pungi-4.1.22/tests/test_gather.py", line 1723, in go
    self.dnf = self.dnf_instance(arch, lookaside=lookaside, persistdir=self.tmp_dir)
  File "/builddir/build/BUILD/pungi-4.1.22/tests/test_gather.py", line 1764, in dnf_instance
    dnf.fill_sack(load_system_repo=False, load_available_repos=True)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 437, in fill_sack
    self._setup_modules()
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 224, in _setup_modules
    self.repo_module_dict.read_all_module_confs()
  File "/usr/lib/python3.6/site-packages/dnf/module/repo_module_dict.py", line 461, in read_all_module_confs
    module_reader = ModuleReader(self.get_modules_dir())
  File "/usr/lib/python3.6/site-packages/dnf/module/repo_module_dict.py", line 480, in get_modules_dir
    ensure_dir(modules_dir)
  File "/usr/lib/python3.6/site-packages/dnf/util.py", line 124, in ensure_dir
    raise e
  File "/usr/lib/python3.6/site-packages/dnf/util.py", line 121, in ensure_dir
    os.makedirs(dname, mode=0o755)
  File "/usr/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/etc/dnf/modules.d'

--- Additional comment from Daniel Mach on 2018-02-28 03:45:16 EST ---

What needs to be fixed:
* spec to provide the directory.
* prevent creating the directory when reading modules (the problem is with non-root user here obviously)

Comment 1 Martin Hatina 2018-03-15 09:10:04 UTC
Fixed by: https://github.com/rpm-software-management/dnf/pull/1031

Comment 2 Martin Hatina 2018-03-22 09:01:41 UTC
*** Bug 1559303 has been marked as a duplicate of this bug. ***