Shell Compatibility Issue in Nexus Repository 3.78.2-04 Startup Script

Environment

  • Nexus Repository: 3.78.2-04 (Community Edition)
  • OS: Debian 12.10

Issue

During service startup, the following error appears:

/opt/nexus-3.78.2-04/bin/nexus: 155: [[: not found

Root Cause

The startup script (bin/nexus) uses bash-specific syntax with /bin/sh shebang:

#!/bin/sh
# ...
if [[ "$data_dir" != /* ]]; then  # Line 155
  data_dir="$PARENT/$data_dir"
fi

On systems where /bin/sh links to a POSIX-compliant shell like dash, the [[ syntax is unsupported.

Reproduction

Standard startup via systemd produces the error:

Mar 20 21:33:46 host systemd[1]: Starting nexus.service - nexus service...
Mar 20 21:33:46 host nexus[92263]: /opt/nexus-3.78.2-04/bin/nexus: 155: [[: not found
Mar 20 21:33:46 host nexus[92263]: Starting nexus
Mar 20 21:33:46 host systemd[1]: Started nexus.service - nexus service.

Proposed Solutions

  1. Change shebang from #!/bin/sh to #!/bin/bash

    OR

  2. Replace bash-specific syntax with POSIX-compliant case statement:

    case "$data_dir" in
      /*) 
        ;;
      *)
        data_dir="$PARENT/$data_dir"
        ;;
    esac
    

Impact

The issue does not prevent service operation but generates unnecessary warnings during startup.

1 Like

We have the same issue. Will this get fixed someday?

The latest version, 3.79.1-04, still has the same shell compatibility issue. You can apply the previously mentioned workaround, such as changing the shebang to #!/bin/bash or replacing bash-specific syntax with POSIX-compliant alternatives.

We have opened an issue internally to restore posix compliance to the startup scripts. Since this was just filed I do not have an ETA to provide.

Rich