Select Page

How to Fix Unable to Lock Database Error in Arch Linux

How to Fix Unable to Lock Database

When I try to update my machine by running sudo pacman -Syyu I get an error saying it’s unable to lock the database. Below is an example:

But as you may have noticed, by removing a special database lock file, I was able to solve the issue. You can do this with sudo privileges by running:

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

The above method is dangerous

I’ve done this before, and it’s worked perfectly fine with no issues. But the reason the db.lck file exists is to ensure that only one program can run updates at a time. This prevents partial updates, or interrupted updates, or conflicts, or any other problems that can occur when two programs try to do the same update at the same time.

So before you go deleting your db.lck file like I did, do yourself a favor and make absolute certain that there are no other programs trying to update anything. You can use the lsof command to check what other programs are using the db.lck file. lsof is short for “list open files”.

The lsof command will either return nothing or a single number. If it returns nothing, that means that no process is currently using that file. If it does return a number, then that is the ID of the process currently using that file. In order to delete the file safely, you’ll need to kill that process first. You can do that by running sudo kill -9 <process_id>

Hope that helps! Please leave a comment below if you have any questions. You can find more information on using the command line, check out this awesome book called The Linux Command Line. It’s free!

Check out more articles

How to Generate a Ranger Config File

ranger --copy-config=all This will copy all the default config files from /usr/local/lib so you can make edits without messing anything up. Huge shout out to https://dquinton.github.io/debian-install/config/ranger.html for explaining this and so much more. Took me a...

First Open Source Contribution

Surprise! I genuinely did not plan on making my first ever open source contribution today. In fact, I didn't plan on a lot of things happening this week at all. I recently got an awesome opportunity to work on a site that is being hosted on a platform called Pantheon,...

How to Exclude Specific Posts and Pages from WP_QUERY

For the sake of having something to work with, let's suppose we've got the following query:In this query, inside the $args array, there's a special parameter that allows you to exclude specific posts and pages from the query. This parameter is called post__not_in and...

Configure SSH For Password-less Connections

Preamble I'm slightly embarrassed to admit this, but it was a long time before I figured out how amazing this little file is and how exactly to put it to good use. The file I'm talking about is the SSH config file. By default, when you first connect to a server via...

WordPress Site Stuck in Maintenance Mode

Plugin Error Code 500 During Update While I was updating a WordPress plugin locally, something happened on my local server to trigger a 500 error code as the plugin was updating. On the frontend, I refreshed the page and was greeted with "Briefly Unavailable for...

Creating a WordPress Plugin Downloader

How it Started I was recently tasked with the challenge of creating a WordPress theme generator. The idea being, instead of writing your style.css file from scratch, you'd be able to just answer a few simple questions about how you'd like your theme set up, and those...

Fix Audio on XFCE Chromebook

The Problem After moving from GalliumOS to Xubuntu, I noticed that playing YouTube videos on both Firefox and Chromium would result in decent playback for a few minutes, but suddenly the audio would turn into a solid beeping tone while the YouTube video displayed the...

Adjust Trackpad Sensitivity XFCE

xinput set-prop "Elan Touchpad" "Synaptics Finger" 1 1 1 What are the values 1 1 1? This sets the sensitivity as close to the original ChromeOS as possible. Larger numbers will decrease sensitivity of various aspects. I never looked into which individual value...

Fireworks (Short Film)

https://vimeo.com/395077249 About the film Year: 2020 Director/DP: Tim Searfoss Writers: Matt Jones, Tim Searfoss Sound Mix: Matt Jones

Hosting Multiple Sites Using LocalWP

I've done a write-up on hosting local WordPress sites before, but I definitely prefer this method over the previous one. If you've never tried hosting multiple sites using LocalWP, then I'd encourage you to check it out. I've had really bad issues with it in the past,...