Alter Database Failed Because a Lock Could Not Be Placed on Database mdsdb Try Again Later
The other solar day, I was most to update my Arch Linux system. When I try to update the organization, I encountered with "unable to lock database" error in Arch Linux. I could not install or remove any packages.
Hither is the command that I entered to update my Arch Linux system:
# pacman -Syu
And, It returned the post-obit fault:
:: Synchronizing bundle databases... fault: failed to update cadre (unable to lock database) error: failed to update extra (unable to lock database) fault: failed to update customs (unable to lock database) fault: failed to update multilib (unable to lock database) error: failed to synchronize any databases error: failed to init transaction (unable to lock database) error: could non lock database: File exists if you're certain a package director is not already running, you lot tin remove /var/lib/pacman/db.lck
The beauty of Linux distros is sometimes they will the explicitly display the solution along with the error message. As you can see in the to a higher place output, it says: ".. you tin remove /var/lib/pacman/db.lck".
So, I simply deleted the aforementioned file with command:
$ sudo rm /var/lib/pacman/db.lck
Voila! Information technology worked. I tin and then able to update, install and remove without whatever problems.
$ pacman -Syu
Sample output:
:: Synchronizing package databases... cadre 122.8 KiB 162K/due south 00:01 [######################] 100% extra 1771.8 KiB 249K/s 00:07 [######################] 100% community 3.iii MiB 256K/s 00:13 [######################] 100% multilib 163.5 KiB 265K/southward 00:01 [######################] 100% :: Starting full organization upgrade... resolving dependencies... looking for conflicting packages... Packages (viii) ca-certificates-mozilla-three.22-1 coreutils-8.25-ane curl-7.47.1-1 gcc-5.iii.0-iv gcc-libs-5.3.0-4 libgcrypt-i.half-dozen.v-1 nano-ii.five.ii-i pacman-mirrorlist-20160208-ii Full Download Size: 42.79 MiB Full Installed Size: 187.ninety MiB Net Upgrade Size: 0.91 MiB :: Go along with installation? [Y/n] y :: Retrieving packages ... gcc-libs-5.3.0-4-x86_64 12.vii MiB 261K/due south 00:50 [######################] 100% coreutils-viii.25-1-x86_64 2.1 MiB 262K/s 00:08 [######################] 100% ca-certificates-moz... 363.0 KiB 241K/s 00:02 [######################] 100% curl-7.47.1-i-x86_64 798.3 KiB 263K/s 00:03 [######################] 100% gcc-v.three.0-4-x86_64 26.one MiB 247K/s 01:48 [######################] 100% libgcrypt-1.6.5-ane-ten... 403.5 KiB 244K/s 00:02 [######################] 100% nano-ii.5.2-1-x86_64 407.0 KiB 262K/southward 00:02 [######################] 100% pacman-mirrorlist-2... 5.3 KiB 408K/s 00:00 [######################] 100% (viii/8) checking keys in keyring [######################] 100% (eight/eight) checking parcel integrity [######################] 100% (8/8) loading package files [######################] 100% (8/8) checking for file conflicts [######################] 100% (8/8) checking bachelor disk infinite [######################] 100% :: Processing bundle changes... (ane/8) upgrading gcc-libs [######################] 100% (2/8) upgrading coreutils [######################] 100% (3/viii) upgrading ca-certificates-mozilla [######################] 100% (iv/eight) upgrading curl [######################] 100% (5/8) upgrading gcc [######################] 100% (6/8) upgrading libgcrypt [######################] 100% (vii/eight) upgrading nano [######################] 100% (8/eight) upgrading pacman-mirrorlist [######################] 100% warning: /etc/pacman.d/mirrorlist installed equally /etc/pacman.d/mirrorlist.pacnew
Hope this helps.
Source: https://ostechnix.com/how-to-fix-unable-to-lock-database-error-in-arch-linux/
25 comments
Deepak August 11, 2018 - eight:11 am
hey yard unable to delete db.lck file. it showing even deceit open.
plz help me.
Reply
sk August 11, 2018 - 10:30 am
If your user has sudo permissions, you lot can definitely delete that file.
Reply
Alessandro Dec 14, 2018 - 10:13 pm
Thank yous, this article is helpful!
Answer
I utilise arch btw... February 15, 2019 - six:25 am
Excellent piece of work! My Manjaro install didn't bear witness the location of the lock file, and then thanks for the guide!
Reply
islamux June 30, 2019 - 6:58 pm
Thank you , it's helpful.
Answer
mahi July 22, 2019 - one:21 am
now (21.07.2019) it does not(((
[… ~]$ sudo pacman -Syu
[sudo] password for …:
:: Synchronizing bundle databases…
error: failed to update core (unable to lock database)
error: failed to update extra (unable to lock database)
error: failed to update community (unable to lock database)
error: failed to update multilib (unable to lock database)
error: failed to synchronize all databases
EOF
Reply
Sebastian September 27, 2019 - 12:39 am
Give thanks you, that brought my system dorsum!
Answer
jes July 27, 2021 - 10:22 pm
Thanks a lottttt human . It workssss
Reply
IgorT Nov 4, 2019 - x:56 pm
Thank you sir!
Reply
Jesus Hernandez December fifteen, 2019 - 7:57 pm
I just had the same problem just without information technology saying the solution you got at the buttom. I still tried running your command to delete that file and information technology worked. Thanks!
Respond
annonoymous March eleven, 2020 - half-dozen:24 am
THANK YOU And so MUCH IVE BEEN STRUGGLING WITH THIS FOR HOURS :)
Respond
Manish March 20, 2020 - 10:28 pm
$ sudo rm /var/lib/pacman/db.lck
[sudo] password for xyz:
rm: cannot remove '/var/lib/pacman/db.lck': No such file or directory
$ pacman -Syu
error: you cannot perform this operation unless you are root.
$ pacman -Syu
error: you cannot perform this operation unless you are root.
$ sudo rm /vr/lib/pacman/db.lck
rm: cannot remove '/vr/lib/pacman/db.lck': No such file or directory
$
Answer
sk March 21, 2020 - 11:43 am
Bank check if your user is in sudoers list and then delete the file. There is a typo in this line – "/vr/lib/pacman/db.lck". It is var, not vr.
Reply
Harsh Sanmukhani April 22, 2020 - three:01 pm
thanks information technology works for me…. :)
Reply
Mohammed May 23, 2020 - seven:17 am
Cheers so much it works
Reply
Yash July 12, 2020 - 6:31 pm
I got error : failed retrieving file core.db
Reply
sk July 13, 2020 - eleven:24 am
Reply
IMM August 26, 2020 - eleven:29 am
Hey. I use 'Thunar Root' to open '/var/lib/pacman/' then I delete 'db.lck'
It works for me
Hope this help
Answer
Kunle Apata August 8, 2021 - 10:05 am
Please how do you use Thunar root to delete the lock files.
Thank you.
Reply
sk Baronial 8, 2021 - 6:27 pm
Hi Kunle,
Open Terminal and run the following command to open Thunar file manager equally root:
pkexec thunar
Scan the file location and delete it normally. Please make sure you accept selected the right file name before deleting information technology.
Answer
Moein from iran September 27, 2020 - two:26 am
thank you a lot
Reply
btw Nov 10, 2020 - 4:46 pm
Thx :D <3
Reply
Matthew Nov 6, 2021 - 7:45 am
No such file or directory mistake cannot remove help
Reply
sk November 6, 2021 - 11:32 am
Share the output of the following command:
sudo pacman -Syu
Reply
Sami February 19, 2022 - four:xvi am
Thanks, information technology worked.
Respond