Fix “Pacman is currently in use please wait” on Arch / Manjaro

I experienced an error message recently while trying to install snapd on Arch Linux – “Pacman is currently in use, please wait..”. This would keep showing indefinitely:

....
==> Leaving fakeroot environment.
==> Finished making: snapd 2.51.4-1 (Mon Aug 30 18:22:36 2021)
==> Installing package snapd with pacman -U...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...
==> Pacman is currently in use, please wait...

A reboot on the server couldn’t resolve the issue. After an informed troubleshooting I discovered the issue is related to Pacman database lock.

$ ls /var/lib/pacman/db.lck

The db.lck file exists to ensure that only one program can run updates or package installation at a time. This prevent s conflicts in package installation, interrupted installations/updates or partial updates in the system.

If the file exists, you need to remove it since it prevents pacman from creating a new lock as it executes.

But before deleting the database lock, confirm there are no other programs trying to update or install anything:

sudo ps aux | egrep -i 'yay|pacman|yaourt'

An identified process can be killed manually using kill command:

sudo kill -9 <pid>

Once you confirm no process executed by an individual or via automation scripts, you can safely delete the file:

sudo rm /var/lib/pacman/db.lck

After that, running the installation of snapd package from previous build was successful:

$ makepkg -si
==> WARNING: A package has already been built, installing existing package...
==> Installing package snapd with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) snapd-2.51.4-1

Total Installed Size:  55.81 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                                         [########################################################################] 100%
(1/1) checking package integrity                                                                                       [########################################################################] 100%
(1/1) loading package files                                                                                            [########################################################################] 100%
(1/1) checking for file conflicts                                                                                      [########################################################################] 100%
(1/1) checking available disk space                                                                                    [########################################################################] 100%
:: Processing package changes...
(1/1) installing snapd                                                                                                 [########################################################################] 100%
Optional dependencies for snapd
    bash-completion: bash completion support
    xdg-desktop-portal: desktop integration
:: Running post-transaction hooks...
(1/3) Reloading system manager configuration...
(2/3) Arming ConditionNeedsUpdate...
(3/3) Reloading system bus configuration...

We hope this short guide has been helplful in fixing an issue relating to Pacman db.lck.

Tags:

  • Fix unable to lock database in Pacman / Yaourt / Yay
  • Fix could not lock database in Pacman / Yaourt / Yay
  • Fix Pacman is currently in use, please wait
  • Fix /var/lib/pacman/db.lck issues in Pacman

More guides on Arch Linux based distributions:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Android Studio, which is based on IntelliJ IDEA, is the official Integrated Development Environment for developing Android apps. On top […]

In this guide, we will walk through how to install Webmin on AlmaLinux 9 or Oracle Linux 9. Webmin is […]

Grub, an acronym of Grand Unified Bootloader is the most preferred boot loader on Linux systems although there are others […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.