Clear /tmp at reboot on Alpine Linux

By chimo on (updated on )

By default, Alpine Linux doesn’t (completely) clear the /tmp directory on reboot (unless you mount it as tmpfs). If you would like to enable this feature, change “wipe_tmp” to “YES”:

/etc/conf.d/bootmisc
# List of /tmp directories we should clean up
clean_tmp_dirs="/tmp"

# Should we wipe the tmp paths completely or just selectively remove known
# locks / files / etc... ?
wipe_tmp="YES"

The train-of-thought that led me there was:

  1. Why does it take so long to take a snapshot of my `signal-desktop` container?
  2. # Check snapshot sizes
    root@xps:~# du -chs /var/lib/incus/storage-pools/default/containers-snapshots/signal/* 9.1G /var/lib/incus/storage-pools/default/containers-snapshots/signal/pre-patch-2026-02-01T19.54 9.1G /var/lib/incus/storage-pools/default/containers-snapshots/signal/pre-patch-2026-02-02T15.28 18.1G total
    Wow. That doesn’t seem right.
  3. root@signal:~# du -chs /*
    ...
    7.8G	/tmp
    ...
    Huh…?
  4. root@signal:~# ls -lhaS /tmp
    -rwxr-xr-x    1 root     root       15.4M Jan 19 20:38 .org.chromium.Chromium.BCGOJo
    -rwxr-xr-x    1 root     root       15.4M Jan 29 15:36 .org.chromium.Chromium.BFhFGo
    -rwxr-xr-x    1 root     root       15.4M Jan 25 09:46 .org.chromium.Chromium.FKJadh
    ...
    ...
    Hrm.
  5. root@signal:~# ls /tmp/.org.chromium.Chromium.* | wc -l
    1276
    Sigh…
  6. Search the web for “.org.chromium.Chromium”
  7. electron/electron/issues/16097 shows up:
    I have a suspicion that this happens to Electron apps, which package native modules into app.asar instead of app.asar.unpacked/node_modules/
  8. Okay, let’s check Alpine Linux’s APKBUILD for signal-desktop
  9. Oh, this package has a README with its APKBUILD:

    Signal-desktop is an electron application that is rather complex to build
  10. Alright, I don’t have time for this right now. Let’s just treat the symptoms.