“Database Locked” After Adept Manager Crashed

June 5, 2008 · Filed Under Linux · 2 Comments 

The Problem

If you have ever used the Adept package manager for Kubuntu (or other Debian based systems running KDE) you already know how valuable a tool it can be. It provides a very convenient way to install new software and keep your system updated. However, when such a convenient tool suddenly stops working, it can be very disorienting.

This is exactly what happened to me last weekend when I was trying to setup Eclipse on my PC. For those of you who haven’t heard of Eclipse, it is an Integrated Development Environment (IDE) that can be extended with plugins to support new languages, debugging tools, analytic tools, and more. I was planning on using it to manage some of the PHP projects I have been working on lately. I selected Eclipse from the Adept window and installed it, but it only came with the most common languages such as C, C++, and of course Java.

After searching online, I found out that there is an Eclipse project called PDT (PHP Development Tools) that provides exactly the functionality I am looking for, so I started to follow the instructions on the Eclipse PDT page (http://www.eclipse.org/pdt/) to install it on my PC. Since Eclipse is Java based, it needs to run on a Java Virtual Machine.

Unfortunately, the JVM that comes bundled with Kubuntu is GCJ (GNU Compiler for Java) and the Eclipse PDT instructions said that either a Sun or IBM Virtual Machine would be necessary. Luckily that is already a package in Adept, so naturally I selected it to install and clicked next to continue. This was a big mistake apparently, since I overlooked the little checkbox for “I agree”, which you need to scroll to the end of the End User License Agreement (EULA) to even see.

This caused Adept to crash, and it crashed hard. When I tried to open it again it said “Database Locked - Adept Manager” and then a short message that another process had locked the package database - even after restarting my PC. I could still open Adept, but only as read-only which makes it pretty useless.

I could go on and on about how it should have just aborted if I didn’t check the “I agree” box, instead of breaking Adept altogether - it’s not like anyone reads the EULAs anyways, but that’s a rant for another day.

After a little bit of Googling, I found a few posts on the official Ubuntu forums of others who were having similar problems, and one of them (http://ubuntuforums.org/showthread.php?t=348952) had a simple solution using only two commands…

The Solution

To fix the “Database Locked” message, you will need to open a terminal window. To do this, go to the K menu, then to the System submenu, and select Konsole - Terminal Program. Then just type the following two commands one at a time:

sudo apt-get -f install
sudo dpkg –configure -a

That’s it! The first command tries to automatically fix any broken dependancies, which for me just gave an error message. I’m not entirely sure if it is necessary but I would run it anyway. The second command tries to “reconfigure all unpacked but unconfigured Debian packages” (according to the man pages). This ran for a moment listing a bunch of packages, and when it finished I was able to run Adept once again!

I’m not sure whether the culprit for this problem was Adept or the Sun JDK package. I had read about other specific packages causing this problem with Adept, but that doesn’t tell me anything. All of the pages I came across recommended these steps or something very similar. Since this was the simplest approach and it worked like a charm, I would recommend you start with this. As always, you can search the Ubuntu forums or use Google if this doesn’t work.

ss_blog_claim=555660c3e5f182ceb4fe4f9158f3d75e ss_blog_claim=555660c3e5f182ceb4fe4f9158f3d75e