Unable to start Jenkins due to /tmp directory mounted with noexec option

Article ID:218233908
1 minute readKnowledge base

Issue

  • /tmp directory is mounted with noexec

...
Caused by: java.lang.UnsatisfiedLinkError: /tmp/jna
...
failed to map segment from shared object: Operation not permitted

Environment

  • CloudBees Jenkins Enterprise

Resolution

Any of the below solutions can be used.

  • Permanently Remove noexec from /tmp mount

    # 1. Edit /etc/fstab
    # Remove noexec from line containing /tmp mount
    vi /etc/fstab
    # 2. Restart
    shutdown -r now
    # 3. Confirm /tmp now allows executing
    # /tmp should not include noexec
    mount -l
    # 4. Confirm Jenkins starts correctly
    service jenkins start
  • Change java.io.tmpdir

    # 1. Edit Jenkins config file
    # Add -Djava.io.tmpdir=$JENKINS_HOME/tmp to JENKINS_JAVA_OPTIONS
    # Eg. JENKINS_JAVA_OPTIONS="-Djava.io.tmpdir=$JENKINS_HOME/tmp"
    vi /etc/sysconfig/jenkins
    # 2. Create tmp directory
    mkdir $JENKINS_HOME/tmp
    # 3. Make sure Jenkins is the owner
    chown MY_JENKINS_USER:MY_JENKINS_GROUP $JENKINS_HOME/tmp
    # 4. Restart Jenkins
    service jenkins restart