Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Report failed upgrades with a non-zero exit status (mintupdate-cli, mint-refresh-cache, automatic upgrades)

未关闭 适合新手
#1,107 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
linux, python
领域
cli, devops

调研方向

从 issue 中列出的三个入口开始:usr/lib/linuxmint/mintUpdate/mintupdate-cli.py、mint-refresh-cache 和 system_automatic_upgrades.py;追踪每个入口如何处理子进程结果和错误分支。然后检查是否已有覆盖这些命令的测试。完成的标准是:失败时返回非零状态,自动升级记录失败,同时成功运行保持当前行为。

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

When an upgrade or a cache refresh fails, every entry point still reports success, so the failure is invisible to anything that checks exit codes: cron, Ansible, scripts, systemctl --failed or fleet monitoring.

  • mintupdate-cli upgrade runs apt-get with subprocess.call(arguments + packages, env=environment) (usr/lib/linuxmint/mintUpdate/mintupdate-cli.py, line 95 on master) and discards its return code.
  • mint-refresh-cache prints an error and exits 0 when the update fails or when it is run without root.
  • system_automatic_upgrades.py ignores the result of subprocess.run(cmd, ...) (line 44) and always logs -- Automatic Upgrade completed (line 57), so mintupdate-automation-upgrade.service never fails.

Reproduced on Linux Mint 22.2 with mintupdate 7.1.1, using a fake apt-get on PATH that exits 100:

$ PATH=/tmp/fakebin:$PATH mintupdate-cli upgrade --dry-run; echo $?
E: Could not get lock /var/lib/dpkg/lock-frontend (simulated)
0
$ mint-refresh-cache; echo $?
Error: mint-refresh-cache requires admin privileges
0

Related: #1097 (a failed scheduled cache refresh goes unnoticed) and #1043 (automatic updates silently not installing).

Describe the solution you'd like

Propagate the failure:

  • mintupdate-cli: sys.exit(subprocess.call(...)) so apt-get's status is returned.
  • mint-refresh-cache: sys.exit(1) in the error branches.
  • system_automatic_upgrades.py: check the return code, log -- Automatic Upgrade failed (exit N) and exit non-zero so the systemd unit is marked failed.

Successful runs behave exactly as today.

Describe alternatives you've considered

Parsing the log in /var/log/mintupdate.log, which is fragile and only works on machines someone is watching.

Additional context

Happy to send a pull request if this direction is acceptable.

主要语言
Python
星标
424
派生
191
平均合并
23 天 14 小时
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

linuxmint/mintupdate 的其他 Issue

查看 linuxmint/mintupdate 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。