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

Thread: Move /tmp back to root

  1. #1
    Join Date
    May 2009
    Location
    South Africa
    Beans
    98
    Distro
    Ubuntu 12.04 Precise Pangolin

    Move /tmp back to root

    Hi

    I moved /tmp to RAM to improve performance by adding the following to fstab:

    Code:
    # Move /tmp to RAM
    tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0
    However, this turned out to be a bad idea for me (poor performance and can't install some packages in R because of the way it uses /tmp), so I want to move /tmp back to root.

    How do I do that?

    The following link refers with same query posted by somebody else (but no answers): http://ubuntuforums.org/showthread.php?t=1158145
    Last edited by Wtwine; March 21st, 2013 at 08:34 PM. Reason: solved

  2. #2
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Move /tmp back to root

    mkdir tmp

    as everything into ram is lost after reboot of course (so nothing to move)

  3. #3
    Join Date
    May 2009
    Location
    South Africa
    Beans
    98
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Move /tmp back to root

    That was easy! Just commented out the line in fstab which moved /tmp to RAM, then mkdir tmp in terminal, and rebooted. Thanks!

  4. #4
    Join Date
    Aug 2010
    Location
    INDIA
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Move /tmp back to root

    Isn't that a bad idea for a computer which doesn't shuts down frequently? Suppose I need to burn a DVD it'll store everything in /tmp I guess. Also if burning takes lot of time and meanwhile I started my virtual box and start playing Scrabble on WinXP then it'll need more RAM. This will cause SWAP partition to be used, too much swap, system heat up and slow. I may be wrong, but if anyone can explain please share that how is mounting /tmp to RAM is going system's performance.

  5. #5
    Join Date
    Apr 2007
    Beans
    2,661
    Distro
    Ubuntu

    Re: Move /tmp back to root

    If you have plenty of RAM and hardly ever need SWAP, then /tmp in RAM may speed up applications that use /tmp to write temporary data. If you end up in a scenario where lots of /tmp data is written, and you are running a lot of processes, then indeed it will have a negative impact, because swap kicks in earlier than if /tmp would not have been in RAM.

  6. #6
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Move /tmp back to root

    Quote Originally Posted by Wtwine View Post
    Hi

    I moved /tmp to RAM to improve performance by adding the following to fstab:

    Code:
    # Move /tmp to RAM
    tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0
    However, this turned out to be a bad idea for me (poor performance and can't install some packages in R because of the way it uses /tmp), so I want to move /tmp back to root.

    How do I do that?

    The following link refers with same query posted by somebody else (but no answers): http://ubuntuforums.org/showthread.php?t=1158145
    hi
    your problems are the mount options. ---> nosuid, noexec .... will never work for /tmp. the idea is OK but you have to look at the permissions (example: some aps are looking not only for the user and group - they are evem looking for the permissions - especially for the t (is the sticky bit) bit is set.
    ciao
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

  7. #7
    Join Date
    May 2009
    Location
    South Africa
    Beans
    98
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Move /tmp back to root

    After I moved /tmp back to root, I have hit another snag.
    Today I did an update, and when I did dist-upgrade, I got this error message:
    mount: /tmp not mounted or bad option
    E: Problem executing scripts DPkg: Pre-Invoke 'mount -o remount,exec /tmp'
    E: Sub-process returned an error code
    Why is /tmp not mounting when I boot, and how do I resolve this?

  8. #8
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Move /tmp back to root

    thats simple, ubuntu settings does not know about your choice. Changing the default settings need a bit more than moving /tmp

  9. #9
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Move /tmp back to root

    IIRC, dpkg caches preinst/postinst scripts in /tmp and launches them from there. If /tmp is on a separate partition and mounted noexec, the partition needs to be remounted exec by APT before invoking dpkg. When you were moving /tmp to RAM, you probably added something like this in /etc/apt/apt.conf or in some file under /etc/apt/apt.conf.d/:
    Code:
    DPkg::Pre-Invoke {"mount -o remount,exec /tmp";};
    DPkg::Post-Invoke {"mount -o remount /tmp";};
    Since your /tmp isn't on a separate partition anymore, remove these lines from the file.

    It's also a good idea to make /tmp world-writable, but set the restricted deletion flag:
    Code:
    sudo chmod +rwxt /tmp
    Last edited by schragge; March 20th, 2013 at 10:03 AM.

  10. #10
    Join Date
    May 2009
    Location
    South Africa
    Beans
    98
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Move /tmp back to root

    After deleting those lines in apt.conf, I managed to upgrade successfully after rebooting. I also changed the permissions on /tmp as advised.
    Thanks!

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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