Skip to content

main/postmarketos-base: add service to mount /tmp as tmpfs

Administrator requested to merge tmp-as-tmpfs into master

And enable it by default, since it's a sensible thing to do, specially in mobile devices where we can reduce writes to flash storage.

This makes the bootmisc config file unnecessary, since it was only used before to make sure that /tmp was wiped on every boot.

Mounting /tmp as a tmpfs will be skipped if:

  • It is already mounted, to respect users that might have it in /etc/fstab
  • Mounting is disabled by setting deviceinfo_tmp_as_tmpfs_size=0
  • Device has less than 2GB of RAM and the deviceinfo var does not have a non-zero value set

The options for mounting /tmp has been copied from my local debian tmp.mount service. The only real difference is that we are mounting it after /etc/fstab, and they do so before.

Warning, I only tested this in alpine. Should also work in pmOS, but have not had the opportunity to test it yet.

REMOVE BEFORE MERGE: Comments:

  • On upgrade, if /tmp had real files, they will be kept, occupying space, even if they will be "hidden" under the tmpfs mount. We could try removing them, but:
    • The code that does that in bootmisc is not trivial
    • We'll be wasting time in most installations, where it'll be irrelevant to have some extra MB occupied
    • Maybe we could boe crazy and do "rm -rf /tmp"
    • Maybe we could try carrying this logic for just one release, and then remove it, when we know everybody has this enabled, but this would be quite some hazard.

Fixes #2233 (closed)

Edited by Administrator

Merge request reports

Loading