Bug 1495116

Summary: Dnf version fails with traceback in container
Product: [Fedora] Fedora Reporter: dhodovsk
Component: dnfAssignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: dmach, jmracek, mblaha, rpm-software-management
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-2.7.2-1.fc27 dnf-2.7.2-1.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-04 14:23:19 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 dhodovsk 2017-09-25 08:52:59 UTC
Description of problem:
Traceback after running 'dnf --version'

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

How reproducible:
always

Steps to Reproduce:
1. docker run -it --user 1000 fedora:26 bash
2. dnf --version
3.

Actual results:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 95, in _main
    cli.configure(list(map(ucd, args)), option_parser())
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 804, in configure
    self.base.output)
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 112, in print_versions
    rpmdb_sack = dnf.sack._rpmdb_sack(base)
  File "/usr/lib/python3.6/site-packages/dnf/sack.py", line 107, in _rpmdb_sack
    sack = _build_sack(base)
  File "/usr/lib/python3.6/site-packages/dnf/sack.py", line 99, in _build_sack
    dnf.util.ensure_dir(cachedir)
  File "/usr/lib/python3.6/site-packages/dnf/util.py", line 120, in ensure_dir
    os.makedirs(dname, mode=0o755)
  File "/usr/lib64/python3.6/os.py", line 205, in makedirs
    head, tail = path.split(name)
  File "/usr/lib64/python3.6/posixpath.py", line 105, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 106, in __exit__
    self.close()
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 368, in close
    self.conf.cachedir)
  File "/usr/lib/python3.6/site-packages/dnf/persistor.py", line 483, in __init__
    self.db_path = os.path.join(cachedir, "tempfiles.json")
  File "/usr/lib64/python3.6/posixpath.py", line 78, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType


Expected results:
version of dnf
no traceback

Additional info:

Comment 1 Igor Gnatenko 2017-09-25 10:15:14 UTC
*** Bug 1495117 has been marked as a duplicate of this bug. ***

Comment 2 Marek Blaha 2017-10-02 07:25:02 UTC
May be, it would be safer not to run container shell under non-existent user. Nevertheless, the traceback is fixed.

Comment 3 Fedora Update System 2017-10-02 10:34:02 UTC
dnf-plugins-extras-2.0.3-1.fc27 dnf-plugins-core-2.1.4-1.fc27 dnf-2.7.2-1.fc27 libdnf-0.10.1-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-faf235c683

Comment 4 Fedora Update System 2017-10-02 10:37:43 UTC
dnf-plugins-extras-2.0.3-1.fc26 dnf-plugins-core-2.1.4-1.fc26 dnf-2.7.2-1.fc26 libdnf-0.10.1-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-70a8618065

Comment 5 Fedora Update System 2017-10-02 20:28:26 UTC
dnf-2.7.2-1.fc26, dnf-plugins-core-2.1.4-1.fc26, dnf-plugins-extras-2.0.3-1.fc26, libdnf-0.10.1-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-70a8618065

Comment 6 Fedora Update System 2017-10-02 21:27:42 UTC
dnf-2.7.2-1.fc27, dnf-plugins-core-2.1.4-1.fc27, dnf-plugins-extras-2.0.3-1.fc27, libdnf-0.10.1-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-faf235c683

Comment 7 Fedora Update System 2017-10-04 14:23:19 UTC
dnf-2.7.2-1.fc27, dnf-plugins-core-2.1.4-1.fc27, dnf-plugins-extras-2.0.3-1.fc27, libdnf-0.10.1-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2017-10-04 22:25:22 UTC
dnf-2.7.2-1.fc26, dnf-plugins-core-2.1.4-1.fc26, dnf-plugins-extras-2.0.3-1.fc26, libdnf-0.10.1-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.