'Jenkins Pipeline process apparently never started in... Problem

I am stuck in my jenkins pipeline for integrating with sonarqube I have read through other post and the solution was to update the durable plugin; however my plugin is in the latest version v 493.v195aefbb0ff2
Console Output:

Injecting SonarQube environment variables using the configuration: sq1
[Pipeline] {
[Pipeline] sh
process apparently never started in /var/lib/jenkins/workspace/DevOps Demo@tmp/durable-48ce628f
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE

My Jenkinsfile is as below

pipeline {
  agent any
  environment {
        PATH = "/opt/maven"
        BUILD_ID = 'BUILD_NUMBER'
    }
  stages {
    stage('Get Code') {
      steps {
        echo 'Import code GitLab'
        updateGitlabCommitStatus name: 'build', state: 'pending'
        git branch: 'main', credentialsId: 'd6d909b7-d918-4ed3-b65f-426e3200a598', url: 'https://10.10.2.44/root/devops1.git'        
        echo 'build step goes here'
       updateGitlabCommitStatus name: 'build', state: 'success'
      }
    }
   stage('SonarQube analysis') {
     steps {
    withSonarQubeEnv(credentialsId: 'jenkins-sq', installationName: 'sq1') { 
      sh 'mvn sonar:sonar'
      }
     }
    }
  }
}


Solution 1:[1]

Path is error, it must include '/bin' for docker jenkins.

environment {
   PATH = "/opt/maven:/bin"
}

Solution 2:[2]

I also encountered this issue. First I upgraded the Jenkins durable plugin, in my case this solution didn't fixed the problem. After this investigation deeper I found that the PATH variable was the problem. Try to correctly set the PATH variable in the Jenkins environment. Make sure that sh binary from /bin location can be found on PATH. You can run "which sh" to see exactly where is located the sh binary.

environment {
     PATH = "/bin:/usr/bin:usr/local/bin"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dr. Zhu
Solution 2 Alex Dimofte