I'm currently self compiling the nginx package using the following:

sudo apt-get build-dep nginx-extras
sudo apt-get install build-essential
apt-get source nginx-extras
cd nginx
<add some custom module here>
dpkg-buildpackage -us -uc
sudo dpkg -i nginx-extras_1.10.0-0ubuntu0.16.04.4_amd64.deb
sudo apt-mark hold nginx-extras

I do this because I need to install some custom modules - however after running this, apt-get upgrade indicates there is an upgrade for nginx that it would apply if apt-mark hold were not in effect. I thought I just compiled the latest version, so why does it want to upgrade??

The problem I have here is that I use apticron which sends me an email each day indicating I have unupgraded packages when I in fact do have the latest.

EDIT: Some additional output:

$ sudo apt-get upgrade --simulate
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst nginx-extras [1.10.0-0ubuntu0.16.04.4] (1.10.0-0ubuntu0.16.04.4 Ubuntu:16.04/xenial-updates, Ubuntu:16.04/xenial-security [amd64])
Conf nginx-extras (1.10.0-0ubuntu0.16.04.4 Ubuntu:16.04/xenial-updates, Ubuntu:16.04/xenial-security [amd64])


$ sudo apt-cache policy nginx-extras
  Installed: 1.10.0-0ubuntu0.16.04.4
  Candidate: 1.10.0-0ubuntu0.16.04.4
  Version table:
     1.10.0-0ubuntu0.16.04.4 500
        500 http://mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
 *** 1.10.0-0ubuntu0.16.04.4 100
        100 /var/lib/dpkg/status
     1.9.15-0ubuntu1 500
        500 http://mirrors.digitalocean.com/ubuntu xenial/universe amd64 Packages
  • What's the output of apt-cache policy nginx-core and apt-get upgrade --simulate? – David Foerster Apr 2 '17 at 23:51
  • @DavidFoerster updated question with info – Martin Konecny Apr 3 '17 at 0:48
  • nginx-extrasnginx-core. Please supply the correct command output. Also, why do you install one package (nginx-core), tell Apt to hold back another (nginx) and expect the former to be held back? – David Foerster Apr 3 '17 at 3:07
  • Sorry, please take a look at the revised question. I actually have nginx-extras installed (which conflicts with nginx-core) – Martin Konecny Apr 3 '17 at 15:27

You can override the check with an apt preference. For example (change release as applicable): Create in /etc/apt/preferences.d/nginx-custom

Package: nginx
Pin: release n=yakkety
Pin-Priority: -1

# This will cause nginx to be ignored and use the locally compiled version only

I use this technique with a custom ffmpeg compilation similar to your nginx need.

  • I believe this would completely disable updates? I'd still like apt-get upgrade to inform me when my self-compiled version is now out-of-date and potentially insecure. – Martin Konecny Apr 3 '17 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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