Re: [gentoo-user] Delete /tmp content

2017-02-08 Thread Hogren
Hello world !


I do an answer very very very late. But I would to thanks a lot Rich,
Mick, Walter Dnes, James, and Marc Joliet, for their responses.

The basic subject make a interesting conversation.


I think my problem was that my /tmp is a LVM logical volume. The systemd
service did empty the /tmp before the mount of the tmp LV.

I don't very need to separate /tmp from the / LV. So I deleted it (the
/tmp, not the / ^^). An other solution would may be to change the good
systemd service to affect the boot order.


This TOPIC is SOLVED.


Thank you again !


Bye


Hogren


On 16/07/2016 00:18, Marc Joliet wrote:
> On Friday 15 July 2016 08:44:39 Rich Freeman wrote:
>> I checked and it looks like the default on Gentoo is to not clear
>> tmpfiles on a running system at all:
>> cat /usr/lib/tmpfiles.d/tmp.conf
>> v /tmp 1777 root root
>> v /var/tmp 1777 root root
> Which is due to https://bugs.gentoo.org/show_bug.cgi?id=490676 (I still fail 
> to understand the reasoning behind the change, but oh well).  Personally, I 
> manually override Gentoo's own override in order to retain upstream behaviour.
>




Re: [gentoo-user] Delete /tmp content

2016-07-15 Thread Marc Joliet
On Friday 15 July 2016 08:44:39 Rich Freeman wrote:
> I checked and it looks like the default on Gentoo is to not clear
> tmpfiles on a running system at all:
> cat /usr/lib/tmpfiles.d/tmp.conf
> v /tmp 1777 root root
> v /var/tmp 1777 root root

Which is due to https://bugs.gentoo.org/show_bug.cgi?id=490676 (I still fail 
to understand the reasoning behind the change, but oh well).  Personally, I 
manually override Gentoo's own override in order to retain upstream behaviour.

-- 
Marc Joliet
--
"People who think they know everything really annoy those of us who know we
don't" - Bjarne Stroustrup


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] Delete /tmp content

2016-07-15 Thread waltdnes
On Fri, Jul 15, 2016 at 01:43:34PM +0200, Hogren wrote
>Hello everybody !
> 
> After several strange problems, I discovered that my /tmp content was 
> never deleted.
> 
> Is there a natif mechanism (with fstab or other option) and it's just a 
> misconfiguration or there isn't, and I need to use a systemd service ?
> 
> Thanks for your responses !!

  A cron job is the simplest way.  Have cron run the command...

find /tmp -mtime +9 -execdir rm -rf {} \;

...every day.  "-mtime" (number of days ago the file was last modified)
truncates fractions, so +9 (i.e. greater than 9 days) means *AT LEAST
10 DAYS*.  If you want to delete all old files by all users, including
root, the command would have to be run as root.

-- 
Walter Dnes 
I don't run "desktop environments"; I run useful applications



Re: [gentoo-user] Delete /tmp content

2016-07-15 Thread Mick
On Friday 15 Jul 2016 08:44:39 Rich Freeman wrote:
> On Fri, Jul 15, 2016 at 7:43 AM, Hogren  wrote:
> > After several strange problems, I discovered that my /tmp content was
> > never
> > deleted.
> > 
> > Is there a natif mechanism (with fstab or other option) and it's just a
> > misconfiguration or there isn't, and I need to use a systemd service ?
> 
> If you're using systemd this should all be default behavior, unless
> overridden.
> 
> tmpfs ought to be created as a tmpfs due to
> /usr/lib/systemd/system/tmp.mount unless you tell it to do something
> else in fstab or your own tmp.mount, or you somehow disable it.
> 
> That alone should clear it on every reboot.
> 
> I checked and it looks like the default on Gentoo is to not clear
> tmpfiles on a running system at all:
> cat /usr/lib/tmpfiles.d/tmp.conf
> v /tmp 1777 root root
> v /var/tmp 1777 root root
> 
> If you create /etc/tmpfiles.d/mytmp.conf and put those lines with a
> "10d" afterwards then it should purge files older than 10 days
> automatically.  I think.  I don't know exactly how tmpfiles.d
> overrides work.  You might have to copy the entire file to
> /etc/tmpfiles.d/tmp.conf and then edit those two lines in place.  Be
> sure to keep the exclusions, you don't want to kill tmpfiles for
> running daemons.
> 
> Or you can of course use something like tmpreaper.  I still have that
> running from my openrc days, and it of course works fine with systemd.

If you are using openrc go to /etc/conf.d/bootmisc and set:

 clean_tmp_dirs="/tmp"
 wipe_tmp="YES"

-- 
Regards,
Mick

signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] Delete /tmp content

2016-07-15 Thread Rich Freeman
On Fri, Jul 15, 2016 at 7:43 AM, Hogren  wrote:
>
> After several strange problems, I discovered that my /tmp content was never
> deleted.
>
> Is there a natif mechanism (with fstab or other option) and it's just a
> misconfiguration or there isn't, and I need to use a systemd service ?
>

If you're using systemd this should all be default behavior, unless overridden.

tmpfs ought to be created as a tmpfs due to
/usr/lib/systemd/system/tmp.mount unless you tell it to do something
else in fstab or your own tmp.mount, or you somehow disable it.

That alone should clear it on every reboot.

I checked and it looks like the default on Gentoo is to not clear
tmpfiles on a running system at all:
cat /usr/lib/tmpfiles.d/tmp.conf
v /tmp 1777 root root
v /var/tmp 1777 root root

If you create /etc/tmpfiles.d/mytmp.conf and put those lines with a
"10d" afterwards then it should purge files older than 10 days
automatically.  I think.  I don't know exactly how tmpfiles.d
overrides work.  You might have to copy the entire file to
/etc/tmpfiles.d/tmp.conf and then edit those two lines in place.  Be
sure to keep the exclusions, you don't want to kill tmpfiles for
running daemons.

Or you can of course use something like tmpreaper.  I still have that
running from my openrc days, and it of course works fine with systemd.

-- 
Rich