cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

[enhancement]: Allow downgrades on package installs

Open adam-vest opened this issue 1 year ago • 1 comments

Enhancement

Hi there! So I'm working with a situation where I'm enabling a PPA, setting pin priority (manually), and attempting to install packages from it. These are seen by apt to be downgrade actions, and as a result, apt functions will fail (package_upgrade, packages, etc):

E: Packages were downgraded and -y was used without --allow-downgrades.
2024-11-08 20:38:41,119 - util.py[WARNING]: Package upgrade failed

With apt, as the message states, the --allow-downgrades flag needs to be present when -y is also used. I believe dnf/yum will just happily proceed with the downgrade if that's what it thinks is best, though I could be wrong there.

It would be nice to have an option to allow this scenario to happen. Maybe something on the same level as package_upgrade, like allow_package_downgrade? With this bool set to true, it would append that --allow-downgrades flag to all apt commands (and an equivalent if necessary for dnf/yum)? Right now I'm working around it by running those commands in runcmd statements, but it would be nice to use the more native built-ins for this.

Thank you for your time and consideration!

adam-vest avatar Nov 08 '24 20:11 adam-vest

@adam-vest Thanks for this other feature request! I appreciate the user story you have provided as well as the info around the cloud-config you have been using to work around the lack of this feature. :smile:

a-dubs avatar Dec 04 '24 14:12 a-dubs

hi @a-dubs (the screener) , I am thinking of working on this issue. Would it be a good idea if I do a more generic custom_package_upgrade_options string property where the user would pass whatever cli options they want to the upgrade command ?

mostafaCamel avatar Jul 14 '25 11:07 mostafaCamel