Update error: failed to obtain lock 'metadata': Failed to create file "/var/run/dnf-metadata.lock.87G801": Permission denied

I entered the IVPN install commands before uninstalling the Proton VPN app and started getting this error message on the Software update tab. How can I fix this? I’ve tried the following commands mentioned in this discussion but they didn’t help.

rpm-ostree cleanup -m
sudo ostree fsck
sudo ostree admin cleanup

I’ve since replaced Proton with IVPN and used the following commands to remove Proton and its repo:

To remove the application
rpm-ostree uninstall protonvpn && sudo rm -rf /usr/lib/python3.*/site-packages/proton* && sudo rm /etc/yum.repos.d/protonvpn-stable.repo

to remove the repo
sudo rm /etc/yum.repos.d/protonvpn-stable.repo

but the repo remained so I tried rpm-ostree reset and rebooted but the issue persisted. I’ve reinstalled IVPN and thinking I may need to reinstall the OS.

Your problem is a conflict between Gnome Software and rpm-ostree version of the metadata.

To fix, try this:

gnome-software --quit
rpm-ostree cleanup --repomd
rpm-ostree refresh-md

Then reopen Gnome Software.

My bad, I checked and the stable Proton repo was still there. I tried doing a repo reset, running your commands, and rebooting but the error code just shifted and I still can’t update.

Is it fixed now?

It’s not.

Please send the new error message.

The only thing that changes is the code after

.lock.

IVPN seems to be having connection issues though. I think it’ll be simpler to just reinstall the OS and start fresh.

There is no Proton repo in this screenshot.

The last screenshot does not mention anything about Proton either.

So where have you checked and seen the Proton repo?


It seems like the problem is with GNOME Software. Can you try upgrading via cli?

$ rpm-ostree upgrade

If there is any error or other output that you need to show, please copy and paste the full command and output, instead of taking a screenshot. Text is easier to read and search.

This may be the issue: [BUG] Some dnf repos break GNOME Software · Issue #295 · fedora-silverblue/issue-tracker · GitHub

But we should see the output of the upgrade attempt first.


Btw, the “code” at the end of /var/run/dnf-metadata.lock.[...] is not an error code. It’s just a randomly generated filename.

I believe, worst case scenario if nothing else works, he could just delete that file with sudo rm.

Because he already cleared and re-fetched the metadata and the problematic file is still there, so best case scenario deleting it fixes the problem, worst case scenario the problematic file is re-created.

1 Like

That upgrade command did seem to upgrade some things but upon reboot, the Software app still gives the error message.

Do you know what command I would need to enter for that? I don’t see any Proton files left and am not sure what needs to go now.

First, let’s verify that there is nothing left related to Proton in your repo files:

$ grep -ril proton /etc/yum.repos.d/

There should be no output.

Next, I recommend you do a reboot, just to see if it clears things up with GNOME Software. If Software still gives the same error message after that, then try to delete the lock files.

$ gnome-software --quit
$ find -L /var/run -maxdepth 1 -type f -name 'dnf-metadata.lock.*' -print -delete

It should print 1 or more filenames of the lock files as it deletes them. Then run GNOME Software again and see if it works.

I entered those commands and nothing happened —the terminal didn’t even give any output and Software still gives the error.

It seems like the problem is no longer Proton.

Does this command give any results?

$ grep -r 'repo_gpgcheck=[1Ty]' /etc/yum.repos.d/
grep -r 'repo_gpgcheck=[1Ty]' /etc/yum.repos.d/
/etc/yum.repos.d/ivpn.repo:repo_gpgcheck=1
/etc/yum.repos.d/ivpn.repo.1:repo_gpgcheck=1
/etc/yum.repos.d/ivpn.repo.2:repo_gpgcheck=1

Why do you have 3 IVPN repo files? Maybe you ran the wget ... commands from IVPN instructions 3 times? If they are identical, you should delete the two files that are named with .1 and .2 (which are invalid names for repo files anyway).

Refer to the previously mentioned issue for possible workarounds for this bug. The simplest workaround is to disable the repo_gpgcheck by changing the value to 0.

If you do this, I recommend you subscribe to the issue and eventually undo the workaround once it is fixed.

At first, IVPN didn’t get installed properly likely due to Proton running and then after running the clean repos command it stopped working so I ran the command again. I didn’t know how to check if the repo was still present. Do you know how I can delete the extra two? Editing root folders seems like a challenge…

/etc on Silverblue is writable, so the command to remove files owned by root there[1] is the same as Workstation or any other distro: sudo with rm.

Use it carefully—there’s no undo!

Tab-completion can help you target the right files (type each path you want to delete partially, then press the Tab key to complete it).

For this time, you can copy this exact command to delete the two files:

$ sudo rm /etc/yum.repos.d/ivpn.repo.1 /etc/yum.repos.d/ivpn.repo.2

Also, to edit the remaining ivpn.repo file in your default cli editor:

$ sudoedit /etc/yum.repos.d/ivpn.repo

  1. or more accurately, files in a directory that is not writable by your user ↩︎

1 Like

This was the solution. Needed to set IVPN’s repo gpc check to “0” with that second command (minus the “$”). Thanks, everyone!

The $ represents the prompt (your actual prompt usually has more info like your username and hostname, but ends in a $). It helps to differentiate between lines that you enter as commands, and lines that are output.

$ also means the command should be entered as a normal user. # is for the root user. But this usage is less common nowadays as desktop users mainly use sudo instead of switching to root.

What does the ‘$’ mean in command line commands? - Stack Overflow

1 Like