Bug 1036147 - [locking] Traceback for dnf search if running under su - USER
[locking] Traceback for dnf search if running under su - USER
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
Unspecified Unspecified
low Severity unspecified
: ---
: ---
Assigned To: Ales Kozumplik
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-11-29 09:55 EST by Jaroslav Škarvada
Modified: 2014-09-30 19:41 EDT (History)
6 users (show)

See Also:
Fixed In Version: dnf-0.4.10-1.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-01-04 14:53:09 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jaroslav Škarvada 2013-11-29 09:55:37 EST
Description of problem:
Dnf search can cause traceback while running under su - USER. This is probably related to the systemd-logind bug, but dnf shouldn't behave this way. In case it is not possible to workaround this problem, dnf should exit with proper error message.

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

How reproducible:

Steps to Reproduce:
1. ssh to the box as root
2. su - USER (regular user)
3. dnf search '*dsd*'

Actual results:
Traceback (most recent call last):
  File "/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 279, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 135, in _main
    result, resultmsgs = cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1404, in run
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 207, in fill_sack
    with dnf.lock.metadata_cache_lock:
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 71, in __enter__
    pid = self._read_lock()
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 40, in _read_lock
    with open(self._target, 'r') as f:
  File "/usr/lib/python2.7/site-packages/dnf/util.py", line 110, in cached_getter
    val = fn(obj)
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 50, in _target
  File "/usr/lib/python2.7/site-packages/dnf/util.py", line 49, in ensure_dir
    os.makedirs(dname, mode=0o755)
  File "/usr/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/run/user/1001'

Expected results:
No traceback, dnf search results or appropriate error message.

Additional info:
Comment 1 Ales Kozumplik 2013-11-29 10:13:39 EST
Jaroslav, what is the fedora release the box is running and can you please link the systemd-logind bug?

Thank you!
Comment 2 Jaroslav Škarvada 2013-11-29 10:17:02 EST
(In reply to Ales Kozumplik from comment #1)
> Jaroslav, what is the fedora release the box is running and can you please
> link the systemd-logind bug?
It is F20 i686, the systemd-logind bug 753882.
Comment 3 Ales Kozumplik 2013-11-29 10:27:51 EST
weird, I explicitly rejected a patch using XDG_RUNTIME_DIR.

will take a look (low prio now).
Comment 4 Ales Kozumplik 2013-12-17 04:44:16 EST
Comment 5 Ales Kozumplik 2013-12-17 08:39:50 EST
Jaroslav, a workaround is to log in with the regular user at least once, systemd then creates the directory through some mechanism. It's probably a flaw in the filesystem hierarchy design that /run/user is not writable by the regular user.
Comment 6 Ales Kozumplik 2013-12-17 09:37:43 EST
dnf handles the traceback gracefully starting with 73d2d46. I got no reply when asking the Plumbers Team how to create the directory manually under scenarios like this.
Comment 7 Fedora Update System 2014-01-02 05:09:46 EST
dnf-0.4.10-1.fc20 has been submitted as an update for Fedora 20.
Comment 8 Fedora Update System 2014-01-03 03:41:30 EST
Package dnf-0.4.10-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.4.10-1.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 9 Fedora Update System 2014-01-04 14:53:09 EST
dnf-0.4.10-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

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