[Bug 2080972] Re: /tmp as non-tmpfs doesn't get cleaned upon reboot

Nick Rosbrook 2080972 at bugs.launchpad.net
Wed Sep 18 13:20:04 UTC 2024


To be specific, the override I would suggest is:

$ mkdir -p /etc/tmpfiles.d
$ cat > /etc/tmpfiles.d/tmp.conf << EOF
D /tmp 1777 root root 10d
q /var/tmp 1777 root root 30d
EOF

In particular, this is flipping the 'q' to a 'D' for the /tmp line.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2080972

Title:
  /tmp as non-tmpfs doesn't get cleaned upon reboot

Status in systemd package in Ubuntu:
  Invalid

Bug description:
  On Oracular, it seems `/tmp` doesn't get cleaned on reboot, when the
  `/etc/systemd/system/tmp.mount` file is present.

  Reproducer:

  $ wget https://cloud-images.ubuntu.com/minimal/daily/oracular/20240913/oracular-minimal-cloudimg-amd64.img
  $ qemu-img resize oracular-minimal-cloudimg-amd64.img +20G
  $ cat >user-data <<EOF
  #cloud-config
  password: ubuntu
  chpasswd: { expire: False }
  ssh_pwauth: True
  EOF
  $ cloud-localds user-data.img user-data
  $ kvm -m 2G -smp 2 -hda oracular-minimal-cloudimg-amd64.img -hdb user-data.img

  In the VM, logged in with `ubuntu`/`ubuntu`:
  $ sudo touch /etc/systemd/system/tmp.mount
  $ df -h | grep '/tmp'  # you can verify that /tmp is a tmpfs, because this is the default now
  $ sudo systemctl reboot
  # Wait for reboot, then login again
  $ echo Hello there >/tmp/will_stay
  $ df -h | grep '/tmp'  # you can verify that /tmp is not a tmpfs anymore
  $ sudo systemctl reboot
  # Wait for reboot again, then login again
  $ cat /tmp/will_stay
  Hello there

  
  At least our auto-upgrade-testing tooling relies on `/tmp` getting cleaned upon reboot, and as a user, this is what I expect too.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2080972/+subscriptions




More information about the foundations-bugs mailing list