Sample Header Ad - 728x90

Prevent package upgrade with `apt`

7 votes
2 answers
242 views
I'm maintaining a Debian package for which we don't currently support upgrades. This means that upgrading this package will result in a broken installation due to configuration files not being properly tagged. How can I prevent users from upgrading my package once it is hosted in a debian repo? I tried with the following solutions: ### 1. preinst script check I checked for currently installed versions of the project in the preinst script and exited with an error if found one. This breaks the installation though, since preinst script runs **after** the uninstallation of the previous version of the package. ### 2. Conflicts directive in the control file I added the entry:
Conflicts: project (> [version])
In the debian control file of the project but this doesn't seem to prevent upgrades given that dpkg **removes the previous version of the package** therefore satisfiying the Conflicts. ### 3. Package name containing the version I know this would work for sure but we'd like to avoid this kind of solution. **Please note**: we want to solve this from the distribution side, not client-side (i.e. package pinning etc.)
Asked by mattdibi (209 rep)
Jun 6, 2025, 01:05 PM
Last activity: Jun 9, 2025, 06:47 AM