Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 56592 - bootmisc tmp cleaning
Summary: bootmisc tmp cleaning
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 21445 39387 42589 54083 94905 99630 (view as bug list)
Depends on:
Blocks: 94905
  Show dependency tree
 
Reported: 2004-07-10 01:53 UTC by Danny Milosavljevic
Modified: 2006-12-23 09:57 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
bootmisc (bootmisc,3.42 KB, text/plain)
2005-06-03 19:21 UTC, SpanKY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Danny Milosavljevic 2004-07-10 01:53:07 UTC
Hi...

I wondered if it were possible to create a /etc/cleanuptmp.d/ directory and place a script per program (for these which require bootup tmp cleaning) there.

As it is now, /etc/init.d/bootmisc contains a lot of static rm commands to remove now-invalid stuff from tmp on (re)boot (.X0-lock, ...). It would be better if these commands would be in the middle of the bootmisc script but in an external script. Also seperation which rm commands are for what package would be good. So I propose for example:

/etc/cleanuptmp.d/X:
rm -f /tmp/.X[0-9]*

/etc/cleanuptmp.d/esound:
rm -f /tmp/.esd*

/etc/cleanuptmp.d/ORBit2:
rm -f /tmp/orbit-*

and so on

/etc/init.d/bootmisc would do:
if [ -d "/etc/cleanuptmp.d" ]
then
  for s in /etc/cleanuptmp.d/*
  do
    if [ "${s%*~}" = "$s" -a -s "$s" ]
    then # no ~ at end, and not empty
      source "$s"
    fi
  done
fi
(or put that in a nice external script like /sbin/cleanup-tmp and call it from bootmisc)

Or you could do it for all kinds, not just tmp, also for /var/lock, /var/run, whatever...

Tell me what you think...


Reproducible: Always
Steps to Reproduce:
Comment 1 Danny Milosavljevic 2004-07-10 02:13:59 UTC
btw I am messing with tmp cleaning since I am searching for the culprit of removing my empty /* directories like /sys /mnt /boot everytime ... hence I'm cleaning up any wildcard and/or -r rm commands, and thought why don't split the rm commands in a way comprehensible to the user (i.e. one file per package) :)
Comment 2 SpanKY gentoo-dev 2004-07-10 08:50:52 UTC
regardless of your motivations, i think this is a great idea ...

i dont like the name in /etc/, but i like the idea :)
Comment 3 Danny Milosavljevic 2004-07-17 05:29:33 UTC
ok what about /etc/cleanstart.d/ :)
Comment 4 Danny Milosavljevic 2004-08-27 12:46:18 UTC
I think it would be particulary easy to implement. Even I could do it, and I will :) 

probably something along the lines of:

tmpclean.eclass:

tmpclean_pkg_postinst()
{
        if [ ! -z "${TMPCLEAN_FILES}" ]
        then
                mkdir -p /etc/cleantmp.d
                insinto /etc/cleantmp.d

                for s in ${TMPCLEAN_FILES}
                do
                        newins "${s}"
                done
        fi
}

and in each ebuild that installs stuff that has tmpfiles, set TMPCLEAN_FILES to  the script to do the cleaning.

What do you think ?
Comment 5 Danny Milosavljevic 2004-08-27 12:52:25 UTC
and the stuff for bootmisc:

if [ -d "/etc/cleantmp.d" ]
then
  for s in "/etc/cleantmp.d/"*
  do
     if [ "$s" = "${s%*~}" ]
     then # no backup
        source "$s"
     fi
  done
fi
Comment 6 Danny Milosavljevic 2004-09-26 08:19:53 UTC
bootmisc tmpclean is finished and ready, so why not pick it up into baselayout ? *reminder* :)
Comment 7 SpanKY gentoo-dev 2004-10-02 22:48:53 UTC
*** Bug 21445 has been marked as a duplicate of this bug. ***
Comment 8 SpanKY gentoo-dev 2004-10-03 01:15:43 UTC
*** Bug 54083 has been marked as a duplicate of this bug. ***
Comment 9 SpanKY gentoo-dev 2004-10-03 01:15:47 UTC
*** Bug 39387 has been marked as a duplicate of this bug. ***
Comment 10 SpanKY gentoo-dev 2004-10-03 02:13:54 UTC
*** Bug 42589 has been marked as a duplicate of this bug. ***
Comment 11 SpanKY gentoo-dev 2004-10-04 05:12:59 UTC
*** Bug 54083 has been marked as a duplicate of this bug. ***
Comment 12 Pat Suwalski 2005-04-07 12:19:52 UTC
I fail to see why we can't do things properly and clear out *everything* from /tmp like every other distro. I would like to see this feature without using ram-eating tmpfs.

It angers me how many alsa, cups, keyring, gconf, and acroread files there are over time.

Having these lists sourced from separate ".d" files will just slow my bootup down even more.
Comment 13 rob holland (RETIRED) gentoo-dev 2005-06-03 05:44:55 UTC
*** Bug 94905 has been marked as a duplicate of this bug. ***
Comment 14 rob holland (RETIRED) gentoo-dev 2005-06-03 05:45:50 UTC
vote for just flat out cleaning /tmp properly from me :) regardless of this
cleanup.d fluffy thing.
Comment 15 kfm 2005-06-03 05:59:08 UTC
Re: comment 14 ... I, for one, wholeheartedly concur.
Comment 16 SpanKY gentoo-dev 2005-06-03 19:21:44 UTC
Created attachment 60547 [details]
bootmisc

here is a new bootmisc script which has the option to wipe /tmp

just set WIPE_TMP="yes" in /etc/conf.d/bootmisc

can people test and make sure it works before i commit ?
Comment 17 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2005-06-10 11:05:33 UTC
I've tested it with baselayout 1.11.12-r4, no problems.
Comment 18 rob holland (RETIRED) gentoo-dev 2005-06-17 09:34:01 UTC
works for me
Comment 19 cilly 2005-07-05 05:16:23 UTC
This is how osx does it:

if [ -d /tmp ]; then
    cd /tmp && {
    find . -fstype local -type f -atime +3 -ctime +3 -exec rm -f -- {} \;
    find -d . -fstype local ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
        >/dev/null 2>&1; }
fi
Comment 20 Rohan McGovern 2005-07-05 05:23:44 UTC
Why no progress on this bug?  Although an atime cronjob potentially might, in 
pathological cases, cause problems, what's wrong with rm -rf /tmp/* at boot 
like tigger said?  Are there any known problems with doing this? 
 
If the answer is "I don't know"... well, I've been mounting /tmp as tmpfs for a 
long time and not a single thing has ever gone wrong with it :-) 
Comment 21 SpanKY gentoo-dev 2005-07-05 08:49:41 UTC
you clearly need to re-read the bug
Comment 22 SpanKY gentoo-dev 2005-07-09 16:19:42 UTC
added to baselayout svn
Comment 23 SpanKY gentoo-dev 2005-07-20 06:01:21 UTC
*** Bug 99630 has been marked as a duplicate of this bug. ***
Comment 24 Assaf Berg 2005-07-23 10:13:32 UTC
What about configurable cleaning of /tmp? Why not provide the option to those
who want to?
Comment 25 SpanKY gentoo-dev 2005-07-24 02:01:20 UTC
that's already possible, read the config file
Comment 26 Assaf Berg 2005-07-25 10:05:09 UTC
I meant fully configurable, as suggested above (/etc/cleanup.d) not just the
predefined patterns or complete wipe
Comment 27 SpanKY gentoo-dev 2005-07-25 13:51:42 UTC
well you can simply copy & paste that into your local files

i dont believe it'd be used heavily enough to warrant inclusion
Comment 28 Danny Milosavljevic 2006-12-23 02:26:25 UTC
last time I checked, almost every package put some weird temporary files in /tmp/, /var/run/ (bad!), /var/lock/, ${HOME}/, ${HOME}/tmp/, ${HOME}/.gnome2/ or any other unknown location. If you believe you can automate that rather than have the package itself include a temp cleaner (after all, the package would _know_ the actual temp file names), be my guest. I for one don't believe that.

That said, current bootmisc is a good start nevertheless. Thanks.
Comment 29 SpanKY gentoo-dev 2006-12-23 09:57:26 UTC
if packages are using those directories incorrectly, file a bug about it