public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Delete /tmp content
@ 2016-07-15 11:43 Hogren
  2016-07-15 12:44 ` Rich Freeman
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hogren @ 2016-07-15 11:43 UTC (permalink / raw
  To: gentoo-user

   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 !!

Hogren


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Delete /tmp content
  2016-07-15 11:43 [gentoo-user] Delete /tmp content Hogren
@ 2016-07-15 12:44 ` Rich Freeman
  2016-07-15 17:36   ` Mick
  2016-07-15 22:18   ` Marc Joliet
  2016-07-15 17:48 ` waltdnes
  2016-07-15 18:07 ` [gentoo-user] " James
  2 siblings, 2 replies; 7+ messages in thread
From: Rich Freeman @ 2016-07-15 12:44 UTC (permalink / raw
  To: gentoo-user

On Fri, Jul 15, 2016 at 7:43 AM, Hogren <hogren@iiiha.com> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Delete /tmp content
  2016-07-15 12:44 ` Rich Freeman
@ 2016-07-15 17:36   ` Mick
  2016-07-15 22:18   ` Marc Joliet
  1 sibling, 0 replies; 7+ messages in thread
From: Mick @ 2016-07-15 17:36 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

On Friday 15 Jul 2016 08:44:39 Rich Freeman wrote:
> On Fri, Jul 15, 2016 at 7:43 AM, Hogren <hogren@iiiha.com> 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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Delete /tmp content
  2016-07-15 11:43 [gentoo-user] Delete /tmp content Hogren
  2016-07-15 12:44 ` Rich Freeman
@ 2016-07-15 17:48 ` waltdnes
  2016-07-15 18:07 ` [gentoo-user] " James
  2 siblings, 0 replies; 7+ messages in thread
From: waltdnes @ 2016-07-15 17:48 UTC (permalink / raw
  To: gentoo-user

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 <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-user] Re: Delete /tmp content
  2016-07-15 11:43 [gentoo-user] Delete /tmp content Hogren
  2016-07-15 12:44 ` Rich Freeman
  2016-07-15 17:48 ` waltdnes
@ 2016-07-15 18:07 ` James
  2 siblings, 0 replies; 7+ messages in thread
From: James @ 2016-07-15 18:07 UTC (permalink / raw
  To: gentoo-user

Hogren <hogren <at> iiiha.com> writes:


> 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 ?

app-admin/tmpwatch

might be more feature rich for a solution that you can use
on a variety of systems...

hth,
James








^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Delete /tmp content
  2016-07-15 12:44 ` Rich Freeman
  2016-07-15 17:36   ` Mick
@ 2016-07-15 22:18   ` Marc Joliet
  2017-02-08 11:35     ` Hogren
  1 sibling, 1 reply; 7+ messages in thread
From: Marc Joliet @ 2016-07-15 22:18 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Delete /tmp content
  2016-07-15 22:18   ` Marc Joliet
@ 2017-02-08 11:35     ` Hogren
  0 siblings, 0 replies; 7+ messages in thread
From: Hogren @ 2017-02-08 11:35 UTC (permalink / raw
  To: gentoo-user

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.
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-02-08 11:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 11:43 [gentoo-user] Delete /tmp content Hogren
2016-07-15 12:44 ` Rich Freeman
2016-07-15 17:36   ` Mick
2016-07-15 22:18   ` Marc Joliet
2017-02-08 11:35     ` Hogren
2016-07-15 17:48 ` waltdnes
2016-07-15 18:07 ` [gentoo-user] " James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox