Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7500

Maven fails to load jansi library when /tmp is set to "noexec"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.8.6
    • None
    • None
    • None

    Description

      All of our CICD build servers (CentOS 7) are configured with /tmp being set to 'noexec'.  In that environment when I run maven (v3.8.6) I get the following error:

      fs@c7cbagent01 :~$ mvn --version
      Failed to load native library:jansi-2.4.0-14d515591f448fb6-libjansi.so. The native library file at /tmp/jansi-2.4.0-14d515591f448fb6-libjansi.so is not executable, make sure that the directory is mounted on a partition without the noexec flag, or set the jansi.tmpdir system property to point to a proper location.  osinfo: Linux/x86_64
      java.lang.UnsatisfiedLinkError: /tmp/jansi-2.4.0-14d515591f448fb6-libjansi.so: /tmp/jansi-2.4.0-14d515591f448fb6-libjansi.so: failed to map segment from shared object: Operation not permitted
      Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
      Maven home: /opt/maven
      Java version: 1.8.0_332, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre
      Default locale: en_US, platform encoding: UTF-8
      OS name: "linux", version: "3.10.0-1160.62.1.el7.x86_64", arch: "amd64", family: "unix" 

      Host/OS information:

      fs@c7cbagent01 :~$ uname -a
      Linux c7cbagent01 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 
      
      fs@c7cbagent01 :~$ cat /etc/redhat-release 
      CentOS Linux release 7.9.2009 (Core)

      Filesystem config for /tmp:

      fs@c7cbagent01 :~$ cat /etc/fstab | grep tmp
      /dev/mapper/rootvg-tmplv /tmp                    xfs     nodev,nosuid,noexec 0 0
      /tmp            /var/tmp        none    bind        0 0
      tmpfs            /dev/shm        tmpfs    nodev,nosuid,noexec        0 0 

      So, as per instructions in error message, I tried:

      fs@c7cbagent01 :~$ mkdir ~/tmp
      fs@c7cbagent01 :~$ chmod 777 ~/tmp
      
      fs@c7cbagent01 :~$ mvn -Djansi.tmpdir=~/tmp --version
      <SAME ERROR AS ABOVE>
      
      fs@c7cbagent01 :~$ mvn -Djansi.tmpdir=~/tmp -Djava.io.tmpdir=~/tmp--version
      <SAME ERROR AS ABOVE>
      
      fs@c7cbagent01 :~$ export TMPDIR=~/tmp
      fs@c7cbagent01 :~$ mvn -Djansi.tmpdir=~/tmp -Djava.io.tmpdir=~/tmp--version
      <SAME ERROR AS ABOVE>

      So, pray tell, what do I need to do to work around this issue.

      It also appears that setting /tmp as 'noexec' is a common security feature.  Perhaps maven should establish a location outside of /tmp for the extraction of these libraries.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              multimiler Reid Madsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: