Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu 11.10, as Xubuntu, in an AMD 64 pc, configured as dual boot with Windows 7.

I tried installing vim with this:

sudo apt-get install vim

I got this error message:

The following packages have unmet dependencies:
 vim : Depends: vim-common (= 2:7.3.154+hg~74503f6ee649-2ubuntu2) but 2:7.3.154+hg~74503f6ee649-2ubuntu3 is to be installed
E: Unable to correct problems, you have held broken packages.

I only have a very faint idea of what the problem is, and none whatsoever on how to correct this. Hope you guys can help.

share|improve this question
add comment

6 Answers

You have an outdated package list.

Run this command:

sudo apt-get update && sudo apt-get install vim

What that will do is update your package list, and then try to install vim.

share|improve this answer
    
Thanks. I will give this a try. –  Max Popp Nov 12 '11 at 12:52
add comment

I also had broken packages in Synaptic and nothing was able to be installed. For me this solved the issue:

sudo apt-get clean && sudo apt-get purge

And then try to reinstall

share|improve this answer
    
This worked. Thank you very much. –  Max Popp Nov 12 '11 at 12:52
1  
Great. You could accept my answer if thing that solved it. –  bioShark Nov 12 '11 at 13:50
add comment

When doing

$ sudo apt-get install vim

I got :

Reading package lists... Done  
Building dependency tree  
Reading state information... Done

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 vim : Depends: vim-common (= 2:7.3.154+hg~74503f6ee649-2ubuntu2) but 2:7.3.154+hg~74503f6ee649-2ubuntu3 is to be installed
E: Unable to correct problems, you have held broken packages.

To solve this problem, I did:

sudo apt-get remove vim-common 
sudo apt-get clean && sudo apt-get purge 
sudo apt-get update && sudo apt-get install vim

I must say that the previous fix did the trick for vim installation but not for others packages which still gave me the same kind of issue(E: Unable to correct problems, you have held broken packages)

After searching a little more, I found on another forum a better fix. The fix has been given by Liam Proven(http://ubuntu.5.n6.nabble.com/E-Unable-to-correct-problems-you-have-held-broken-packages-td4355181.html).

In Synaptic (if you have it installed) or System Settings | Software Sources. Look for the option to find the fastest server. It usually picks a lightly-loaded mirror near you.

After setting the fastest server, I do not have any problem. Hope that is useful.

share|improve this answer
    
Changing which server Synaptic is downloading from fixed the bug for me. Thanks! –  Hermann Ingjaldsson Sep 26 '12 at 11:48
add comment

The clue to the answer is in the "Unable to correct problems, you have held broken packages."

For broken package state issues I turn to aptitude (sudo apt-get install aptitude) because it has handy shortcuts for queing arbitrary changes to package states: for instance "+" to unhold, "=" to hold, "-" to remove, "_" to purge, and "g" to apply queued changes. "/" to search for packages.

But these commands may work. Un-holding vim-common is the important bit:

sudo apt-get update
echo vim-common install | sudo dpkg --set-selections
sudo apt-get install vim
share|improve this answer
    
Didn't get to try this, but thanks very much –  Max Popp Nov 12 '11 at 12:50
add comment

You can also download vim

cd Downloads
sudo apt-get download vim
Get:1 Downloading vim 2:7.3.154+hg~74503f6ee649-2ubuntu3 [1,038 kB]
Fetched 1,038 kB in 17s (59.7 kB/s)                                                          
root@onezero:/home/one/Downloads/vim# ls
vim_7.3.154+hg~74503f6ee649-2ubuntu3_amd64.deb

then

dpkg -i vim_7.3.154+hg~74503f6ee649-2ubuntu3_amd64.deb

I hope this will help you

you can also check HOWTO: Install downloaded .DEB packages (and their dependencies) in 2 steps

share|improve this answer
add comment

I ran every conceivable apt-get clean, update, fix and so on. Finally, I reasoned that nobody else must be depending on vim-common and that appeared to be the problem, so I thought I'd try removing vim-common first. That did the trick.

sudo apt-get remove vim-common
sudo apt-get install vim
share|improve this answer
add comment

Your Answer

 
discard

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.