Home_greyopenFATE - openSUSE feature tracking > #309448
Dashboard | Search | Sign up | Login

Please login or register to be able to edit or vote this feature.

Clean temporary data in SUSE

Feature state

openSUSE Distribution
Done
openSUSE Factory
Done

Description

The current default behavior of SUSE is not touch files in
/tmp
and others to prevent an unwanted data lost. There are at least two requests willing to change it somehow:

  • FATE#307510: Cron: set MAX_DAYS_IN_TMP different from 0
  • Bug #594778 - RN: include tmpwatch in a pattern

The pros:

  • The common meaining of
    /tmp
    is that is for temporary data. FHS says - "Programs must not assume that any files or directories in
    /tmp
    are preserved between invocations of the program". FHS also allows the removal of a content of
    /var/tmp
    and
    /var/cache
    , even if those directories should be more persistent as
    /tmp
    .
  • As SUSE places the /tmp and /var on root partition by default and not remove the content of it, the free space should be simply eaten. There are a lot of applications in SUSE distribution that stores a lot of data inside those dirs, but because of the common meaning - they not removed them. For instance - Mozilla Firefox, ssh, gpg, kde, mc, Adobe Flash, and many others. The other way is to fix all of those programs to safely remove all content they store in
    /tmp
    after it's not needed.

The cons:

  • Strictly speaking the not removal of /tmp and others is not againts FHS.
  • Change of the default is dangerous, especially if we are talking about files removal, because long time SUSE users might rely on this specific behavior of SUSE.
  • The default should be SAFE and not removing of files is considered as a safe default.

Please note this FATE is
not about concrete technical solution (existing scron script, tmwatch, tmpfs, /dev/shm, or something else). The question is -
change the default behavior to remove temporary files, or not ? And if so, which ones and how often.

Discussion


icons/user_comment.png P. J. wrote: (7 years ago)

I'm not really sure how this differs from Feature #307510, but never mind - the only advantage of this change is to save disk space. Disk space is becoming cheaper by the minute and Terabyte is no longer an exotic amount reserved for large datacentres. I say we keep the safe default in openSUSE, and leave it to the sysadmin to do the one-line change if he or she wants to automatically purge temporary files.

icons/user_comment.png M. V. wrote: (7 years ago)

The biggest reason is that this FATE does not recommend the technical solution.

You're not right, the advantage is to prevent the filling of the disc on a running system. Your argument about cheaper disc space is true only if you consider new and new hardware. The existing one has typically fixed amount of disc space, should not be wasted by having a lot of unwanted data in
/tmp
. For instance my five year old laptop has 40GB HDD and 7GB root partition, so it is very sensitive on available space - not all SUSE are in datacenters :-).

icons/user_comment.png P. J. wrote: (7 years ago)

So for five years you have (presumably) managed quite well without this default setting. My argument about cheaper disk space has held true since around 2000 when disk sizes started doubling about once a year due to GMR. Not having temporary files purged was not an issue then, I see no reason why it is likely to become an issue now or later (with disk sizes continuing to grow). Neither openSUSE nor SuSE Linux have ever done such an automatic purge by default, so I maintain it is not a safe change as people may well have gotten used to keeping non-temporary data in /tmp.

Given the minimal advantage, the risk of deleting non-temporary data and that changing the retention time is a matter of five seconds with vi, this is really not much of a feature. IMHO.

icons/user_comment.png G. B. wrote: (7 years ago)

Cleaning /tmp on bootup and/or periodically through a cronjob is also common practice on all other major Linux distros (e.g. Debian, Ubuntu, RHEL/Fedora, Mandriva) and UNIX(-like) OS (e.g. Solaris/Opensolaris, OpenBSD).

I'd also really like to hear any use cases and reasons why users would put any valuable data in /tmp (rather than /var/tmp or their homedir) and expect it to persist indefinitely.

icons/user_comment.png G. P. wrote: (7 years ago)

It's not necessarily (just) about disk size, there is also the aspect of partitioning and /tmp may not be all that large.

It's also not primarily about data centers (which is not the key focus of openSUSE), but more individual users or wide spread use not necessarily governed by professional admins, and there this just reduces risk assuming we go for a somewhat conservative default (not just 24 hours). The use case is my significant other's machine (or mine), not some data center.

For what it's worth, I, for one, don't want to keep all the crap that tends to pile up under /tmp for years.

And non-expert users, of which we have many, will be surprised what kind of staff remains under /tmp, leaving behind a trail many won't be aware of, remaining even after months or years.

icons/user_comment.png P. J. wrote: (7 years ago)

Well, the non-expert user is exactly who I am worried about and why I think this feature is unsafe The non-expert user won't be aware of how the professional sysadmins would like to run things, and might just (intentionally or not) store or have stored valuable data in /tmp. Oops.

Besides, I disagree about the use case - my use case is my datacentre run by professional sysadmins. (who decided what the primary target audience for openSUSE is? I thought we were still aiming to be everything for everyone.)

icons/user_comment.png G. B. wrote: (7 years ago)

The non-expert user will store his data in /home/non-expert where these neatly named folders Documents, Music, Pictures etc. are. But he will fill slowly fill up his 10G rootfs by opening lots of pdfs, mp3s, archives etc. from Firefox (which are put into /tmp and never get deleted) without being aware of it , let alone how to avoid this in the first place.

icons/user_comment.png P. J. wrote: (7 years ago)

I'm less concerned about the new non-expert user, more about the OLD ditto who had already been using e.g. /tmp for storing non-temp data. For him this would not be a safe change, even if it was bent in neon in the Changelog. (as for Firefox using /tmp - my FF3.6 doesn't seem to store anything there?)

icons/user_comment.png M. V. wrote: (7 years ago)

> I'm less concerned about the new non-expert user, more about the OLD ditto who had already been using e.g. /tmp for storing non-temp data.

Are there any serious reasons why those data needs to be stored in /tmp and should not be placed elsewhere in system? I'm sure that expert you mention is fully able to understand the meaning of /tmp and place his files to other safe location. Or at least disable this behavior.

As I understood your arguments - there is a bug (or rather an uncommon behavior of SUSE, if you'd preffer it), but because some people rely on that, so it might be not fixed/changed. And sorry, but that's not seems to me as a right argumentation.

icons/user_comment.png P. J. wrote: (7 years ago)

No, there are no real reasons why data needs to be stored in /tmp (unless they are genuinely temporary).

My arguments against this are:

* it is unsafe. openSUSE/SuSE Linux has not been purging /tmp at least since 4.4.1 (my first SuSE Linux).Some innocent non-expert user might very well end up having valuable data purged.

* the change is so easily made that it's difficult to imagine why we are even discussing it here.

* the change brings no real world benefits.

icons/user_comment.png G. B. wrote: (7 years ago)

>* it is unsafe. openSUSE/SuSE Linux has not been purging /tmp at least since 4.4.1 (my first SuSE Linux).Some innocent non-expert user might very well end up having valuable data purged.

That really sounds a bit far fetched. tmp is short for temporary.

tem·po·rary:
lasting for a limited time

(in this case 10 days)

>* the change is so easily made that it's difficult to imagine why we are even discussing it here.

Not to the innocent non-expert user who doesn't even know that this option exists, that it is not turned on by default, and why he actually wants it changed.

>* the change brings no real world benefits.

 It has been pointed out that several times that it prevents filling up the root patition. And not everyone has a multi-terabyte rootfs, IIRC by default the installer creates a relatively small rootfs and assigns the rest of the available space to a partition which gets mounted on /home.

In effect the default setting is more likely to cause harm which is why it should be changed and why e.g. FATE#307510 was requested in the first place.

icons/user_comment.png P. J. wrote: (7 years ago)

Last entry on my part - in my opinion, it is not a
safe change and it brings little or no real-life benefits. The default setting has caused little or no harm in the last 15 years, and it is difficult to imagine why it should become more likely to cause harm in the future.

icons/user_comment.png R. G. wrote: (7 years ago)

Can, please, the people who are
against this provide a
clear user case in which retaining these files is desirable? I really can't imagine such scenario... In the 10+ years I'm using Linux I've never see anyone using /tmp as storage folder: in fact, most people I know simply
ignore the content of /tmp and /var/tmp folders.

Some time ago a friend of mine had a problem with a print job which went crazy: in a few seconds a log file of several GB was created without his knowledge and afterwards he had problems to log-in in his system because the disk was full: cleaning /var/tmp was the solution.

icons/user_comment.png P. J. wrote: (7 years ago)

Use case: Retaining files stored in /tmp in desirable when they meant to be kept.

icons/user_comment.png P. J. wrote: (7 years ago)

Use case: Retaining files stored in /tmp is desirable when they were meant to be kept.

icons/user_comment.png R. G. wrote: (7 years ago)

My first reaction to your "answer" was a mixture of "are you kidding?" with a "Wait, what?", but I will try to maintain the conversation in the right track. After all, we are here exchanging ideas. Articulated and complete ideas.

Files that enters
automatically in the tmp folder have no value per se in the long run (youtube videos, partial downloads, temporary image files... in /var/tmp you can also find log files which only show interesting information when something goes wrong, temporary information from kde sessions...). Some of those files are erased by the app that generated them, but some not, specially when the app crash.

And as I pointed before, useless and big log files are really common, specially when there is a crash.

Log files are useful only immediately after a crash, and if you set a reasonably default you will not lost them.

Point is: If there is some valuable information there that needs to be kept forever it is because the user puts it
on purpose ... and I cannot imagine why someone should put valuable information on a
temporary directory on purpose...

So, again, why we should need to keep those directories without maintenance? Or if you prefers, why there could be on those directories files meant to be kept? And which are those important files?

icons/user_comment.png R. D. wrote: (7 years ago)

As per FHS, I have used files in /tmp for the Use case, that I did not care about them, and wanted them automatically deleted.
/tmp is expected to be a local filesystem with fast access, and not expected to be accessible from other hosts in network or backed up.
The user Home Directory or administrator project data directories, are the sane locations for "retaining files".

As /tmp is a special case and well documented, the automatic purging of temporary files, which are not wanted for retention, should as a "Use Case" over turn a poorly chosen historical default in SuSE Linux.

icons/user_comment.png S. P. wrote: (7 years ago)

Another pro here is performance, when /tmp is kept in RAM via tmpfs, access is blazingly fast (good for large compile jobs, etc.). One issue might be a lack of sufficient physical RAM, but if /tmp needs more than what is available swap is gonna be used anyways, so /tmp ends up on disc again and should have the same performance as before. Nonetheless on a netbook or a computer with only small physical RAM available, a tmpfs solution should avoid swapping. So a /tmp size limit might be necessary.

icons/user_comment.png R. D. wrote: (7 years ago)

Non-temporary /tmp files, would be the ones most likely to end up as disk pages, freed from RAM. True temporary files, probably won't (with ext3 & ext4 anyway) actually be saved onto disk before being deleted. Actually with small RAM, you WANT pages evicted (contrary to received wisdom), all the little used pages, are better in swap partition.
The draw back using TMPFS is the pressure it puts the Linux VM under, and file size limits don't work as well as they used to with huge media flash files (FLV) getting saved there.

I switched back to using a disk filesystem for /tmp, which makes purging MORE (not less) important, because re-boots don't automatically clean it up.

icons/user_comment.png S. M. wrote: (7 years ago)

Since 11.3 has been already released, I've changed the product from 11.3 to distribution.

Please continue further discussions.

icons/user_comment.png M. S. wrote: (7 years ago)

The default partition-based layout for SuSE restricts the root partition to only 20GB and uses the rest for /home (excluding swap). I have had most customers' systems become unable to reach runlevel 5 at one time or another due to their root partition being full. On new installs, I now do not allow a separate home partition to be created during install for this very reason. Plus, we still should not be too assured that lots of disk space will always be available. Some programs create temporary files of size 4GB or more. This would quickly fill /tmp if in constant use. This really should be changed to support the FHS recommendation.

icons/user_comment.png R. D. wrote: (6 years ago)

Why don't you just turn on the clean up yourself, it's couple of variables in 'cron' section of sysconfig.
Depriving your customers of upgrade advantages of a seperate /home, seems a drastic choice, when /tmp can be cleaned by changing '0' to '7' in 1 textfile!

icons/user_comment.png J. D. wrote: (7 years ago)

Withing one week I had two different openSUSE 11.3 machines preventing me from logging in because GBs of garbage in /tmp filled up / to 100%.
This definitely needs some kind of automatic cleanup, at least in 11.4.

icons/user_comment.png P. J. wrote: (7 years ago)

Sounds like bug, did you report this in bugzilla? It sounds a lot like Bug #633106.

icons/user_comment.png R. D. wrote: (6 years ago)

Does an "alternative" default package satisfy everyone, as sanity & reason to respect FHS is not rapidly prevailing?
cron_config_SuSE_legacy - "SuSE Legacy - Eventually Fill /tmp; select to increase Support costs"
cron_config_FHS_clean_tmp - "FHS - Automatic /tmp Cleanup, like real traditional UNIX"

At least then selection of alternative is a simple package selection choice.

icons/user_comment.png P. B. wrote: (5 years ago)

A default which would purge /tmp upon each restart? As long as there's a nice way to turn that off, it should make everyone happy.

I don't know of any simple one-click trick to purge the system of it's temp stuff. /var/log and /var/tmp can have some build up too.

If you really insist to clean /tmp upon boot, you can always add this line to your /etc/fstab as I did some time ago:

tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

Not a sexy solution to the layman (to me it is!!). My friend, new to Linux, replied boldly "this is nuts!".

icons/user_comment.png P. G. wrote: (5 years ago)

I've run into the problem of the temp directories filling up the root partition on older machines with smaller hard drives. I've tried to fix it by setting the retention time of /tmp to 30 days and added /var/tmp with a setting of 90 days to sysconfig via YaST. However, these settings don't always seem to be obeyed.

On my previous 11.x installations the settings seemed to be ignored completely, whilst on a fresh 12.1 install I can see that although the directories are relatively clean size-wise, there are many small files well over those 30- or 90-day limits. I've also sometimes resorted to flushing the temp directories on boot via the sysconfig setting but this still leaves many old files untouched.

icons/user_comment.png M. S. wrote: (4 years ago)

Same for me - in the past I had root partitions filling up several times. As the automatic clean up used to work on 12.3 and 12.2, I thought this was intentional. Indeed I believe I've seen the decision to change that on one of the numerous FATE/BNC entries, although I don't remember where exactly. But after the upgrade to openSUSE 13.3, I was quite surprised that this functionality is gone again. At first I suspected a bug, only to find out that it has been disabled explicitly:
/usr/lib/tmpfiles.d/tmp.conf says "SUSE policy: we don't clean those directories"

So a strong +1 from me to reenable cleaning, especially after this already has been the default for two releases.

icons/user_comment.png R. G. wrote: (4 years ago)

Does not setting this feature in 'Yast2>/etc/sysconfig/cron' does this work? I regularly set this; but, had not checked whether it is really cleaned up :)

icons/user_comment.png B. O. wrote: (4 years ago)

This is truly insane. Once I had lots of free space on a 20GB root partition so I decided to go for 16GB this time. After a few month KDE starts dropping out, Yast Updates start failing (pulling KDE down too :/) etc etc.
/tmp was 5 Gigabyte!

If I was a novice user, I would have never found a quick solution enabling me to start the GUI again and openSUSE would just be considered 'stupid cause it crashes so much'. For goodness sake, experts changes values but novice people don't. Set defaults for them and let experts script their own preferences.

icons/user_comment.png B. O. wrote: (4 years ago)

@Per Jessen: Let's get personal. You are the only one here that rejects cleaning the directory.
Setting the values in Yast2>/etc/sysconfig/cron does not work anymore and if you go to edit the alternative you get
# SUSE policy: we don't clean those directories

If people decided once to store data in a trashcan, that is up to them. Making systems crash in respect to legacy is just beyond words. Or do you never empty the trashcan at house as people might have stored something in it and you get a bigger house every 10 years anyways......?

icons/user_comment.png S. W. wrote: (3 years ago)

For anyone who wants to know how to fix this personally, installing tmpwatch automatically adds it to cron.daily, and the old SUSE method was removed in Factory.

icons/user_comment.png K. C. wrote: (12 months ago)

Could we at least try something like moving old files in /tmp to some other arbitrary directory name (e.g. /.tmp.994810811) and see if anybody notices that they are gone?

Last change: 6 months ago
Voting
Score: 71
  • Negative: 4
  • Neutral: 2
  • Positive: 75
Feature Export
Application-xmlXML   Text-x-logPlaintext   PrinterPrint