dnf Hangs Waiting for Process to Finish

If after entering a dnf command into your terminal window you receive the message "Waiting for process to finish" it may be because dnf is locked. To find out if there is a lock enter the command shown in the box.

ls /var/cache/dnf/*pid

If the previous command shows the file metadata_lock.pid then it should be removed using the following command.

sudo rm /var/cache/dnf/metadata_lock.pid

Hopefully, you now have access to dnf without having to wait for the process to finish. Please remember dnf may have been doing something important whereby it would be more advisable to let it finish rather than simply unlocking the process prematurely.