I'm running a MySQL server, and want to keep it up to date with regular apt-upgrades. I don't want this to cause MySQL to upgrade unless I'm doing it during scheduled downtime! How do I alter my apt-preferences so that this won't happen?
I've tried adding this to a file as /etc/apt/preferences.d/pin-mysql
Package: mysql-client-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001
Package: mysql-client-core-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001
Package: mysql-common
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001
Package: mysql-server
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001
Package: mysql-server-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001
Package: mysql-server-core-5.1
Pin: version 5.1.41-3ubuntu12.7
Pin-Priority: 1001
That then states the packages are pinned with "apt-cache policy" outputting:
... all package sources here
500 http://security.ubuntu.com/ubuntu/ lucid-security/universe Packages
release v=10.04,o=Ubuntu,a=lucid-security,n=lucid,l=Ubuntu,c=universe
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu/ lucid-security/restricted Packages
release v=10.04,o=Ubuntu,a=lucid-security,n=lucid,l=Ubuntu,c=restricted
origin security.ubuntu.com
... etc
Pinned packages:
mysql-server -> 5.1.41-3ubuntu12.7
mysql-server-core-5.1 -> 5.1.41-3ubuntu12.7
mysql-client-core-5.1 -> 5.1.41-3ubuntu12.7
mysql-common -> 5.1.41-3ubuntu12.7
mysql-server-5.1 -> 5.1.41-3ubuntu12.7
mysql-client-5.1 -> 5.1.41-3ubuntu12.7
However… running aptitude safe-upgrade just updated MySQL… what am I doing wrong?
Best Answer
If you want to prevent the upgrade of a package, then pinning is not the way to go. What you need is called holding, and you can find out how to do it on this page in the Ubuntu online help