thiagowfx's avatar

¬ just serendipity 🍀 (not just serendipity)

Alpine Linux: clear /tmp upon reboot

• 207 words • 1 min • updated

Clear /tmp at reboot on Alpine Linux via Chimo:

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”

[…]

My current config:

/etc/conf.d/bootmisc conf
# 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="NO"

# Write the initial dmesg log into /var/log/dmesg after boot
# This may be useful if you need the kernel boot log afterwards
log_dmesg="YES"

# Save the previous dmesg log to dmesg.old
# This may be useful if you need to compare the current boot to the
# previous one.
#previous_dmesg=no

I find that to be a sensible change indeed:

shell
% doasedit /etc/conf.d/bootmisc
# [...]
# update from NO:
# wipe_tmp="YES"

I left my config like this:

/etc/conf.d/bootmisc conf
[...]
# Should we wipe the tmp paths completely or just selectively remove known
# locks / files / etc... ?
# wipe_tmp="NO"
wipe_tmp="YES"
[...]

I like to leave the previous / default value commented out, it is a good paper trail1 for my future self.


  1. tombstone, in software engineering parlance ↩︎