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
16 lines
857 B
YAML
16 lines
857 B
YAML
---
|
|
# Shared by validate.yml and update.yml: the tasks_from: update entry point does not run validate.yml. The directory becomes TMPDIR of the apt
|
|
# upgrade, so it must not be one that an ssh.service restart (PrivateTmp=yes) deletes, and it is created as root: a relative path, a `..` or an
|
|
# odd character must stop the run before anything changes.
|
|
- name: Validate the apt scratch directory
|
|
ansible.builtin.assert:
|
|
that:
|
|
- system_baseline_apt_tmpdir is string
|
|
- system_baseline_apt_tmpdir is match('^/[A-Za-z0-9._/-]+\Z')
|
|
- "'..' not in system_baseline_apt_tmpdir"
|
|
- system_baseline_apt_tmpdir is not match('^/(var/)?tmp(/|\Z)')
|
|
fail_msg: >-
|
|
system_baseline_apt_tmpdir must be an absolute path of letters, digits, . _ - and /, without .., and not /tmp, /var/tmp or a path below them.
|
|
quiet: true
|
|
tags: always
|