PDA

View Full Version : how to suppress packages from upgrading ?



masuch
December 11th, 2012, 01:22 PM
Hi,

I have a lot of packages compiled by myself in Ubuntu instance. Within each upgrade/distribution upgrade there is possibility those my compiled packages (libraries) are overwritten.

I would like to know some suggestions how to suppress to install and/or upgrade some specific packages ?

URLs, tips and tricks are welcomed. No gui software, only in terminal.

thank you very much for help,
kind regards,
M.

kleenex
December 11th, 2012, 03:26 PM
Hi masuch. What about holding packages? Hold means that even if a newer version of that package is available it will not be upgraded. Example of holdind e.g. mysql


# hold package
echo "mysql hold" | dpkg --set-selections

# install package (unhold)
echo "mysql install" | dpkg --set-selections

# check the results:
dpkg --get-selections | grep mysql
mysql holdNow, mysql (and dependencies) are being held back. I think that there are several methods of suppress to install and/or upgrade some specific packages.

masuch
December 11th, 2012, 06:17 PM
Hi masuch. What about holding packages? Hold means that even if a newer version of that package is available it will not be upgraded. Example of holdind e.g. mysql


# hold package
echo "mysql hold" | dpkg --set-selections

# install package (unhold)
echo "mysql install" | dpkg --set-selections

# check the results:
dpkg --get-selections | grep mysql
mysql holdNow, mysql (and dependencies) are being held back. I think that there are several methods of suppress to install and/or upgrade some specific packages.


thank you,

I know it was not within this question on the first place but I would like to ask anyway:

How to solve it within this case:
if the package was not installed - to hold the package does not work.
What I am up is - when I compiled software by myself and I am going to install new (not installed) package/s - my compiled/installed software is going to be overwritten. How can I prevent to overwrite anything what I have compiled/installed by me ?

Is there any way how to cope with this ?
I can create script, but at this moment I am collecting information and getting mechanism how it works.

I just want my compiled and installed stuff - not to touch / change by installing new packages / upgrading existing packages.

I have been thinking about combination of
echo "package hold" | sudo dpkg --set-selections
and
dpkg-divert --add --rename --divert /usr/bin/command.real /usr/bin/command
but it is quite complicated.

If there is any way how to check the currently installed version against version is going to be installed - I would like to have it in the script as well.


thank you for any info.

kleenex
December 11th, 2012, 09:59 PM
(...) How can I prevent to overwrite anything what I have compiled/installed by me ? (...)
(...) If there is any way how to check the currently installed version against version is going to be installed (...) Hi masuch. So, I still think, that best method will be 'hold' your package before any system, packages updates. Another way could be a process called - "pinning" packages (more info about pin can be found here ==>> AptPreferences (http://wiki.debian.org/AptPreferences#A.2BAC8-etc.2BAC8-apt.2BAC8-preferences)). An example of entry in /etc/apt/preferences file to "pin" the older versions and packages related with your program;

Package: your_program
Pin: version 1.0*
Pin-Priority: 1001 1001 entry sets the value for all your_program versions begin with 1.0, regardless of the repository. A newer version (for example, starting with 1.1) is not installed, even if it is available, unless it would set an even higher priority. More info about APT-Pinning: http://jaqque.sbih.org/kplug/apt-pinning.html

So, how APT utility interprets the value of Pin-Priority? Let see:

P < 0 : Version of the package will not be installed.
0 < P < 100 : Version of the package will be installed only if the package is not currently installed.
100 <= P < 500 : Version of the package will be installed, unless the version is available from another repository.
500 <= P < 990 : Version of the package will be installed, unless there is a version derived from the repository designated as the "target release" or actually installed a newer version of the package.
990 <= P <= 1000 : Version of the package will be installed even if you have a version derived from the repository designated as the "target release" unless you install a newer version of the package.
P > 1000 : Version of the package will be installed, even if it requires its withdrawal To check which version of packages is currently installed you can use e.g.

$ dpkg -s firefox |grep Version
Version: 17.0.1 For more detailed output, use this dpkg command without grep Version. To check which packages will be installed, you can simulate the update process. APT utility, allows such option and it is very interesting, because you do not have to install available updates, but only check what, eventually, could be installed.

# simulating an update process;
$ sudo apt-get -s upgrade One more thing. You have written, that "if the package was not installed - to hold the package does not work". This seems to be a logical, right?

Cheers!

masuch
December 15th, 2012, 01:17 PM
Hi, thanks a lot for "pinning" hint. It solved many of my concerns. Going to mark this thread as solved.

I am not clear about one thing:

Concerning the "not-installed packages" I had in mind:
- How do I test ?
If software has been compiled/installed by me - not using package/s (software was not installed previously or has been purged) and suddenly within apt-get upgrade process (it could be even dependent libraries) it appeared to try to install software/package/s which are going to rewrite my installed program (because software were not installed previously using deb package/s how can I use any principle previously mentioned to compare installed software version with on ongoing installation process ?).

If you already described it - Please accept my apology, I did not get it.

kleenex
December 18th, 2012, 06:34 PM
Hi, masuch. Really do not know. I think that's all. I mean that I was able to help you. Sorry.