Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Some time ago I apt-get install’d the nginx package on my debian/squeeze server. My requirements have now changed and I needed to install nginx --with-http_xslt_module.

To install nginx with this option I did the following:

  • apt-get build-dep nginx
  • apt-get source nginx
  • modified debian/rules to add the required option
  • dpkg-buildpackage -rfakeroot -uc -b
  • dpkg -i nginx_0.7.62-4_amd64.deb

This all seemed to work nicely, but now when I do an apt-get dist-upgrade it tries to install the nginx binary again.


Please could you advise…

  1. Is building nginx in this way the preferred solution for my needs?
  2. If so, how can I tell apt that I don’t want to install the binary nginx any more without doing a remove?
share|improve this question
add comment

4 Answers

up vote 0 down vote accepted

I think you are looking for is the ability to hold a package. When a package is held apt will not attempt to upgrade or change it any way.

A command like this will set nginx to be held.

dpkg --get-selections | grep 'nginx' | sed -e 's/install/hold/' | sudo dpkg --set-elections

You will probably want to make note that you did this. When it comes time to upgrade to the next major release you will probably need to remove this hold.

share|improve this answer
    
Thanks, Zoredache. This seems to have solved my issue and gives a nice reminder (“The following packages have been kept back:” when I do a dist-upgrade) so I don’t forget to keep nginx up-to-date. There is a typo in your command though: s/set-elections/set-selections/. –  davecardwell Nov 13 '09 at 1:31
add comment

I don't really understand what you want -- you don't want to install nginx, but you also don't want to remove it? That makes no sense. If you want to ensure that your build of the package stays installed, and isn't upgraded to the standard version, then you want to use package pinning, as described in the apt_preferences man page.

share|improve this answer
    
Sorry if I wasn’t clear. I have the binary of nginx installed, I have subsequently built it myself from source and installed without removing the existing binary version, now I want apt to stop trying to update the binary version. I could do an apt-get remove and then build from source again, but I’m trying to avoid this. –  davecardwell Nov 11 '09 at 20:13
    
Now you're making even less sense. Did you build a customised binary package as the question suggests, or did you build and install from source (to, say, /usr/local)? Why are you trying to avoid removing the package? –  womble Nov 11 '09 at 20:29
    
@womble, I think he wants to prevent apt from upgrading the package he built locally. –  Zoredache Nov 12 '09 at 0:59
1  
@womble, I don't know where you're not following, I'm understanding his problem. He installed the binary dist package, then built it from source and installed the built package OVER the binary package. At this point, his system likely thinks he has the binary package, which is out of date. When he does a dist-upgrade it's telling him to upgrade to the new binary package which will not have the build options he requires. –  Kyle Smith Nov 12 '09 at 14:24
    
@Kyle: I don't know what distro you're using, but in Debian apt tracks installed packages and their contents, meaning that the package manager knows what's installed and where. –  womble Nov 12 '09 at 14:42
show 1 more comment

Before you run dpkg-buildpackage, run dch -lxslt in the source directory to increase the version number and add a changelog entry. This will stop apt from upgrading it, although if a new version comes out (eg security) it will be upgraded again. To stop this, increase the epoch of the package by prepending 1: to the version number in debian/control, which will stop apt from upgrading the package, including security fixes, until/unless you downgrade to the version from the Debian repository. So if you do this, you'll need to watch out for security versions and rebuild manually.

share|improve this answer
add comment

The way you are looking for is probably appending a suffix to the package version. A little bit of information is on Ubuntu packaging guide here and in Recipes/PackageUpdate.

I recall sucessfully mastering that for Debian kernel packages some 7 years ago, but have forgotten about details right now.

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.