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 know about pinning packages with Apt. That's not what I want to do. Other questions have been answered with either using pinning or by using pins temporarily. I don't want to do this.

What I want to do is keep packages back the same way the kernel has been:

# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  linux-generic-pae linux-headers-generic-pae linux-image-generic-pae
The following packages will be upgraded:

I want to add tomcat-* and mysql-* and sun-* to this list. In the past, there was a configuration parameter to do this. I've always thought it was something like Apt::Get::HoldPkgs or Apt::HoldPkgs but I can't find it.

I want to have these packages held from updates until I specifically request them with an apt-get install.

I found the apt-get configuration Apt::NeverAutoRemove. Will this do what I want?

Added Question: I notice that Apt::NeverAutoRemove and Apt::Never-MarkAuto-Sections (among others) are not documented so far as I can see. They're not in the manpages. Neither is aptitude::Keep-Unused-Pattern and aptitude::Get-Root-Command.

Is there any comprehensive and complete documentation for apt.conf?

share|improve this question
    
The kernel example depends on the difference between upgrade and dist-upgrade and cannot be configured on a per-package basis. –  enzotib Jun 29 '11 at 14:50
    
Blast! (sorry...) I'm still convinced that it used to be configurable; wouldn't surprise me that it's obsolete by now. –  David Jun 29 '11 at 14:51
    
I didn't say cannot be done, I said the kernel example is not appropriate, because the fact that "packages have been kept back" do not depends on any configuration, but from the semantic of upgrade command of apt-get. –  enzotib Jun 29 '11 at 14:53
    
This answer askubuntu.com/questions/18654/… seems to not use pinnig. –  enzotib Jun 29 '11 at 15:07
    
I saw those; I was hoping for a apt.conf parameter - a futile hope, it now appears. I'm leaning toward the use of dpkg --set-selections. I found a question that suggested the use of dpkg and the use of aptitude were not equivalent (i.e., dpkg did not honor the aptitude setting). –  David Jun 29 '11 at 16:46
show 2 more comments

1 Answer

up vote 12 down vote accepted

The answer is to use dpkg --set-selections. If you run the command dpkg --get-selections you can see what is set already:

$ dpkg --get-selections | head
acct                                            install
adduser                                         install
apparmor                                        install
apparmor-utils                                  install
apt                                             install
apt-transport-https                             install
apt-utils                                       install
aptitude                                        install
at                                              install
auditd                                          install

Consider, in this case, the package dnsutils:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  bind9-host dnsutils libbind9-60 libdns64 libisc60 libisccc60 libisccfg60 liblwres60
8 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,257kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.

Now let's change it - put the package on hold:

$ echo dnsutils hold | sudo dpkg --set-selections

Check the results:

$ dpkg --get-selections | grep dnsutils
dnsutils                                        hold

Try the update again:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  bind9-host dnsutils libbind9-60 libdns64 libisc60 libisccfg60 liblwres60
The following packages will be upgraded:
  libisccc60
1 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Need to get 29.9kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.

Now, dnsutils - and its related packages - are being held back, just as we wished.

share|improve this answer
    
You should consider to give some information about your use of root account. –  enzotib Jul 12 '11 at 17:44
    
Logging in as root is certainly easier; however, using sudo in appropriate places is better practice. In the examples, the commands apt-get upgrade and dpkg --set-selections would require root access - thus, sudo should be used for these commands. Others should be alright as is. –  David Jul 12 '11 at 19:03
    
I know perfectly how and when to use sudo, I only suggested to clarify that in the answer for a beginner. –  enzotib Jul 12 '11 at 19:07
    
That's what I thought you meant. I clarified it in the comments... I fixed the answer, too, now. –  David Jul 12 '11 at 20:48
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.