Bug 1639863

Summary: [abrt] dnf: __init__(): transaction.py:729:__init__:RuntimeError: Exec failed: attempt to write a readonly database
Product: [Fedora] Fedora Reporter: Artem <ego.cordatus>
Component: dnfAssignee: rpm-software-management
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: dima, dmach, jrohel, mblaha, mhatina, packaging-team-maint, peter.hutterer, redhat-bugzilla, rpm-software-management, shecks, vascom2, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/7263fc9413b96d399088985e77d318625cc81850
Whiteboard: abrt_hash:194afdefe36d68bfed8c8a2aeb22c89d0df21545;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-19 11:47:29 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:
Attachments:
Description Flags
File: _var_log_dnf.log
none
File: backtrace
none
File: cgroup
none
File: cpuinfo
none
File: environ
none
File: mountinfo
none
File: namespaces
none
File: open_fds
none
File: dnf-makecache.log
none
dnf -C info none

Description Artem 2018-10-16 18:49:18 UTC
Description of problem:
dnf info doesnt work without root privileges.

Version-Release number of selected component:
dnf-4.0.4-1.fc29

Additional info:
reporter:       libreport-2.9.6
.~lock._var_log_dnf.log#: ,user,localhost.localdomain,16.10.2018 21:48,file:///home/user/.config/libreoffice/4;
cmdline:        /usr/bin/python3 /usr/bin/dnf info dnf
crash_function: __init__
exception_type: RuntimeError
executable:     /usr/bin/dnf
interpreter:    python3-3.7.0-9.fc29.x86_64
kernel:         4.18.13-300.fc29.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
transaction.py:729:__init__:RuntimeError: Exec failed: attempt to write a readonly database

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.7/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 115, in cli_run
    cli.run()
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 1055, in run
    return self.command.run()
  File "/usr/lib/python3.7/site-packages/dnf/cli/commands/__init__.py", line 219, in run
    self.opts.packages)
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 438, in output_packages
    '=' : clir, 'not in' : clie})
  File "/usr/lib/python3.7/site-packages/dnf/cli/output.py", line 633, in listPkgs
    print(self.infoOutput(pkg, highlight=highlight) + "\n")
  File "/usr/lib/python3.7/site-packages/dnf/cli/output.py", line 504, in infoOutput
    history_repo = self.history.repo(pkg)
  File "/usr/lib/python3.7/site-packages/dnf/db/history.py", line 362, in repo
    return self.swdb.getRPMRepo(str(pkg))
  File "/usr/lib/python3.7/site-packages/dnf/db/history.py", line 291, in swdb
    self._swdb = libdnf.transaction.Swdb(self.dbpath)
  File "/usr/lib64/python3.7/site-packages/libdnf/transaction.py", line 729, in __init__
    this = _transaction.new_Swdb(*args)
RuntimeError: Exec failed: attempt to write a readonly database

Local variables in innermost frame:
self: <libdnf.transaction.Swdb;  >
args: ('/var/lib/dnf/history.sqlite',)

Comment 1 Artem 2018-10-16 18:49:36 UTC
Created attachment 1494542 [details]
File: _var_log_dnf.log

Comment 2 Artem 2018-10-16 18:49:41 UTC
Created attachment 1494543 [details]
File: backtrace

Comment 3 Artem 2018-10-16 18:49:43 UTC
Created attachment 1494544 [details]
File: cgroup

Comment 4 Artem 2018-10-16 18:49:45 UTC
Created attachment 1494545 [details]
File: cpuinfo

Comment 5 Artem 2018-10-16 18:49:47 UTC
Created attachment 1494546 [details]
File: environ

Comment 6 Artem 2018-10-16 18:49:50 UTC
Created attachment 1494547 [details]
File: mountinfo

Comment 7 Artem 2018-10-16 18:49:52 UTC
Created attachment 1494548 [details]
File: namespaces

Comment 8 Artem 2018-10-16 18:49:53 UTC
Created attachment 1494549 [details]
File: open_fds

Comment 9 Artem 2018-10-16 18:49:56 UTC
Created attachment 1494550 [details]
File: dnf-makecache.log

Comment 10 Dima Ryazanov 2018-10-16 21:18:43 UTC
Similar problem has been detected:

Ran "dnf info" as a non-root user

reporter:       libreport-2.9.6
cmdline:        /usr/bin/python3 /usr/bin/dnf info
crash_function: __init__
exception_type: RuntimeError
executable:     /usr/bin/dnf
interpreter:    python3-3.7.0-9.fc29.i686
kernel:         4.18.13-300.fc29.x86_64
package:        dnf-4.0.4-1.fc29
reason:         transaction.py:729:__init__:RuntimeError: Exec failed: attempt to write a readonly database
runlevel:       N 5
type:           Python3
uid:            1000

Comment 11 Shecks 2018-10-17 12:10:50 UTC
Similar problem has been detected:

Just ran "dnf check-update --refresh" to check for updates and it failed with the following errors:

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.7/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 115, in cli_run
    cli.run()
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 1055, in run
    return self.command.run()
  File "/usr/lib/python3.7/site-packages/dnf/cli/commands/__init__.py", line 283, in run
    found = self.base.check_updates(self.opts.packages, print_=True)
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 301, in check_updates
    columns = _list_cmd_calc_columns(self.output, ypl)
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 109, in _list_cmd_calc_columns
    _add_pkg_simple_list_lens(data, opkg, indent=" " * 4)
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 93, in _add_pkg_simple_list_lens
    rid = len(pkg._from_repo)
  File "/usr/lib/python3.7/site-packages/dnf/package.py", line 84, in _from_repo
    pkgrepo = self.base.history.repo(self)
  File "/usr/lib/python3.7/site-packages/dnf/db/history.py", line 362, in repo
    return self.swdb.getRPMRepo(str(pkg))
  File "/usr/lib/python3.7/site-packages/dnf/db/history.py", line 291, in swdb
    self._swdb = libdnf.transaction.Swdb(self.dbpath)
  File "/usr/lib64/python3.7/site-packages/libdnf/transaction.py", line 729, in __init__
    this = _transaction.new_Swdb(*args)
RuntimeError: Exec failed: attempt to write a readonly database

reporter:       libreport-2.9.6
cmdline:        /usr/bin/python3 /usr/bin/dnf check-update --refresh
crash_function: __init__
exception_type: RuntimeError
executable:     /usr/bin/dnf
interpreter:    python3-3.7.0-9.fc29.x86_64
kernel:         4.18.14-300.fc29.x86_64
package:        dnf-4.0.4-1.fc29
reason:         transaction.py:729:__init__:RuntimeError: Exec failed: attempt to write a readonly database
runlevel:       N 5
type:           Python3
uid:            1000

Comment 12 Julius B. 2018-10-18 19:55:30 UTC
This is probably a duplicate of bug#1639863, which will be fixed in libdnf-0.22.0-1.

Comment 13 Julius B. 2018-10-18 19:57:55 UTC
(In reply to Julius B. from comment #12)
> This is probably a duplicate of bug#1639863, which will be fixed in
> libdnf-0.22.0-1.

Sorry, bug#1640235 is the correct one.

Comment 14 Artem 2018-10-18 20:04:51 UTC
(In reply to Julius B. from comment #12)
> which will be fixed in libdnf-0.22.0-1.

I have installed libdnf-0.22.0-2.fc29 and still experiencing this issue.

Comment 15 Julius B. 2018-10-18 21:07:36 UTC
Sorry, I mixed up the versions. libdnf-0.22.0-2 is the one that introduced the bug, libdnf-0.22.0-3 will be the one with the fix. You can check and download it already from koji: https://koji.fedoraproject.org/koji/packageinfo?packageID=22852

Comment 16 Artem 2018-10-19 09:38:54 UTC
(In reply to Julius B. from comment #15)
No prob. I've install this packages from koji but unfortunately still doesn't work.

Attached log file.

Comment 17 Artem 2018-10-19 09:39:51 UTC
Created attachment 1495597 [details]
dnf -C info

Comment 18 Jaroslav Rohel 2018-10-19 11:47:29 UTC
More info in 1640235 bug.
Please the fix is applied after first command that opens swdb but it has to be run as a root. Like "sudo dnf list"

*** This bug has been marked as a duplicate of bug 1640235 ***