Artix Linux Forum

Init systems => runit => Topic started by: conky60 on 03 March 2019, 00:15:20

Title: Runit and /tmp directory
Post by: conky60 on 03 March 2019, 00:15:20
I have recently installed Artix on a Dell laptop and decided to give the runit version a try. I like kde plasma and I am using that de. Everything went smoothly and my system is working great. However, I notice that my /tmp directory is accumulating a lot of files indicating that is isn't being cleaned. I am unfamiliar with runit since previously I used the openrc version of Artix.
I would like to know how to configure my system to clean /tmp?

Best regards.
Title: Re: Runit and /tmp directory
Post by: nous on 03 March 2019, 12:19:48
Not sure how runit handles /tmp at boot, but have you considered using tmpfs? If you don't store large files in /tmp or if you're on SSD drive and want to keep wear levels low, tmpfs is a neat solution. Otherwise, /etc/rc.local is a good place to put
Code: [Select]
/bin/rm -fr /tmp/{.*,*} &> /dev/null
Title: Re: Runit and /tmp directory
Post by: artoo on 03 March 2019, 12:22:29
You could mount /tmp with tmpfs via fstab.

eg

Code: [Select]
tmpfs                                   /tmp    tmpfs       defaults,noatime,mode=1777     0 0


More detail on arch wiki (https://wiki.archlinux.org/index.php/Tmpfs).
Title: Re: Runit and /tmp directory
Post by: konimex on 03 March 2019, 13:00:55
By default our implementation does not clean /tmp on boot, unlike OpenRC in /etc/init.d/bootmisc.

Our stage1 is yet to support it (and if we do add it, it will be disabled by default), but I can implement it later after mid-terms this week.

You can use nous' solution and put his workaround to /etc/rc/rc.local, or use artoo's solution and mount /tmp as tmpfs (it will use RAM, iirc).
Title: Re: Runit and /tmp directory
Post by: conky60 on 03 March 2019, 14:40:04
Thank you for the helpful replies. I decided to go with @nous'  workaround/solution, and after a reboot my /tmp is much cleaner.
Thanks once again to all who replied. :)


Best regards.
Title: Re: Runit and /tmp directory
Post by: fungalnet on 03 March 2019, 17:46:13
Code: [Select]
tmpfs                                   /tmp    tmpfs       defaults,noatime,mode=1777     0 0

Is that mode definition, I imagine access rights to tmpfs, something specific for ssd and how does it differ from:  ?

Code: [Select]
tmpfs   /tmp   tmpfs   defaults,nosuid,nodev  0  0
Title: Re: Runit and /tmp directory
Post by: nous on 05 March 2019, 20:22:01
In fstab context, 'defaults' are rw, suid, dev, exec, auto, nouser, and async. Options nosuid and nodev prohibit creation of, well, suid and device files. Option noatime speeds up things a little by not writing access times (useful for HDDs and SSDs, irrelevant for tmpfs) and mode sets initial permissions of the root directory (only useful if you've forgotten to set 1777 yourself).