Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: clear tmp dirs at bootup?

  1. #1

    Default clear tmp dirs at bootup?

    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!

  2. #2
    Join Date
    May 2010
    Location
    Space Colony Lagrange Point 22° à, 77° Ƅ, 56° ɤ, 99° ɜ
    Posts
    3,166

    Default Re: clear tmp dirs at bootup?

    You should have read release notes https://www.suse.com/releasenotes/i3...systemd-tmpdir
    GNOME Version 3.20.2
    openSUSE Leap 42.3 64-bit

    www.vazhavandan.blogspot.com

  3. #3

    Default Re: clear tmp dirs at bootup?

    Quote Originally Posted by vazhavandan View Post
    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:

    Code:
    #  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?

  4. #4
    Join Date
    May 2010
    Location
    Space Colony Lagrange Point 22° à, 77° Ƅ, 56° ɤ, 99° ɜ
    Posts
    3,166

    Default Re: clear tmp dirs at bootup?

    Quote Originally Posted by JJMT View Post
    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:

    Code:
    #  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.
    GNOME Version 3.20.2
    openSUSE Leap 42.3 64-bit

    www.vazhavandan.blogspot.com

  5. #5
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: clear tmp dirs at bootup?

    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:

    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

    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.

    Code:
    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)

  6. #6

    Default Re: clear tmp dirs at bootup?

    Quote Originally Posted by robin_listas View Post
    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.
    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

    Quote Originally Posted by robin_listas View Post
    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.....

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

  7. #7

    Default Re: clear tmp dirs at bootup?

    In the end, the solution was pretty simple. I created a file called "/etc/tmpfiles.d/clear-tmp.conf" with the content

    Code:
    R /tmp/*
    R /var/tmp/*
    Seems to get the job done.

  8. #8
    Join Date
    Jun 2008
    Location
    where I am is where I am
    Posts
    1,162

    Default Re: clear tmp dirs at bootup?

    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
    Code:
    d /tmp 1777 root root 10d
    d /var/tmp 1777 root root 30d
    7)change them to this
    Code:
    D /tmp 1777 root root 1s
    D /var/tmp 1777 root root 1s
    d /tmp/.cache 1777 root root 1s
    8) click save close root dolphin
    9)reboot
    Then your tmp will clear at each boot I know because it WFM.
    We are what we think.
    All that we are arises with our thoughts.
    With our thoughts we make the world.

    My 64 bit: Gateway 5670 UPDATED | RADEON RX 570 |CPU AMD - Ryzen 5 1600
    Opensuse Tumbleweed Plasma 5

  9. #9
    Join Date
    May 2010
    Location
    Space Colony Lagrange Point 22° à, 77° Ƅ, 56° ɤ, 99° ɜ
    Posts
    3,166

    Default Re: clear tmp dirs at bootup?

    Quote Originally Posted by Sagemta View Post
    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
    Code:
    d /tmp 1777 root root 10d
    d /var/tmp 1777 root root 30d
    7)change them to this
    Code:
    D /tmp 1777 root root 1s
    D /var/tmp 1777 root root 1s
    d /tmp/.cache 1777 root root 1s
    8) 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:- https://www.suse.com/releasenotes/i3...systemd-tmpdir
    GNOME Version 3.20.2
    openSUSE Leap 42.3 64-bit

    www.vazhavandan.blogspot.com

  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: clear tmp dirs at bootup?

    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)

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •