Announcement

Collapse
No announcement yet.

/tmp not empty after reboot

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] /tmp not empty after reboot

    Hi all,

    This is the situation.
    I partitioned my hd in / (20gb) and /home (480gb).
    The /tmp is located on / but it sometimes run out of space (video editing).
    Now I changed the /tmp in a link to a /home/user/tmp folder I've made in my home directory.

    I do not know whether is is the cause but after reboot the folder is not empty. All the files are still there.

    Am I missing something?
    /etc/default/rcS has TMPTIME=0
    /etc/init/mounted-tmp.conf looks at /tmp. I have tried to change this to /home/user/tmp but no such luck.

    Can somebody help me to understand this a bit better?

    Kind regards,
    Jurgen

    #2
    I've not tried this, but you can do a couple things too make this work. First make sure the new tmp folder has the correct permissions - 1777. Then I think the simplest would be to symlink /tmp to the new tmp location. You could also bind mount in fstab:
    Code:
    /home/<USER>/tmp /tmp tmpfs noatime,mode=1777 0 0
    The problem with both of these might be that any user on your system is in YOUR home folder sort of. If you're the only user nothing to worry about. If not, make a new folder outside your home and use that instead of the one in your home.

    Please Read Me

    Comment


      #3
      Originally posted by jurgen View Post
      /etc/init/mounted-tmp.conf looks at /tmp. I have tried to change this to /home/user/tmp but no such luck.
      Can you be sure /home partition is actually mounted when /etc/init/mounted-tmp.conf gets called in the boot process. The system cannot clean /home/user/tmp if it's not mounted.

      Comment


        #4
        oshunluv:
        Yep, that is the problem... There are more users on my system. Anyway, do I use my Ram if I use tmpfs? If so, would that not cause problems when I use a lot of tmp space (e.g. with video editing)?

        kubicle:
        I thought, because my actual tmp folder is in my /home directory, it would be mounted anyway? Can you explain a bit how to do it?
        Last edited by jurgen; Jan 31, 2016, 11:41 PM.

        Comment


          #5
          Originally posted by jurgen View Post
          kubicle:
          I thought, because my actual tmp folder is in my /home directory, it would be mounted anyway? Can you explain a bit how to do it?
          I mean that your filesystems aren't mounted simultaneously during boot (root filesystem is mounted first) and since /etc/init/mounted-tmp.conf is called on mounted /usr or mounted /tmp, /home might not be mounted at that time which means your /tmp is just a dangling symlink to non-existent /home/user/tmp. This is just a possibility, not necessarily the cause.

          Also, are you booting with upstart or systemd as init (because systemd handles tmp cleaning differently):
          Code:
          ls -l /sbin/init

          Comment


            #6
            That is interesting. It seems logical that the /home is mounted a bit later. If this is the case, should it be possible to delay /etc/init/mounted-tmp.conf ?
            Anyway
            ls -l /sbin/init gives: lrwxrwxrwx 1 root root 20 okt 15 15:02 /sbin/init -> /lib/systemd/systemd

            Comment


              #7
              Note that this is a bit speculative on my part, having tmp under /home is a tad unorthodox, and I can't be sure these will work (although they should do no harm either)
              Originally posted by jurgen View Post
              That is interesting. It seems logical that the /home is mounted a bit later. If this is the case, should it be possible to delay /etc/init/mounted-tmp.conf ?
              I guess you could add "mounted /home" on the start conditions (so it gets run when /home is mounted as well), but since
              Originally posted by jurgen View Post
              ls -l /sbin/init gives: lrwxrwxrwx 1 root root 20 okt 15 15:02 /sbin/init -> /lib/systemd/systemd
              You're booting with systemd, I'm not sure the upstart job /etc/init/mounted-tmp.conf is even used.

              Because of that I'd try to include cleaning of /home/user/tmp (have you considered using /home/tmp instead?) in systemd configs instead.

              You could try the following:
              1. Copy /usr/lib/tmpfiles.d/tmp.conf to /etc/tmpfiles.d/

              2. Edit /etc/tmpfiles.d/tmp.conf
              # 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 -
              D /home/<user>/tmp 1777 root root -
              #q /var/tmp 1777 root root 30d

              # Exclude namespace mountpoints created with PrivateTmp=yes
              x /tmp/systemd-private-%b-*
              X /tmp/systemd-private-%b-*/tmp
              x /var/tmp/systemd-private-%b-*
              X /var/tmp/systemd-private-%b-*/tmp
              (You can see "man tmpfiles.d" for details, obviously replace "/home/<user>/tmp" with the actual path)

              3. Save and reboot to test whether it works

              Comment


                #8
                kubicle
                Thanks for your help! I did not consider /home/tmp yet, might be a good idea.
                I have tried your three steps to success method It works great. Thank you for the excellent explanation.

                For now I will keep it this way.

                Blessings,
                Jurgen

                Comment

                Working...
                X