Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1154476 - [abrt] dnf: lock.py:64:_read_lock:ValueError: invalid literal for int() with base 10: ''
Summary: [abrt] dnf: lock.py:64:_read_lock:ValueError: invalid literal for int() with ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 21
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Luscon
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:d253dd87b2ca2b5a4bcb7509b6d...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-20 03:24 UTC by Mikhail
Modified: 2015-02-20 08:32 UTC (History)
10 users (show)

Fixed In Version: hawkey-0.5.3-2.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-20 08:32:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (1.23 KB, text/plain)
2014-10-20 03:24 UTC, Mikhail
no flags Details
File: environ (1.96 KB, text/plain)
2014-10-20 03:24 UTC, Mikhail
no flags Details

Description Mikhail 2014-10-20 03:24:11 UTC
Version-Release number of selected component:
dnf-0.6.2-1.fc21

Additional info:
reporter:       libreport-2.3.0
cmdline:        /usr/bin/python -OO /bin/dnf update
executable:     /bin/dnf
kernel:         3.17.0-301.fc21.i686
runlevel:       N 5
type:           Python
uid:            0

Truncated backtrace:
lock.py:64:_read_lock:ValueError: invalid literal for int() with base 10: ''

Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 182, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1085, in run
    self._process_demands()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 812, in _process_demands
    load_available_repos=lar)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 212, in fill_sack
    with lock:
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 85, in __enter__
    pid = self._read_lock()
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 64, in _read_lock
    return int(f.readline())
ValueError: invalid literal for int() with base 10: ''

Local variables in innermost frame:
self: <dnf.lock.ProcessLock object at 0xb597534c>
f: <closed file u'/var/cache/dnf/i386/21/metadata_lock.pid', mode 'r' at 0xb5a31180>

Comment 1 Mikhail 2014-10-20 03:24:16 UTC
Created attachment 948356 [details]
File: backtrace

Comment 2 Mikhail 2014-10-20 03:24:17 UTC
Created attachment 948357 [details]
File: environ

Comment 3 Mikhail 2014-10-20 03:25:48 UTC
Another user experienced a similar problem:

[root@localhost ~]# dnf update
Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 182, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 134, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1085, in run
    self._process_demands()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 812, in _process_demands
    load_available_repos=lar)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 212, in fill_sack
    with lock:
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 85, in __enter__
    pid = self._read_lock()
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 64, in _read_lock
    return int(f.readline())
ValueError: invalid literal for int() with base 10: ''
[root@localhost ~]# 

reporter:       libreport-2.3.0
cmdline:        /usr/bin/python -OO /bin/dnf update
executable:     /bin/dnf
kernel:         3.17.0-301.fc21.i686
package:        dnf-0.6.2-1.fc21
reason:         lock.py:64:_read_lock:ValueError: invalid literal for int() with base 10: ''
runlevel:       N 5
type:           Python
uid:            0

Comment 4 Honza Silhan 2014-10-20 15:31:42 UTC
Hi, thanks for the report.

Did you run multiple instances of DNF or do you know what did you do unusually?

Comment 5 Mikhail 2014-10-20 15:34:25 UTC
Occurs unexpected power failure during the upgrade. Now dnf does not work.

Comment 6 Honza Silhan 2014-10-31 10:11:45 UTC
Then there should be some systemd command that would reset dnf lock after reboot.

Comment 7 Mikhail 2014-12-03 09:41:44 UTC
Problem is still there

Comment 8 Paolo Antinori 2014-12-04 09:32:57 UTC
Same here:

$ date
Thu  4 Dec 10:30:06 CET 2014


$ dnf --version
0.6.2
  Installed: dnf-0:0.6.2-1.fc21.noarch at 2014-11-08 17:36
  Built    : Fedora Project at 2014-10-03 12:40

  Installed: rpm-0:4.12.0.1-3.fc21.x86_64 at 2014-11-08 15:34
  Built    : Fedora Project at 2014-10-28 09:48


$ sudo dnf clean all ; sudo dnf -d 10  update

...
Completion plugin: Generating completion cache...
--> Starting dependency resolution
---> Package kernel.x86_64 3.17.4-301.fc21 will be installed
---> Package kernel-modules-extra.x86_64 3.17.4-301.fc21 will be installed
---> Package kernel-core.x86_64 3.17.4-301.fc21 will be installed
---> Package kernel-modules.x86_64 3.17.4-301.fc21 will be installed
---> Package adwaita-gtk2-theme.x86_64 3.14.2-1.fc21 will be upgraded
---> Package adwaita-gtk2-theme.x86_64 3.14.2.2-1.fc21 will be an upgrade
---> Package gnome-themes-standard.x86_64 3.14.2-1.fc21 will be upgraded
---> Package gnome-themes-standard.x86_64 3.14.2.2-1.fc21 will be an upgrade
---> Package f21-backgrounds-base.noarch 21.0.0-1.fc21 will be upgraded
---> Package f21-backgrounds-base.noarch 21.1.0-1.fc21 will be an upgrade
---> Package f21-backgrounds-gnome.noarch 21.0.0-1.fc21 will be upgraded
---> Package f21-backgrounds-gnome.noarch 21.1.0-1.fc21 will be an upgrade
---> Package kernel-devel.x86_64 3.17.3-300.fc21 will be upgraded
---> Package kernel-devel.x86_64 3.17.4-301.fc21 will be an upgrade
---> Package kernel-headers.x86_64 3.17.3-300.fc21 will be upgraded
---> Package kernel-headers.x86_64 3.17.4-301.fc21 will be an upgrade
---> Package nautilus.x86_64 3.14.1-1.fc21 will be upgraded
---> Package nautilus.x86_64 3.14.2-1.fc21 will be an upgrade
---> Package nautilus-extensions.x86_64 3.14.1-1.fc21 will be upgraded
---> Package nautilus-extensions.x86_64 3.14.2-1.fc21 will be an upgrade
---> Package kernel.x86_64 3.16.7-200.fc20 will be erased
---> Package kernel-modules-extra.x86_64 3.16.7-200.fc20 will be erased
--> Finished dependency resolution
timer: depsolve: 1645 ms
Dependencies resolved.
=============================================================================================================================================================================================================================================
 Package                                                           Arch                                               Version                                                      Repository                                           Size
=============================================================================================================================================================================================================================================
Installing:
 kernel                                                            x86_64                                             3.17.4-301.fc21                                              fedora                                               42 k
 kernel-core                                                       x86_64                                             3.17.4-301.fc21                                              fedora                                               18 M
 kernel-modules                                                    x86_64                                             3.17.4-301.fc21                                              fedora                                               17 M
 kernel-modules-extra                                              x86_64                                             3.17.4-301.fc21                                              fedora                                              2.2 M
Upgrading:
 adwaita-gtk2-theme                                                x86_64                                             3.14.2.2-1.fc21                                              fedora                                               87 k
 f21-backgrounds-base                                              noarch                                             21.1.0-1.fc21                                                fedora                                              4.8 M
 f21-backgrounds-gnome                                             noarch                                             21.1.0-1.fc21                                                fedora                                              8.0 k
 gnome-themes-standard                                             x86_64                                             3.14.2.2-1.fc21                                              fedora                                              2.8 M
 kernel-devel                                                      x86_64                                             3.17.4-301.fc21                                              fedora                                              9.1 M
 kernel-headers                                                    x86_64                                             3.17.4-301.fc21                                              fedora                                              945 k
 nautilus                                                          x86_64                                             3.14.2-1.fc21                                                fedora                                              2.5 M
 nautilus-extensions                                               x86_64                                             3.14.2-1.fc21                                                fedora                                               70 k
Removing:
 kernel                                                            x86_64                                             3.16.7-200.fc20                                              @System                                             138 M
 kernel-modules-extra                                              x86_64                                             3.16.7-200.fc20                                              @System                                             8.2 M

Transaction Summary
=============================================================================================================================================================================================================================================
Install  4 Packages
Upgrade  8 Packages
Remove   2 Packages

Total download size: 58 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): kernel-3.17.4-301.fc21.x86_64.rpm                                                                                                                                                                    114 kB/s |  42 kB     00:00    
(2/12): kernel-modules-extra-3.17.4-301.fc21.x86_64.rpm                                                                                                                                                      254 kB/s | 2.2 MB     00:08    
(3/12): adwaita-gtk2-theme-3.14.2.2-1.fc21.x86_64.rpm                                                                                                                                                        275 kB/s |  87 kB     00:00    
(4/12): gnome-themes-standard-3.14.2.2-1.fc21.x86_64.rpm                                                                                                                                                     245 kB/s | 2.8 MB     00:11    
(5/12): f21-backgrounds-base-21.1.0-1.fc21.noarch.rpm                                                                                                                                                        293 kB/s | 4.8 MB     00:16    
(6/12): f21-backgrounds-gnome-21.1.0-1.fc21.noarch.rpm                                                                                                                                                        32 kB/s | 8.0 kB     00:00    
(7/12): kernel-devel-3.17.4-301.fc21.x86_64.rpm                                                                                                                                                              203 kB/s | 9.1 MB     00:45    
(8/12): kernel-modules-3.17.4-301.fc21.x86_64.rpm                                                                                                                                                            199 kB/s |  17 MB     01:27    
(9/12): kernel-headers-3.17.4-301.fc21.x86_64.rpm                                                                                                                                                            152 kB/s | 945 kB     00:06    
(10/12): nautilus-extensions-3.14.2-1.fc21.x86_64.rpm                                                                                                                                                        206 kB/s |  70 kB     00:00    
(11/12): kernel-core-3.17.4-301.fc21.x86_64.rpm                                                                                                                                                              202 kB/s |  18 MB     01:32    
(12/12): nautilus-3.14.2-1.fc21.x86_64.rpm                                                                                                                                                                   410 kB/s | 2.5 MB     00:06    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        616 kB/s |  58 MB     01:36     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
timer: transaction test: 356 ms
Running transaction
Cleaning up.
Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 182, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 141, in _main
    ret = resolving(cli, base)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 160, in resolving
    base.do_transaction()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 246, in do_transaction
    super(BaseCli, self).do_transaction(display)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 562, in do_transaction
    with lock:
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 85, in __enter__
    pid = self._read_lock()
  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 64, in _read_lock
    return int(f.readline())
ValueError: invalid literal for int() with base 10: ''

Comment 9 Paolo Antinori 2014-12-11 13:30:01 UTC
I have been able to FIX my problem  manually removing this .pid file:

/var/lib/dnf/rpmdb_lock.pid

it was empty, probably a result of some error  or crash and it was never removed by dnf, failing as per stack trace above:


  File "/usr/lib/python2.7/site-packages/dnf/lock.py", line 64, in _read_lock
    return int(f.readline())
ValueError: invalid literal for int() with base 10: ''

Comment 10 Honza Silhan 2015-01-09 16:22:09 UTC
Assigning to our expert on locks. Michael, please take a look. You can either use systemd and implement `dnf.lock.release_all()` method or refactor _try_read_lock or any other solution.

Comment 11 Christian Stadelmann 2015-01-17 14:00:17 UTC
Same problem (backtrace) here, probably happened after an unexpected reboot.

In my case the file /var/lib/dnf/rpmdb_lock.pid does not exist. Instead I found /var/cache/dnf/x86_64/21/metadata_lock.pid. After deleting this file (and running `# dnf clean expire-cache`, did that just to be sure metadata was not corrupted) dnf worked fine again.

Comment 12 Fedora Update System 2015-02-16 00:03:00 UTC
dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21

Comment 13 Fedora Update System 2015-02-17 08:03:54 UTC
Package hawkey-0.5.3-2.fc21, dnf-plugins-core-0.1.5-1.fc21, dnf-0.6.4-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing hawkey-0.5.3-2.fc21 dnf-plugins-core-0.1.5-1.fc21 dnf-0.6.4-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-2139/dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2015-02-20 08:32:10 UTC
hawkey-0.5.3-2.fc21, dnf-plugins-core-0.1.5-1.fc21, dnf-0.6.4-1.fc21 has been pushed to the Fedora 21 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.