The update flow upgrades packages over the SSH connection Ansible uses. An openssh-server upgrade restarts ssh.service; when that unit has PrivateTmp=yes, systemd then deletes its /tmp and /var/tmp while the upgrade still needs the files apt staged there. dpkg fails with "cannot access archive" and leaves packages unpacked but not configured.
New input system_baseline_apt_tmpdir (default /var/cache/system-baseline-apt-tmp). The role creates it (root, mode 0700) and runs the upgrade and the autoremove with TMPDIR set to it, then opens a new connection (meta: reset_connection), so later tasks get a fresh private /tmp.
Validated in the main flow and in the update entry point (which does not run validate.yml): an absolute path of letters, digits, ., _, - and /, without .., and not /tmp, /var/tmp or a path below them.
README ("Apt scratch directory"), argument spec, defaults and a changelog fragment.
Differences from the issue
The fragment has bugfixes (the fix) and minor_changes (the new input), because roles/AGENTS.md makes a new input a minor change; the issue said bugfixes.
The directory is created in check mode too, not only when an upgrade runs: the autoremove runs in check mode with the same TMPDIR, which would otherwise point at a missing directory. A dry run reports it once, on a host that does not have it yet. The README says so.
Verified
yamllint and every pre-commit hook pass, including ansible-lint and the changelog fragment lint.
Through Ansible on localhost (no change made): the validation accepts 4 good paths (including /tmpfoo/ok, which is not /tmp) and refuses 10 bad ones (empty, relative, .., /tmp, /tmp/x, /var/tmp, /var/tmp/apt, a space, a line break, /), each with the message that names the input.
The static check that verify uses passes against the real tasks/update.yml.
Not verified
The Molecule scenario has not run on this change. Its first CI run may fail.
The scenario skips the update tag (molecule/default/molecule.yml), so the upgrade never runs there and the directory is never created. Verify only reads tasks/update.yml and checks the mode, the two TMPDIR settings and the connection reset, which is a text check.
A real openssh-server upgrade on a host whose ssh.service has PrivateTmp=yes was not run.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code:claude-sonnet-5-5
## What and why
Closes #374.
The `update` flow upgrades packages over the SSH connection Ansible uses. An `openssh-server` upgrade restarts `ssh.service`; when that unit has `PrivateTmp=yes`, systemd then deletes its `/tmp` and `/var/tmp` while the upgrade still needs the files apt staged there. dpkg fails with "cannot access archive" and leaves packages unpacked but not configured.
- New input `system_baseline_apt_tmpdir` (default `/var/cache/system-baseline-apt-tmp`). The role creates it (root, mode `0700`) and runs the upgrade and the autoremove with `TMPDIR` set to it, then opens a new connection (`meta: reset_connection`), so later tasks get a fresh private `/tmp`.
- Validated in the main flow and in the `update` entry point (which does not run `validate.yml`): an absolute path of letters, digits, `.`, `_`, `-` and `/`, without `..`, and not `/tmp`, `/var/tmp` or a path below them.
- README ("Apt scratch directory"), argument spec, defaults and a changelog fragment.
## Differences from the issue
- The fragment has `bugfixes` (the fix) and `minor_changes` (the new input), because `roles/AGENTS.md` makes a new input a minor change; the issue said `bugfixes`.
- The directory is created in check mode too, not only when an upgrade runs: the autoremove runs in check mode with the same `TMPDIR`, which would otherwise point at a missing directory. A dry run reports it once, on a host that does not have it yet. The README says so.
## Verified
- `yamllint` and every pre-commit hook pass, including `ansible-lint` and the changelog fragment lint.
- Through Ansible on localhost (no change made): the validation accepts 4 good paths (including `/tmpfoo/ok`, which is not `/tmp`) and refuses 10 bad ones (empty, relative, `..`, `/tmp`, `/tmp/x`, `/var/tmp`, `/var/tmp/apt`, a space, a line break, `/`), each with the message that names the input.
- The static check that verify uses passes against the real `tasks/update.yml`.
## Not verified
- The Molecule scenario has not run on this change. Its first CI run may fail.
- The scenario skips the `update` tag (`molecule/default/molecule.yml`), so the upgrade never runs there and the directory is never created. Verify only reads `tasks/update.yml` and checks the mode, the two `TMPDIR` settings and the connection reset, which is a text check.
- A real `openssh-server` upgrade on a host whose `ssh.service` has `PrivateTmp=yes` was not run.
---
- [ ] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none.
Assisted-by: Claude Code:claude-sonnet-5-5
An openssh-server upgrade restarts ssh.service. With PrivateTmp=yes systemd
then deletes that unit's /tmp and /var/tmp, which removes the files apt
staged there while the upgrade is still running, so dpkg fails and leaves
packages unpacked but not configured.
The update flow now creates system_baseline_apt_tmpdir (root, mode 0700),
runs the upgrade and the autoremove with TMPDIR set to it, and opens a new
connection afterwards. The input is validated in the main flow and in the
update entry point: absolute, no "..", not under /tmp or /var/tmp.
Closes#374
Assisted-by: Claude Code:claude-sonnet-5-5
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.
What and why
Closes #374.
The
updateflow upgrades packages over the SSH connection Ansible uses. Anopenssh-serverupgrade restartsssh.service; when that unit hasPrivateTmp=yes, systemd then deletes its/tmpand/var/tmpwhile the upgrade still needs the files apt staged there. dpkg fails with "cannot access archive" and leaves packages unpacked but not configured.system_baseline_apt_tmpdir(default/var/cache/system-baseline-apt-tmp). The role creates it (root, mode0700) and runs the upgrade and the autoremove withTMPDIRset to it, then opens a new connection (meta: reset_connection), so later tasks get a fresh private/tmp.updateentry point (which does not runvalidate.yml): an absolute path of letters, digits,.,_,-and/, without.., and not/tmp,/var/tmpor a path below them.Differences from the issue
bugfixes(the fix) andminor_changes(the new input), becauseroles/AGENTS.mdmakes a new input a minor change; the issue saidbugfixes.TMPDIR, which would otherwise point at a missing directory. A dry run reports it once, on a host that does not have it yet. The README says so.Verified
yamllintand every pre-commit hook pass, includingansible-lintand the changelog fragment lint./tmpfoo/ok, which is not/tmp) and refuses 10 bad ones (empty, relative,..,/tmp,/tmp/x,/var/tmp,/var/tmp/apt, a space, a line break,/), each with the message that names the input.tasks/update.yml.Not verified
updatetag (molecule/default/molecule.yml), so the upgrade never runs there and the directory is never created. Verify only readstasks/update.ymland checks the mode, the twoTMPDIRsettings and the connection reset, which is a text check.openssh-serverupgrade on a host whosessh.servicehasPrivateTmp=yeswas not run.NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code:claude-sonnet-5-5