1

Hi and happy new year to you all..

Recently I've built nginx deb package v1.4.4 from debian backport source that of course I've added to the apt sources.list and things went great.

My question: Will debian update packages that I've personally built from their official sources automatically? I mean by update the security ones.

UPDATE:

I have run apt-get update then apt-get -V upgrade today to check how debian 7 apt would behave.. and this is what I got:

root@debian-lab:~/nginx-1.4.4-packages# apt-get -V upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
   nginx-full (1.4.4-1~bpo70+1 => 1.4.4-1~bpo70+1)
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/464 kB of archives.
After this operation, 9,027 kB disk space will be freed.
Do you want to continue [Y/n]?

As you can see, apt is trying to upgrade from (1.4.4-1~bpo70+1 => 1.4.4-1~bpo70+1), which is basically two identical version but my installed deb package has custom nginx modules added to default nginx-full and after the update, my custom modules are all gone and replaced by the standard debian wheezy backport deb.. I've built my nginx backport deb package from debian backport source and installed build-deb through the backport as well but some dependencies installed automatically from the stable that's what I saw from the verbose output..

Can you please help me to prevent this with an example?

UPDATE

I've tried to apt pin the package and didn't work and here is the output i got:

apt-cache policy nginx-full
nginx-full:
Installed: 1.4.4-1~bpo70+1
Candidate: 1.4.4-1~bpo70+1
Version table:
 1.4.4-1~bpo70+1 0
    100 http://ftp.uk.debian.org/debian/ wheezy-backports/main amd64 Packages
*** 1.4.4-1~bpo70+1 0
    100 /var/lib/dpkg/status
 1.2.1-2.2+wheezy2 0
    500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
    500 http://security.debian.org/ wheezy/updates/main amd64 Packages

And the following is the apt-cache policy nginx:

/etc/apt/preferences.d# apt-cache policy nginx
nginx:
  Installed: 1.4.4-1~bpo70+1
  Candidate: 1.4.4-1~bpo70+1
  Package pin: 1.4.4-1~bpo70+1
  Version table:
 *** 1.4.4-1~bpo70+1 1001
        100 http://ftp.uk.debian.org/debian/ wheezy-backports/main amd64 Packages
        100 /var/lib/dpkg/status
     1.2.1-2.2+wheezy2 1001
        500 http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
        500 http://security.debian.org/ wheezy/updates/main amd64 Packages

But still apt is trying to upgrade and replace it!!

Sources.list content:

deb http://ftp.uk.debian.org/debian/ wheezy main
deb-src http://ftp.uk.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb http://ftp.uk.debian.org/debian/ wheezy-updates main
deb-src http://ftp.uk.debian.org/debian/ wheezy-updates main

# Wheezy Backports repository
deb http://ftp.uk.debian.org/debian wheezy-backports main
deb-src http://ftp.uk.debian.org/debian wheezy-backports main

I've tried to apt pin once the package name 'nginx' and another time with nginx-full..

But both fail to hold the package!!!

1
  • What do you mean? If you manually install packages the package manager won't update them automatically...
    – Nathan C
    Commented Dec 30, 2013 at 21:00

2 Answers 2

3

I would recommend you to bump the version of the package. APT knows that both package aren't the same and is trying to install the package from trusted sources. dch -i is all that you need, just add some short description and rebuild the package.

You can also pin the package differently:

Package: nginx-full
Pin: origin ""
Pin-Priority: 999

This will give more priority to the package locally installed.


If the repository version string supersede the current installed version and you don't have any pinning and some version get released, yes, apt will install the package from the repositories (hopefully with the already applied patch) if you have the correct sources.

10
  • Actually source package will be replaced with the newer binary package. I have got this issue once. Built and patched one (say v.0.1) and after a week, on apt-get update new version was available (say v.0.2) and apt-get upgrade replaced my source-built package by binary one. I suggest to use pinning.
    – GeekMagus
    Commented Dec 30, 2013 at 23:37
  • @Greshnik I'm not sure if you are adding an anecdote or clarifying something.
    – Braiam
    Commented Dec 30, 2013 at 23:39
  • You said "apt will install the package from the repositories (hopefully with the already applied patch)", and this is not applied if user use its own custom patch. Sorry for "misexplanation".
    – GeekMagus
    Commented Dec 30, 2013 at 23:42
  • @Greshnik if the locally created package is version 1.2.3-1custom and the repositories have 1.2.3-2, then apt will prefer the repos one and "upgrade" to it unless you pin/hold it.
    – Braiam
    Commented Dec 31, 2013 at 2:52
  • Thanks but please read my update..
    – Dr.SMS
    Commented Dec 31, 2013 at 5:06
2

If you pin the package, apt-get won't attempt to upgrade it.

To pin the package, create a file in /etc/apt/preferences.d, e.g. /etc/apt/preferences.d/nginx

Put this in the file:

Package: nginx
Pin: version 1.4.4-1~bpo70+1
Pin-Priority: 1001
5
  • Thanks a lot man.. That's exactly what this tut says: howtoforge.com/a-short-introduction-to-apt-pinning-p2 but still tried your fix and even changed the package name to nginx-full but still apt is stubborn and wants to replace it!!! check my update above for the verbose.. happy new year..
    – Dr.SMS
    Commented Dec 31, 2013 at 12:40
  • if you do apt-get clean and then retry the upgrade, do you get the same issue? Also, if you are on a version of apt-get <= 0.7.10 then you may be affected by this bug: bugs.debian.org/cgi-bin/bugreport.cgi?bug=351056 Commented Dec 31, 2013 at 12:48
  • I did clean but still issue persists.. but I'm running wheezy!! so i guess apt has been fixed long ago!
    – Dr.SMS
    Commented Dec 31, 2013 at 13:25
  • @Dr.SMS Try: echo "nginx" | dpkg --set-selections; Happy new year!
    – GeekMagus
    Commented Dec 31, 2013 at 15:57
  • @ColinPickard that bug is in the package, not apt problem.
    – Braiam
    Commented Dec 31, 2013 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .