To start Code and Compile C++, must install a compiler. For my case, it is MSYS2 through which MinGW is available. According to the installation guild mentioned on the website, I installed the software without any errors. Now I was supposed to update the package database and base packages by entering pacman -Sys but it has shown an error error: failed to synchronize all databases (unable to lock database)
After searching online for a solution I found that deleting/removing the db.lck will work, for that, I used this command rm /var/lib/pacman/db.lck but it showed another error. Right now there is no solution to this on the internet. I've also pasted the terminal output of MSYS2 MSYS for refernce.
$ pacman -Sys :: Synchronizing package databases... error: failed to synchronize all databases (unable to lock database) VIRAT@DESKTOP-97BS0AB MSYS ~ $ rm /var/lib/pacman/db.lck rm: cannot remove '/var/lib/pacman/db.lck': No such file or directory VIRAT@DESKTOP-97BS0AB MSYS ~ $ pacman -S --needed base-devel mingw-w64-x86_64-toolchain error: failed to init transaction (unable to lock database) error: could not lock database: Permission denied VIRAT@DESKTOP-97BS0AB MSYS ~ $ pacman -Su error: failed to init transaction (unable to lock database) error: could not lock database: Permission denied VIRAT@DESKTOP-97BS0AB MSYS ~ $ 62 Answers
Try to run MSYS app under administrator privilege... worked for me
As I found there 2 solutions for this error. Try both :
Solution : 1
C:\Users\your_account_name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MSYS2 64bit
Run "MSYS2 MSYS" as administrator
Run the command : pacman -Syu
Solution - 2 :
C:\msys64\var\lib\pacman ( Go to the downloaded folder)
Delete the "db.lck" file
RESOURCES :