Mount /tmp as tmpfs

Message
Author
User avatar
fehlix
Developer
Posts: 12937
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#11 Post by fehlix »

BitJam wrote: Sun Dec 23, 2018 1:49 am It is okay for /tmp to be tmpfs because there is no guarantee that files under /tmp will survive a reboot.
The question remains, how can we follow the Linux Filesystem Hierarchy Standard, which states clearly:
Chapter: 3.18. /tmp : Temporary files wrote:Although data stored in /tmp may be deleted in a site-specific manner, it is recommended that files and directories located in /tmp be deleted whenever the system is booted.
As within the installed system we do have currently /tmp symlinked => /var/tmp and by this we do not follow the standard,
as we must not delete /var/tmp on reboot, and hence cannot clear /tmp on reboot.
Suggest to change our current default to have /tmp not symlinked to /var/tmp but keep it as separate /tmp folder.
And we make sure that the default deletion of files in /tmp are activated ( e.g. in /etc/default/rcS ).
If users than want to have /tmp put as tmpfs into shared memory we might add a commented line into /etc/fstab
something like:

Code: Select all

#uncomment to have /tmp as temporary filesystem that resides in memory 
#tmpfs      /tmp           tmpfs   defaults,mode=1777 0  0
which might help the user to easily put /tmp in RAM by just commenting out this /tmp line in /etc/fstab
:puppy:

User avatar
oops
Posts: 2032
Joined: Tue Apr 10, 2018 5:07 pm

Re: Mount /tmp as tmpfs

#12 Post by oops »

@fehlix ...The question is especially: is this standard relevant?
For which features /var/tmp is very important to keep?
Otherwise there is no relevance to changing current behavior (IMHO).
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils MX Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19-23_x64 & antiX23_x32 runit

User avatar
fehlix
Developer
Posts: 12937
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#13 Post by fehlix »

oops wrote: Sun Dec 23, 2018 9:04 am @fehlix ...The question is especially: is this standard relevant?
For which features /var/tmp is very important to keep?
Otherwise there is no relevance to changing current behavior (IMHO).
Yes, the point is, as soon as you install a app/programm, which is programmed
according to the standard and requires to have it's var/tmp data available after reboot
to function properly, you might have an issue, as the app might not work properly.
So as @BitJam pointed out better stay with the standard to avoid issues later.
:puppy:

User avatar
oops
Posts: 2032
Joined: Tue Apr 10, 2018 5:07 pm

Re: Mount /tmp as tmpfs

#14 Post by oops »

@fehlix
Yes but in an exhaustive way, for which programs (they must be probably very rare?)
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils MX Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19-23_x64 & antiX23_x32 runit

User avatar
fehlix
Developer
Posts: 12937
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#15 Post by fehlix »

oops wrote: Sun Dec 23, 2018 9:18 am @fehlix
Yes but exhaustively, for which programs (they must be very very rare?)
Good question .. you might find out (or not) when something is not behaving properly, and you start to debug :eek:

User avatar
anticapitalista
Developer
Posts: 4315
Joined: Sat Jul 15, 2006 10:40 am

Re: Mount /tmp as tmpfs

#16 Post by anticapitalista »

Running live does not symlink tmp to /var/tmp.
Only on installation does it do so.
The gui installer has these lines.

Code: Select all

if (exitStatus == QProcess::NormalExit) {
        updateStatus(tr("Fixing configuration"), 99);
        chmod("/mnt/antiX/var/tmp",01777);
        shell.run("cd /mnt/antiX && ln -s var/tmp tmp");
This must have been a decision by MEPIS.

antiX cli-installer also does not symlink tmp to var/tmp
anticapitalista
Reg. linux user #395339.

Philosophers have interpreted the world in many ways; the point is to change it.

antiX with runit - lean and mean.
https://antixlinux.com

User avatar
fehlix
Developer
Posts: 12937
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#17 Post by fehlix »

anticapitalista wrote: Sun Dec 23, 2018 9:35 am Running live does not symlink tmp to /var/tmp.
Only on installation does it do so.
The gui installer has these lines.

Code: Select all

if (exitStatus == QProcess::NormalExit) {
        updateStatus(tr("Fixing configuration"), 99);
        chmod("/mnt/antiX/var/tmp",01777);
        shell.run("cd /mnt/antiX && ln -s var/tmp tmp");
This must have been a decision by MEPIS.

antiX cli-installer also does not symlink tmp to var/tmp
May I interpret your comment, as support of my proposal to keep /tmp not symlinked to /var/tmp in MX Linux, which I hope is the case :happy:
:puppy:

User avatar
anticapitalista
Developer
Posts: 4315
Joined: Sat Jul 15, 2006 10:40 am

Re: Mount /tmp as tmpfs

#18 Post by anticapitalista »

fehlix wrote: Sun Dec 23, 2018 9:47 am
anticapitalista wrote: Sun Dec 23, 2018 9:35 am Running live does not symlink tmp to /var/tmp.
Only on installation does it do so.
The gui installer has these lines.

Code: Select all

if (exitStatus == QProcess::NormalExit) {
        updateStatus(tr("Fixing configuration"), 99);
        chmod("/mnt/antiX/var/tmp",01777);
        shell.run("cd /mnt/antiX && ln -s var/tmp tmp");
This must have been a decision by MEPIS.

antiX cli-installer also does not symlink tmp to var/tmp
May I interpret your comment, as support of my proposal to keep /tmp not symlinked to /var/tmp in MX Linux, which I hope is the case :happy:
:puppy:
From MX-19 onwards, ok if the other devs have no objections.
anticapitalista
Reg. linux user #395339.

Philosophers have interpreted the world in many ways; the point is to change it.

antiX with runit - lean and mean.
https://antixlinux.com

User avatar
MAYBL8
MX Packager
Posts: 602
Joined: Thu Dec 31, 2009 1:48 pm

Re: Mount /tmp as tmpfs

#19 Post by MAYBL8 »

Ok I have read all of your posts.
So I am confused.
Do I need tmpfs to be /var/tmp for my SSD to be set up correctly or does it not matter how this is set?
Sorry if I am taking this thread off topic.

User avatar
fehlix
Developer
Posts: 12937
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#20 Post by fehlix »

dcihon wrote: Sun Dec 23, 2018 10:15 am So I am confused.
Sorry about this :bawling:
Here what I would do:
Reboot with LiveUSB MX18
Mount rootMX17 or rootMX18
Assuming now rootMX18 is mounted under /media/demo/rootMX18:

Edit as root fstab /media/demo/rootMX18/etc/fstab
within the mounted rootMX18 and add this line to fstab

Code: Select all

tmpfs      /tmp           tmpfs   defaults,mode=1777 0  0
NOTE: noatime option as we are dealing with SSD noatime not needed in tmpfs
Now remove the tmp->var/tmp symlink
i.e. remove /media/demo/rootMX18/tmp < this is a symlink to var/tmp

Create an empty folder ( as user root )
/media/demo/rootMX18/tmp
now reboot.
:puppy:
EDIT: noatime is not need in tmpfs -

Post Reply

Return to “General”