Matt Jones Tech
  • Blog
  • Video Projects
  • Web Projects
  • 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!

    matt

    April 28, 2020
    General Computing, Linux, Manjaro
    arch, linux, manjaro, package manager, troubleshooting, ubuntu, update
  • How to Remove a PPA via the Command Line

    How to Remove a PPA via the Command Line

    If you’ve used Linux for any amount of time, you’ve probably come across a PPA. A PPA is short for Personal Page Archive. If you’re looking for a specific piece of software not available in the official software store for your distro, you might look into adding a PPA. Most software that is offered via PPA includes the installation instructions to add their PPA and get everything installed. However, not every software includes instructions on how to remove their PPA and uninstall everything. In this tutorial, we’re gonna learn how to remove a PPA via the command line.

    Side Thoughts

    As far as I’ve heard on forums and StackOverflow and pretty much everywhere else, it’s typically not the best idea to install software using a PPA. I did it a few years ago when I was first getting into linux, but I don’t do it at all anymore. Generally speaking, PPAs aren’t the safest thing to be using and I really don’t have much need for them anymore. In fact, on of the biggest reasons I switched to Manjaro a while back was because of the massive AUR (Arch User Repository). There you can find a massive community of Arch users who have created a ton of software and configured it just for Arch. Still getting the hang of it, but so far it’s been amazing.

    Now for the Actual Tutorial

    If you happen to know the exact URL of your PPA, you can remove it by using the --remove flag:

    sudo add-apt-repository --remove ppa:otto-kesselgulasch/gimp

    Not that you’d ever remove GIMP! It’s an awesome photo manipulation program and it’s included in official software stores in most distros anyway.

    If you don’t know or can’t remember your exact PPA location, you can browse all the files in /etc/apt/sources.list.d/

    ~$ cd /etc/apt/sources.list.d/
    ~$ ls

    Once you find the PPA you wanna trash, just run:

    ~$ sudo rm nameOfThatPPA.list

    also, if you have a .save file paired with it, just trash it as well.

    ~$ sudo rm nameOfThatPPA.save

    matt

    January 5, 2020
    General Computing, Linux, Ubuntu
    linux, package manager, PPA, ubuntu, update

Prove all things; hold fast that which is good. 1 Thess 5:21