Search code examples
jenkinsdebiantmp

Change /tmp folder for jenkins in debian


enter image description hereI recently had a low disc space issue in jenkins. Although the home directory has sufficient space, the /tmp did not and it brought my master down.

I tried many ways to fix this

  1. Discard old build and deleting old workspaces
  2. Restarting jenkins
  3. Tried to setup a node with same config and starting it, but that failed saying i dont have sufficient permission for copying remote.jar

Since my server is debian, I could not find any file where I could set set -Djava.io.tmpdir Many people talked about jenkin file or config file, but I could not find it.

The only thing that worked was https://updates.jenkins-ci.org/download/plugins/tmpcleaner/ , this plugin hpi, which I installed through Advanced tag in plugins.

Also, I went manually to the /tmp folder in root and then deleted it contents to start the jenkins again. So my question is:

  1. How do i change the /tmp folder in jenkins?
  2. The jenkins home directory is /mnt/data/jenkins, however the tmp it uses it root/tmp. Why is it so? The /mnt/data/jenkins has lots of free space and i manually created a /tmp folder there, but it only takes the /tmp from the root

Solution

  • My colleague found the answer out

    1. open '/etc/defaults/jenkins' file using command 'less /etc/defaults/jenkins'
    2. Add argument

    JAVA_ARGS="$JAVA_ARGS -Djava.io.tmpdir=yourNewtempLocation"

    Once you restart jenkins, you will be able to see the storage of the new space