Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in a pretty bad situation right now. I ran the following terminal commands to upgrade my Laptop from 12.04 LTS to 14.04 LTS, and left my computer to let it sit to do its thing. When I came back, the terminal window that was running the upgrade contained some prompt about installing an upgrade to the package manager. The moment I touched my keyboard to respond to said prompt, the terminal window closed mid upgrade...

Commands I ran:

$ sudo apt-get update
$ sudo apt-get install update-manager-core
$ sudo do-release-upgrade

I'm not to concerned about those, since they were working. Only felt the need to use them because my update manage still hadn't picked up 14.04 by like 4:00PM today and that's the way I know to make it grab it.

How can I fix things and get my system sane again? I'm currently able to use it, it's just the following issues are present: Any time I try to access the update manager, I see a prompt with the header "Not all Updates can be installed" with details and the options "Partial Upgrade" and "Continue". Clicking continue gets me the following message.

Software Index is Broken:

It is impossible to install or remove any software. Please use the package manager    
"Synaptic" or run "sudo apt-get install -f" in a terminal to fix this issue at first."

Trying to run the mentioned command generates the terminal error:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily   
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

lsb_release.a lists that I am on 14.04, but I definitely appear to be between versions. I've tried to re-start the upgrade process but get greeted with the same error in the terminal window that I mentioned earlier when I do. I haven't attempted a system reboot, but I'm scared to, since I think it will break my OS.

How on earth can I fix this mess?

share|improve this question
I can provide details as necessary. Just let me know what you need to know. You guys are the best! – Ryan Barker Apr 17 '14 at 22:29
The update manager hadn't picked it up yet because there was nothing to pick up. The meta-release file hasn't been updated due to infrastructure issues. – saiarcot895 Apr 17 '14 at 22:34
On fixing this, start with sudo apt-get install -f. You'll probably have to go through the upgrade fully manually. – saiarcot895 Apr 17 '14 at 22:35
Actually, do what hamhut1066 posted first regarding removing the lock file. – saiarcot895 Apr 17 '14 at 22:38
I've had this happen before. The best course of action is to back up your /home directory, then do a clean install and restore it. During the install, be sure to choose "Something Else" for the installation method. Then, create a linux-swap partition, a / partition, and a /home partition. Then you can follow the same course of action for future upgrades, without formatting /home. As a result, you keep your files with zero chance of problems. – Dillmo Apr 17 '14 at 22:54
up vote 2 down vote accepted

I would say that the best that you could do is to backup your data, keep your settings ( ~/.config/ etc, see below) and do a clean install of 14.04, because I think that more things than just your package management system may have been messed up.

Finding out what has happened and how to fix it would be a very difficult thing to do.

A full guide for settings backup is Best way to backup all settings, list of installed packages, tweaks, etc?

For a start what to backup - and to make very clear it's not just ~/.config/:
At least any dir of file in $HOME starting with a dot, ~/.*. You can then sort out things like large, irrelevant dirs or subdirs: ~/.thumbnails, ~/.mozilla/firefox/*/CACHE ... - There is certainly more config data elsewhere; but not much more.

share|improve this answer
No, I do not think that makes sense at this point in time. He does not need to know what happened, just to repair the package management state. Which, in an ideal world, would be automatic anyway. – Volker Siegel Apr 17 '14 at 22:40
I think that we do not know in which point of the installation it crashed, so it may have messed up more things than just the package management. As he says, My system settings are all royally screwed up... It's missing most of its options. – hakermania Apr 17 '14 at 22:41
Ok, but it could be that just some of the programs handling the settings are messed up, with the data still intact, but just ignore right now. It would be normal that some programs are still running, but were already uninstalled or replaced. Linux supports that, but it can mess up this kind of program for sure. – Volker Siegel Apr 17 '14 at 22:44
I want to see if I can figure this out before going that route, but I can do that if necessary. Is there a guide on what exact config files to back up to keep your settings? – Ryan Barker Apr 17 '14 at 22:44
please see updated answer. – hakermania Apr 17 '14 at 22:56

as I can't comment, I'll try and address what seems to be the problem. did you C^c anything on the install? as it seems that one of the updates crashed unexpectedly. (could not get lock).

The course of action I would recommend would be to first check that no update managers, or rogue threads are trying to update your system. ps -e | grep apt. kill anything that comes up.

Second, you'll need to delete the lock file for aptitude removing the lock file should solve this rm /var/lib/dpkg/lock.

After this, try running apt-get update && apt-get upgrade. This should hopefully get you back to were you were.

It seems that the first error you're coming across is related to the package manager. Broken Software Index Repair. Try going through that and see if it unlocks, and resets your application database.

share|improve this answer
I didn't CTRL C, the window just closed as I mentioned. Trying to remove the lock file with sudo rm /var/lib/dpkg/lock generated the message: "rm: cannot remove ‘/var/lib/dpkg/lock’: No such file or directory" No update managers were running. apt-get update && apt-get upgrade generated the same error as before. – Ryan Barker Apr 17 '14 at 22:41
okay, can you run lsof /var/lib/dpkg and post the output? – hamhut1066 Apr 17 '14 at 22:44
I don't get any output with that command. Just takes me to another terminal line. – Ryan Barker Apr 17 '14 at 22:45
okay, that was testing to see if any applications were accessing files in that dir. looking around, there seems to be a solution here‌​. run through that and see if that makes a difference – hamhut1066 Apr 17 '14 at 22:48
@RyanBarker: Just to check, you are using sudo in the apt-get commands, right? – saiarcot895 Apr 17 '14 at 22:48

Try this solution that was originally posted by "Bruno Pereira"

Remove your /var/lib/dpkg/lock file and force package reconfiguration.

sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a

It should work after this.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.