Ask Your Question

Dnf won't remove package. (error : Database is locked)

asked 2016-08-05 07:17:38 -0500

bbruyne gravatar image

updated 2016-08-05 13:50:56 -0500

florian gravatar image

I am trying to remove a package by the command line with dnf remove "package" (logged in as root).

It prints out the following :

dnf remove ncurses-devel

Dependencies resolved.
================================================== ==============================
Package Arch Version Repository Size
================================================== ==============================
ncurses-c++-libs x86_64 6.0-5.20160116.fc24 @fedora 150 k
ncurses-devel x86_64 6.0-5.20160116.fc24 @fedora 775 k

Transaction Summary
================================================== ==============================
Remove 2 Packages

Installed size: 926 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
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.5/site-packages/dnf/cli/", line 174, in user_main
errcode = main(args)
File "/usr/lib/python3.5/site-packages/dnf/cli/", line 60, in main
return _main(base, args)
File "/usr/lib/python3.5/site-packages/dnf/cli/", line 120, in _main
ret = resolving(cli, base)
File "/usr/lib/python3.5/site-packages/dnf/cli/", line 149, in resolving
File "/usr/lib/python3.5/site-packages/dnf/cli/", line 228, in do_transaction
super(BaseCli, self).do_transaction(display)
File "/usr/lib/python3.5/site-packages/dnf/", line 607, in do_transaction
File "/usr/lib/python3.5/site-packages/dnf/", line 665, in _run_transaction
[], [], cmdline)
File "/usr/lib/python3.5/site-packages/dnf/yum/", line 1007, in beg
File "/usr/lib/python3.5/site-packages/dnf/yum/", line 969, in _trans_cmdline
if cur is None or not self._update_db_file_2():
File "/usr/lib/python3.5/site-packages/dnf/yum/", line 1628, in _update_db_file_2
executeSQL(cur, "PRAGMA table_info(trans_skip_pkgs)")
File "/usr/lib/python3.5/site-packages/dnf/yum/", line 167, in executeSQLQmark
return cursor.execute(query)
sqlite3.OperationalError: database is locked

I have tried to diseable SELinux by changing the .conf file and rebooting but I have still this error. Reply With Quote

edit retag flag offensive close merge delete


When you paste console output like the above, please mark the text and click on the 101010 icon. That formats the text very nicely...

florian gravatar imageflorian ( 2016-08-05 13:51:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-08-05 13:48:02 -0500

sideburns gravatar image

Welcome to ask.fedora. It sounds like dnf crashed at some point and left the database locked. Normally, a reboot will clear this, but it looks like the lock file is still there. Try using sudo rm /var/cache/dnf/ to delete the lock file and see if that fixes things.

Also, I do hope that you have enabled SELinux again. It's not a good idea to disable it whenever you have an issue, because if you're not getting alerts, it's not a factor.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-08-05 07:17:38 -0500

Seen: 1,047 times

Last updated: Aug 05 '16