Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: clear /tmp at boot doesn't work is systemd

  1. #1

    Default clear /tmp at boot doesn't work is systemd

    I've been wondering why my /tmp directory was so full and just noticed that CLEAR_TMP_DIRS_AT_BOOTUP doesn't work in systemd. I don't know if it has been mentioned already. I just rebooted in system V and /tmp is empty now. Maybe /etc/sysconfig/cron is not used at all.

    * /tmp is on a separate partition (again).

  2. #2
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,721
    Blog Entries
    20

    Default Re: clear /tmp at boot doesn't work is systemd

    I posted about this yesterday
    http://forums.opensuse.org/english/g...ml#post2425402

    There was a bug report files back at Beta stage
    https://bugzilla.novell.com/show_bug.cgi?id=721682
    Leap 15_KDE
    My Articles Was I any help? If yes: Click the star below

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    11,400
    Blog Entries
    3

    Default Re: clear /tmp at boot doesn't work is systemd

    Reported as bug 721682
    openSUSE Leap 15.0; KDE Plasma 5;

  4. #4

    Default Re: clear /tmp at boot doesn't work is systemd

    Good. I was going to try to figure out something. But I see different workarounds already in the bug report.

  5. #5

    Default Re: clear /tmp at boot doesn't work is systemd

    OK. Here's what I did:

    I created the file /etc/tmpfiles.d/tmp.conf with the following content:

    Code:
    #  This file overwrites systemd defaults in /usr/lib/tmpfiles.d/tmp.conf
    #
    # See tmpfiles.d(5) for details
    
    # Clears /tmp and /var/tmp and creates /tmp/.cache
    D /tmp 1777 root root 1s
    D /var/tmp 1777 root root 1s
    d /tmp/.cache 1777 root root 1s
    Notice that I instructed it to create the directory /tmp/.cache in the last line, because I need this directory. In System V, I'm still using ugly commands to do this.

    CLEAR_TMP_DIRS_AT_BOOTUP is ignored by systemd but systemd-tmpfiles achieves the same thing. All I did was overwrite the defaults in /usr/lib/tmpfiles.d/tmp.conf:

    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 General Public License as published by
    #  the Free Software Foundation; either version 2 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
    @nrickert
    The "workaround" you suggested on your blog is just other way to deal with temporary files. If you're not writing anything in /tmp on the filesystem, obviously you don't need to clear anything.

  6. #6
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    11,400
    Blog Entries
    3

    Default Re: clear /tmp at boot doesn't work is systemd

    Quote Originally Posted by please_try_again View Post
    If you're not writing anything in /tmp on the filesystem, obviously you don't need to clear anything.
    There are files created in "/tmp", even if not directly by me. Some of these are reused after a reboot. Some of them are deleted when the application shuts down. But some of them have random names, are not deleted when the application shuts down, and thus accumulate.

    I originally started using "tmpfs" for "/tmp" because that way, together with encrypted swap, I could reduce the problems of unencrypted data being left behind on the disk. That's no longer as important, since I am using an encrypted LVM with the effect that the root file system is encrypted.
    openSUSE Leap 15.0; KDE Plasma 5;

  7. #7
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: clear /tmp at boot doesn't work is systemd

    On 01/03/2012 07:56 PM, nrickert wrote:
    > Some of these are reused after a reboot.


    maybe, but the 'convention' (as i understand it) is that anything of a
    temporary nature which _should_ persist after a boot is be directed (by
    the program developer) to /var/tmp/, and nothing in /tmp should be
    expected to remain though a boot..

    --
    DD http://tinyurl.com/DD-Caveat
    openSUSE®, the "German Engineered Automobiles" of operating systems!

  8. #8
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    11,400
    Blog Entries
    3

    Default Re: clear /tmp at boot doesn't work is systemd

    Quote Originally Posted by DenverD View Post
    maybe, but the 'convention' (as i understand it) is that anything of a
    temporary nature which _should_ persist after a boot is be directed (by
    the program developer) to /var/tmp/, and nothing in /tmp should be
    expected to remain though a boot..
    I agree, and was not suggesting otherwise.

    What is reused, is the directory entry (or file name), not the content. And deleting the name is fine, but it will be recreated.

    My intended point was that those files are not a problem if not cleaned up. It's the ones with random names that accumulate and make "/tmp" messy to scan through.
    openSUSE Leap 15.0; KDE Plasma 5;

  9. #9

    Default Re: clear /tmp at boot doesn't work is systemd

    Quote Originally Posted by nrickert View Post
    My intended point was that those files are not a problem if not cleaned up. It's the ones with random names that accumulate and make "/tmp" messy to scan through.
    If you use RAM instead of filsesystem for /tmp, there is nothing to clear in /tmp at boot because there is nothing left when you reboot. I thought it was obvious enough. But you know that already. So what was the point of explaining to us that /tmp gets filled with random files under Linux? Are you suggesting we never noticed?

  10. #10
    Join Date
    Feb 2010
    Location
    Upstate New York, USA
    Posts
    480

    Default Re: clear /tmp at boot doesn't work is systemd

    As I understand this thread:

    1) systemd does not follow the documented actions concerning /tmp files at boot time, whereas the predecessor systemv adheres to these standards

    2) temporary (F5, change to systemv) allows for clenup of /tmp

    3) There are several novel and imaginative circumventions to resolve the problem, most likely beyond the ken of novice users

    What is the resolution to the problem ? I have booted with systemv, and /tmp is cleared as expected. Although the boot process is a bit longer, systemv does offer the presence of /var/log/boot.msg as well as more verbose boot detail(s). The availability of this log, alone, is worth the boot override to systemv. The lack of adherence to documented boot parameters is usually (and unfortunately) resolved by simply revising said documentation. I do hope such an easy path is not the solution.
    Lap: Gateway NV79, i5-430, 4GB, 2 x 500GB HD, Intel GMA HD
    openSUSE Leap 15.0 x64 + 42.3 x64, KDE 5.15.3, Ubuntu 16.04 LTS, Windows 7

    Test:: openSUSE 15.0, KDE Plasma, Windows/XP/SP3 guest.

Page 1 of 3 123 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
  •