The update flow upgrades packages over the SSH connection Ansible is using. When the upgrade includes openssh-server, the package restarts ssh.service. If that unit has PrivateTmp=yes (the systemd_hardening role sets it), systemd deletes the unit's private /tmp and /var/tmp when the unit stops, and the session Ansible is still using sees an empty one. In the middle of the upgrade this removes the .deb files apt staged under /tmp/apt-dpkg-install-* and the apt module's own payload. dpkg then fails with "cannot access archive" and leaves packages unpacked but not configured (seen on systemd, docker-ce and containerd.io on ten hosts over three weeks).
Later tasks in the same play that use /tmp fail too ("No such file or directory"), until a new SSH connection gets a new private /tmp.
Out of scope: changing PrivateTmp on ssh.service, and the pve dist-upgrade path beyond using the same directory.
Proposal
New input system_baseline_apt_tmpdir (str, default /var/cache/system-baseline-apt-tmp, validated as an absolute path outside /tmp and /var/tmp).
update.yml creates it (owner root, mode 0700) and runs the upgrade and the autoremove with TMPDIR set to it.
After the upgrade, meta: reset_connection, so later tasks get a connection with a fresh private /tmp.
The directory is created only when an upgrade will run (not in the main flow's check mode, where the upgrade is skipped).
Acceptance criteria
Default run creates the directory with mode 0700 and a second run reports no change. Check: Molecule converge, idempotence and a stat assertion in verify.
The upgrade and autoremove tasks carry TMPDIR set to the input. Check: a lint-level test or Molecule verify that greps the task file, since the container cannot restart ssh.service.
A value inside /tmp or /var/tmp, or a relative path, is refused before any change. Check: a Molecule converge play that expects the failure.
argument_specs.yml, the README and a changelog fragment (bugfixes) cover the input. Check: ansible-doc, antsibull-changelog lint.
Not verified by CI: a real openssh-server upgrade on a host with PrivateTmp=yes. State it in the PR.
Assisted-by: Claude Code
## Problem
The `update` flow upgrades packages over the SSH connection Ansible is using. When the upgrade includes `openssh-server`, the package restarts `ssh.service`. If that unit has `PrivateTmp=yes` (the `systemd_hardening` role sets it), systemd deletes the unit's private `/tmp` and `/var/tmp` when the unit stops, and the session Ansible is still using sees an empty one. In the middle of the upgrade this removes the `.deb` files apt staged under `/tmp/apt-dpkg-install-*` and the apt module's own payload. dpkg then fails with "cannot access archive" and leaves packages unpacked but not configured (seen on systemd, docker-ce and containerd.io on ten hosts over three weeks).
Later tasks in the same play that use `/tmp` fail too ("No such file or directory"), until a new SSH connection gets a new private `/tmp`.
Out of scope: changing `PrivateTmp` on `ssh.service`, and the `pve` dist-upgrade path beyond using the same directory.
## Proposal
- New input `system_baseline_apt_tmpdir` (str, default `/var/cache/system-baseline-apt-tmp`, validated as an absolute path outside `/tmp` and `/var/tmp`).
- `update.yml` creates it (owner root, mode 0700) and runs the upgrade and the autoremove with `TMPDIR` set to it.
- After the upgrade, `meta: reset_connection`, so later tasks get a connection with a fresh private `/tmp`.
- The directory is created only when an upgrade will run (not in the main flow's check mode, where the upgrade is skipped).
## Acceptance criteria
- [ ] Default run creates the directory with mode 0700 and a second run reports no change. Check: Molecule converge, idempotence and a `stat` assertion in verify.
- [ ] The upgrade and autoremove tasks carry `TMPDIR` set to the input. Check: a lint-level test or Molecule verify that greps the task file, since the container cannot restart ssh.service.
- [ ] A value inside `/tmp` or `/var/tmp`, or a relative path, is refused before any change. Check: a Molecule converge play that expects the failure.
- [ ] `argument_specs.yml`, the README and a changelog fragment (`bugfixes`) cover the input. Check: `ansible-doc`, `antsibull-changelog lint`.
- [ ] Not verified by CI: a real openssh-server upgrade on a host with `PrivateTmp=yes`. State it in the PR.
Assisted-by: Claude Code
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
The
updateflow upgrades packages over the SSH connection Ansible is using. When the upgrade includesopenssh-server, the package restartsssh.service. If that unit hasPrivateTmp=yes(thesystemd_hardeningrole sets it), systemd deletes the unit's private/tmpand/var/tmpwhen the unit stops, and the session Ansible is still using sees an empty one. In the middle of the upgrade this removes the.debfiles apt staged under/tmp/apt-dpkg-install-*and the apt module's own payload. dpkg then fails with "cannot access archive" and leaves packages unpacked but not configured (seen on systemd, docker-ce and containerd.io on ten hosts over three weeks).Later tasks in the same play that use
/tmpfail too ("No such file or directory"), until a new SSH connection gets a new private/tmp.Out of scope: changing
PrivateTmponssh.service, and thepvedist-upgrade path beyond using the same directory.Proposal
system_baseline_apt_tmpdir(str, default/var/cache/system-baseline-apt-tmp, validated as an absolute path outside/tmpand/var/tmp).update.ymlcreates it (owner root, mode 0700) and runs the upgrade and the autoremove withTMPDIRset to it.meta: reset_connection, so later tasks get a connection with a fresh private/tmp.Acceptance criteria
statassertion in verify.TMPDIRset to the input. Check: a lint-level test or Molecule verify that greps the task file, since the container cannot restart ssh.service./tmpor/var/tmp, or a relative path, is refused before any change. Check: a Molecule converge play that expects the failure.argument_specs.yml, the README and a changelog fragment (bugfixes) cover the input. Check:ansible-doc,antsibull-changelog lint.PrivateTmp=yes. State it in the PR.Assisted-by: Claude Code