Hi. Prior to installing opensuse 12.3 I was able to go into Yast2 and set CLEAR_TMP_DIRS_AT_BOOTUP in sysconfig editor -> system -> cron to “yes”, and this had the expected result of deleting everything in my /tmp directory every time I booted the system. However, with 12.3 (64-bit; kde) this doesn’t seem to work (meaning I have directories in /tmp that pre-date my most recent boot). Given that the Yast2 setting doesn’t work as expected, is there some reasonably simple way to recreate this functionality? Thanks!
You should have read release notes https://www.suse.com/releasenotes/i386/openSUSE/12.3/RELEASE-NOTES.en.html#sec.123.systemd-tmpdir
Yeah, probably.
OK, I looked at those (better late than never). But, if I understand correctly, I am wanting to modify the /etc/tmpfiles.d/tmp.conf that I just created. The contents of that files are this:
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# Clear tmp directories separately, to make them easier to override
d /tmp 1777 root root 10d
d /var/tmp 1777 root root 30d
# Exclude namespace mountpoints created with PrivateTmp=yes
X /tmp/systemd-private-*
X /var/tmp/systemd-private-*
Now, it lools to me like everything in /tmp is getting deleted after 10 days, and everything in /var/tmp is getting deleted after 30 days. But then there are those exclusions. What are those for?
Yes d stands for days.(checked using alt+F2 ==> xdg-open man:tmpfiles.d(5) ) since there in the conf file for a reason i would avoid removing those from /etc/tmpfiles.d/tmp.conf . Ofcouse you can very well get rid of those entries and experiment and post the result back.
On 2013-07-16 04:36, JJMT wrote:
> Now, it lools to me like everything in /tmp is getting deleted after 10
> days, and everything in /var/tmp is getting deleted after 30 days. But
> then there are those exclusions. What are those for?
There is some confusion here.
The original “/usr/lib/tmpfiles.d/tmp.conf” configures systemd for
deletion of files in /tmp periodically, excluding systemd-private
directories because upstream makes /tmp a a ram based filesystem, which
is created at boot, empty, (via /usr/lib/systemd/system/tmp.mount) and
those directories are created and mantained by systemd. Thus it protects
those files from automated deletion.
However, in openSUSE there is an important difference: /tmp is not a
tmpfs, but a real directory on disk. I don’t remember right now where
this is disabled. I know how to re-enable it, though:
> # mkdir -p /etc/systemd/system/local-fs.target.wants
> # ln -s /usr/lib/systemd/system/tmp.mount /etc/systemd/system/local-fs.target.wants/tmp.mount
So, as /tmp is not a tmpfs in openSUSE, there are some important
differences:
/tmp is not cleared at boot.
/tmp/systemd-private-* are not cleared at boot.
So, we have “/usr/lib/tmpfiles.d/tmp.conf” handling the first part, and
we may add “/etc/tmpfiles.d/remove-systemd-private.conf” to handle the
second one.
eleanor3:~ # cat /etc/tmpfiles.d/remove-systemd-private.conf
R /tmp/systemd-private-*
R /var/tmp/systemd-private-*
eleanor3:~ #
IMHO, it makes no sense the whole “/etc/tmpfiles.d/tmp.conf” you have if
it is the same as “/usr/lib/tmpfiles.d/tmp.conf”. Put there only your
differences to the standard.
–
Cheers / Saludos,
Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)
You are right, of course. I just copied the file as per the instructions in the release notes, and will edit it when I figure out what I want it to say. Right now it is clear that nothing in /tmp is getting deleted, in spite of that 10d instruction. I’ve got non-“systemd-private-*” files there dating back to April. That seems to be consistent with your statement that
But, given when you’ve said about /tmp being mounted upstream as a ram disk, I presume it is possible to delete everything without any adverse consequences? These systemd-private-* files are a mystery to me…
Anyway, it looks like what I want to do is first
> # mkdir -p /etc/systemd/system/local-fs.target.wants
> # ln -s /usr/lib/systemd/system/tmp.mount /etc/systemd/system/local-fs.target.wants/tmp.mount
Second edit my etc/tmpfiles.d/tmp.conf file to reduce the number of days that files sit around. And finally, to deal with the systemd-private-* files, I need to create a file called /etc/tmpfiles.d/remove-systemd-private.conf with the content listed above.
Does that about cover it?
In the end, the solution was pretty simple. I created a file called “/etc/tmpfiles.d/clear-tmp.conf” with the content
R /tmp/*
R /var/tmp/*
Seems to get the job done.
Since you’re using KDE
1)Kicker>System>File Manager Super User Mode select & click
2) Prompted for root Give it
3)Select Root in panel to the left go to /usr/lib/tmpfiles.d
4) Find tmp.conf
5)rclick tmp.conf select Open With Select Kwrite
6) find these lines
d /tmp 1777 root root 10d
d /var/tmp 1777 root root 30d
7)change them to this
D /tmp 1777 root root 1s
D /var/tmp 1777 root root 1s
d /tmp/.cache 1777 root root 1s
- click save close root dolphin
9)reboot
Then your tmp will clear at each boot I know because it WFM.
But openSUSE recommends using /etc/tmpfiles.d/tmp.conf instead of /usr/lib/tmpfiles.d/tmp.conf
source:- openSUSE 12.3 Release Notes
On 2013-07-18 04:16, vazhavandan wrote:
>
> Sagemta;2572745 Wrote:
>> Then your tmp will clear at each boot I know because it WFM.
> But openSUSE recommends using /etc/tmpfiles.d/tmp.conf instead of
> /usr/lib/tmpfiles.d/tmp.conf
>
> source:- http://tinyurl.com/az25etp
Yes.
You should leave /usr/lib… alone, and create your modifications in
/etc/tmpfiles.d…
–
Cheers / Saludos,
Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)
On 2013-07-16 22:06, JJMT wrote:
>
> robin_listas;2572237 Wrote:
>>
>> So, as /tmp is not a tmpfs in openSUSE, there are some important
>> differences:
>>
>> /tmp is not cleared at boot.
>> /tmp/systemd-private-* are not cleared at boot.
>
> But, given when you’ve said about /tmp being mounted upstream as a ram
> disk, I presume it is possible to delete everything without any adverse
> consequences? These systemd-private-* files are a mystery to me…
Just consider them as some files/directories that systemd uses for
purposes of its own, which you should not delete while the system is
running.
>
> Anyway, it looks like what I want to do is first
>
>
> Code:
> --------------------
> > # mkdir -p /etc/systemd/system/local-fs.target.wants
> > # ln -s /usr/lib/systemd/system/tmp.mount /etc/systemd/system/local-fs.target.wants/tmp.mount
> --------------------
huh… why?
> Second edit my etc/tmpfiles.d/tmp.conf file to reduce the number of
> days that files sit around. And finally, to deal with the
> systemd-private-* files, I need to create a file called
> /etc/tmpfiles.d/remove-systemd-private.conf with the content listed
> above.
The “R” does:
R
Recursively remove a path and all its subdirectories
(if it is a directory). Lines of this type accept
shell-style globs in place of normal path names.
(man tmpfiles.d)
–
Cheers / Saludos,
Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)
Using GNOME, so copy to, then gedit change the new ** /etc/tmpfiles.d/tmp.conf** setting of /tmp to 15d and of /var/tmp to 30d avoids them filling up with over a month old, without losing most things regularly used ?
Result:
d /tmp 1777 root root 30d
d /var/tmp 1777 root root 30d
Please IGNORE (or remove) my earlier post, as not accurate…