Skip to content

mintupdate-cli.py: Don't remove packages when running with --yes - #1114

Open
Amadeus-22 wants to merge 1 commit into
linuxmint:masterfrom
Amadeus-22:automatic-upgrade-no-remove
Open

Amadeus-22 wants to merge 1 commit into
linuxmint:masterfrom
Amadeus-22:automatic-upgrade-no-remove

Conversation

@Amadeus-22

Copy link
Copy Markdown
Contributor

Fixes #1111

Problem

mintupdate-cli upgrade --yes, which the automatic upgrades run, passes --assume-yes to apt-get install. When an update Breaks or Conflicts with installed packages, apt-get resolves it by removing them and --assume-yes accepts that, so a repository caught between two uploads (Proton VPN in #1111) makes the automatic upgrade uninstall the app without anyone seeing it.

Fix

Pass --no-remove together with --assume-yes. apt-get then stops with E: Packages need to be removed but remove is disabled. (exit 100) and installs nothing; the next run installs the updates once the repository is consistent again. Interactive use (without --yes) is unchanged: apt-get lists the removals and asks. The --yes help text and man page say so.

A side effect: while such a conflict exists, the automatic upgrade installs nothing at all, not only the conflicting update. I think that is the safer default for an unattended run, but I can change it to hold back only the conflicting update if you prefer.

How tested

  • tests/test_cli_upgrade.py checks the apt-get arguments with and without --yes (/usr/bin/python3 -m unittest discover -s tests, 14 tests OK; the new test fails on master).
  • On Linux Mint 22.2, chrony Conflicts with the installed systemd-timesyncd:
    • apt-get install --simulate --assume-yes chrony removes systemd-timesyncd
    • apt-get install --simulate --assume-yes --no-remove chrony prints E: Packages need to be removed but remove is disabled. and exits 100

🤖 Generated with Claude Code

With --assume-yes apt-get accepts its own solution to a Breaks or
Conflicts, including removing installed packages. Automatic upgrades
run "mintupdate-cli upgrade --yes", so a package published before the
packages it breaks were updated made the automatic upgrade remove them
without anybody seeing it (linuxmint#1111).

Pass --no-remove along with --assume-yes. apt-get then aborts with
"Packages need to be removed but remove is disabled" and installs
nothing, and the next run picks the updates up once the repository is
consistent. Without --yes nothing changes: apt-get shows the removals
and asks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic upgrade removes installed packages to apply an update

1 participant