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

Thread: /tmp not emptying not unmounting

  1. #1

    Default /tmp not emptying not unmounting

    Leap 15
    KDE 5

    Directory /tmp is not emptying or unmounting. Contains files from months past, including over 100 PDF files left over from Okular. Have also noticed an error message flashing by about /tmp not unmounting during computer restart or shutdown.

    Code:
    drwxrwxrwt   1 root root 6688 Aug 16 10:49 tmp

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,107
    Blog Entries
    15

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by SUSEtoad View Post
    Leap 15
    KDE 5

    Directory /tmp is not emptying or unmounting. Contains files from months past, including over 100 PDF files left over from Okular. Have also noticed an error message flashing by about /tmp not unmounting during computer restart or shutdown.

    Code:
    drwxrwxrwt   1 root root 6688 Aug 16 10:49 tmp
    Hi
    As designed.... see the output from;
    Code:
    cat /usr/lib/tmpfiles.d/tmp.conf
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,267

    Default Re: /tmp not emptying not unmounting

    When there are messages about /tmp and (un)mounting, you should at least look if it is mounted (that is not a "must") and how it is mounted:
    Code:
    mount | grep '/tmp'
    And no, on openSUSE /tmp is not cleaned at boot by default.
    These are my notes on this:

    For cleaning /tmp and /var/tmp at boot:

    When there is not already a file /etc/tmpfiles.d/tmp.conf create it as a copy

    Code:
    cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d/tmp.conf
    Then change the lines
    Code:
    # Clear tmp directories separately, to make them easier to override
    # SUSE policy: we don't clean those directories
    d /tmp 1777 root root -
    d /var/tmp 1777 root root -
    into
    Code:
    # Clear tmp directories separately, to make them easier to override
    # My policy: empty /tmp en /var/tmp on boot.
    D! /tmp 1777 root root 1d
    D! /var/tmp 1777 root root 1d
    See
    Code:
    man 5 tmpfiles.d
    ================================
    For making /tmp a tmpfs:
    Add an entry into /etc/fstab
    Code:
    tmpfs             /tmp    tmpfs   size=25%,uid=root,gid=root,mode=1777 0 0
    See
    Code:
    man 8 mount
    specialy the section: Mount options for tmpfs.

    Before mounting this file system for the first time (either by command, or by reboot) you should clean the present /tmp directory as good as possible. Existing contents will still occupy disk space when you mount a file system over it.
    Henk van Velden

  4. #4

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by malcolmlewis View Post
    Hi
    As designed.... see the output from;
    Why would "as designed" be to allow a temporary directory to fill with files forever until it ultimately consumes all drive space?

  5. #5
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,107
    Blog Entries
    15

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by SUSEtoad View Post
    Why would "as designed" be to allow a temporary directory to fill with files forever until it ultimately consumes all drive space?
    Hi
    Then I must say you would have something funky going on or applications not cleaning up (a bug report)....?

    On my machines here I see less than 200MB of /tmp space usage, end of the day openSUSE leaves these sorts of thing for the user/administrator to configure...
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  6. #6

    Default Re: /tmp not emptying not unmounting

    Hi,

    To put it in other words, whoever is responsible for dumping files/directories in /tmp should be the one responsible to remove/clean it up. (clean your own...)
    otherwise, yeah a bug report is needed...
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,267

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by SUSEtoad View Post
    Why would "as designed" be to allow a temporary directory to fill with files forever until it ultimately consumes all drive space?
    A few things.

    Yes, in original Unix, it was "normal" to clean /tmp on boot. I assume that in many Linux distributions this is still the default. It seems that in the past openSUSE (or it's forerunners) users have complaint that they lost data they put in /tmp over a (unexpected?) shutdown/boot. As a result the default was changed to what it is now.

    As a good system manager, you should watch the filling grade of your file systems and, independent if /tmp is on a separate file system or not, watch /tmp. When /tmp keeps on growing beyond a reasonable size, you should do something about it (as others above already suggested), like:
    • Find out which user(s) is using /tmp as a permanent storage, either on purpose or, unknowingly, by incident and talk to them.
    • Find applications that use /tmp as long time storage over sessions and see if you can configure them to behave better (or even complain to their makers).
    • Change the default of cleaning at boot or using a tmpfs to let it vanish at shutdown (both described above).
    • As actions on shutdown/boot will not help much on systems that are running for days/weeks/months without boot, a cron job to e.g. remove all files not in use and not touched for two days might be something to consider.
    Henk van Velden

  8. #8
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,565

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by SUSEtoad View Post
    Directory /tmp is not emptying or unmounting.
    May I suggest that, the following systemd services and man page be checked:
    Code:
     > systemctl list-unit-files | grep -i 'tmp'
    tmp.mount                                                        generated
    systemd-tmpfiles-clean.service                                   static
    systemd-tmpfiles-setup-dev.service                               static
    systemd-tmpfiles-setup.service                                   static
    systemd-update-utmp-runlevel.service                             static
    systemd-update-utmp.service                                      static
    systemd-tmpfiles-clean.timer                                     static
     > systemctl status systemd-tmpfiles-clean.service systemd-tmpfiles-clean.timer
    ● systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
       Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static; vendor preset: disabled)
       Active: inactive (dead) since Fri 2018-08-17 09:29:32 CEST; 40min ago
         Docs: man:tmpfiles.d(5)
               man:systemd-tmpfiles(8)
      Process: 12688 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
     Main PID: 12688 (code=exited, status=0/SUCCESS)
    
    ● systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories
       Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.timer; static; vendor preset: disabled)
       Active: active (waiting) since Fri 2018-08-17 09:12:20 CEST; 57min ago
      Trigger: Sat 2018-08-18 09:29:31 CEST; 23h left
         Docs: man:tmpfiles.d(5)
               man:systemd-tmpfiles(8)
    
    Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
     > man systemd-tmpfiles
     >

  9. #9

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by hcvv View Post
    For making /tmp a tmpfs:
    Add an entry into /etc/fstab
    Code:
    tmpfs             /tmp    tmpfs   size=25%,uid=root,gid=root,mode=1777 0 0
    See
    Code:
    man 8 mount
    specialy the section: Mount options for tmpfs.

    Before mounting this file system for the first time (either by command, or by reboot) you should clean the present /tmp directory as good as possible. Existing contents will still occupy disk space when you mount a file system over it.
    Best solution. /tmp is temporary, as it should be.

    Also, ignore my statement that I was seeing an unmounting error about /tmp. The error is not about /tmp, it's actually about /var not unmounting. So many problems to keep track of ...

  10. #10
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,107
    Blog Entries
    15

    Default Re: /tmp not emptying not unmounting

    Quote Originally Posted by SUSEtoad View Post
    Best solution. /tmp is temporary, as it should be.
    Hi
    In your use case, which is how it should be FHS on /tmp it's recommended to be cleaned out, but like the standard says system admin is not in scope and openSUSE likes to follow upstream as much as possible...
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

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
  •