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 have the following problem.

Recently I have installed vim (which I compiled myself, as the one in the Ubuntu repositories are old). With it I installed Cscope and You-Complete-Me plugins.

Now everytime Ubuntu checks for updates, it wants to "upgrade" my vim and the vim You-Complete-Me plugin stops working (because it actually downgrades my vim...).

How can I tell Ubuntu to mind it's own bussiness and stop "upgrading" my vim? I don't want to deselect boxes each time there is some system update...

UPDATE: I have installed vim using the steps provided here: https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

share|improve this question

4 Answers 4

up vote 4 down vote accepted

To hold your installed version, prevent the package manager from automatically updating it in the future running this command in terminal:

echo "<packagename> hold" | sudo dpkg --set-selections

Change <packagename> with what package you wish (in your case may be vim).

share|improve this answer
    
Thanks that worked. I edited your response a little. Now when I run the update-manager, the vim packages aren't highlighted by default. –  Melon Jul 3 '13 at 8:41

You can set packages to be on hold.

hold — A package marked to be on hold is not handled by dpkg, unless forced to do that with option --force-hold.

Basically packages on hold will not be upgraded (or as apt says: will be „kept back”).

Here is an easy way to set any package on hold.

  1. Get the selection state of the packages by running dpkg --get-selections >selections.txt
  2. Edit your selections.txt file and search for the package name you do not want to get updated. Replace the text at the second column holding the state from install to hold. Save the file.
  3. Apply the your customized selections by running sudo dpkg --set-selections <selections.txt.

Now run sudo apt-get upgrade and the package should not be upgraded anymore.

share|improve this answer

The dpkg-hold tool does the same as @lgarzo described, but in more convenient manner. You can install it using sudo apt-get install dlocate. Then run sudo dpkg-hold packagename and it will become hold.

share|improve this answer

An arguably better solution would be not to install vim over the existing binary installed by Ubuntu's package manager in the first place. This is always a bad idea and it is going to bite you sooner or later.

The files in /usr/bin, /usr/lib are managed by Ubuntu and if you want it to mind its own business you should not put your stuff in there. You can put your own hand-compiled binaries in /usr/local, /opt or even your home directory.

The offending bit in the instructions is --prefix=/usr - removing it should install vim in /usr/local - then you'll need to modify the rest of the instructions to account for the new location.

(also, the fact that Ubuntu overrides your binary suggests that you haven't removed the system vim before overriding it with yours - which the instructions you linked to actually mention)

share|improve this answer
    
I followed the instructions here: github.com/Valloric/YouCompleteMe And removed vim packages before everything (as suggested in the link github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source) –  Melon Jul 3 '13 at 8:36
    
Well, not all instructions you can find on Internet are equally good :) –  Sergey Jul 3 '13 at 20:47
    
@Melon: Think of this: If you really removed vim before compiling your own - how comes it appears in the list of packages Ubuntu wants to –  Sergey Jul 3 '13 at 20:51
    
(contd) Ubuntu wants to update? I'm pretty sure you didn't remove system vim before overriding it with your hand-compiled version. If you did, the instructions, while not following the best practices, would work just fine. Pinning the package in this case is just masking the terrible mess below :) –  Sergey Jul 3 '13 at 20:57
    
Well, I just copy pasted everything from the beginning. Thought this should work –  Melon Jul 4 '13 at 6:08

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.