添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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 ~
                After you uninstall it, did you confirm that the installation directory is empty? Do you have any antivirus software running? (try disabling it)
– HolyBlackCat
                Apr 16, 2022 at 14:26

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 :

    For solution 1 : Mr. Padro's (https://stackoverflow.com/users/18910613/pedro) solution helped me.

    For solution 2 https://www.reddit.com/r/archlinux/comments/nvrny2/pacman_error_failed_to_synchronize_all_databases/

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.

  •