CPU does not support x86-64-v2

Hello. I am trying to setup sonar-scanner for my Gitlab CI/CD pipeline/

I have followed the steps to create
SONAR_TOKEN

and
SONAR_HOST_URL

and then proceed with creating the following CI/CD job:


# SonarQube Analysis Job
build-sonar:
    stage: build-sonar
    image: sonarsource/sonar-scanner-cli:11
    variables:
        SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
        GIT_DEPTH: "0"

    cache:
        key: "sonar-cache-$CI_COMMIT_REF_SLUG"
        policy: pull-push
        paths:
            - "${SONAR_USER_HOME}/cache"
            - sonar-scanner/
      
    script:
        - sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}"

    allow_failure: true
    rules:
        - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
        - if: $CI_COMMIT_BRANCH == 'master'
        - if: $CI_COMMIT_BRANCH == 'main'
        - if: $CI_COMMIT_BRANCH == 'develop'

My gitlab runner is Ubuntu virtual machine running on the same server as our privately managed gitlab server.

The error I got from the job:

Running with gitlab-runner 16.6.1 (f5da3c5a)
  on (GENERIC) Runner for UTB_V4 project KtvN1TZp2, system ID: s_1de69ef528ed
Preparing the "docker" executor
00:35
Using Docker executor with image sonarsource/sonar-scanner-cli:11 ...
Pulling docker image sonarsource/sonar-scanner-cli:11 ...
Using docker image sha256:3799521e5ac627eeae7bf83028dbb7a3594bef71c9c7b83ea37de21282d91f2d for sonarsource/sonar-scanner-cli:11 with digest sonarsource/sonar-scanner-cli@sha256:0b90dedf01ef875d69a5a151f73d72b8288a319b39cdfd2ee32a729027a00785 ...
Preparing environment
00:03
Running on runner-ktvn1tzp2-project-146-concurrent-0 via ems-gitlab...
Getting source from Git repository
00:37
Fetching changes...
Reinitialized existing Git repository in /builds/testing/TestMate/.git/
Checking out bd34e1f9 as detached HEAD (ref is develop)...
Removing release_notes.md
Skipping Git submodules setup
Restoring cache
00:03
Checking cache for sonar-cache-develop-non_protected...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
Executing "step_script" stage of the job script
00:01
Using docker image sha256:3799521e5ac627eeae7bf83028dbb7a3594bef71c9c7b83ea37de21282d91f2d for sonarsource/sonar-scanner-cli:11 with digest sonarsource/sonar-scanner-cli@sha256:0b90dedf01ef875d69a5a151f73d72b8288a319b39cdfd2ee32a729027a00785 ...
Fatal glibc error: CPU does not support x86-64-v2
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 127

The reason why I am confused is because I can run sonar-scanner-cli-6.2.1 via the VM manually, but it wont run via the CI/CD pipeline. Is that because I am using sonar-scanner-cli:11? and it is not compatible with older CPU’s?

I would really appreciate if someone could point me in the right direction to get this issue resolved.

Hey @Krupis

That’s interesting – we haven’t seen that come up before!

Can you run this command in your build sysctl -a | grep brand and report the output?

Hi,

By coincidence, I encountered this issue yesterday while initiating a container for a client (entirely unrelated to SonarQube).

This is an issue with the CPU defined for the VM. Newer Linux distributions are using a more recent glibc that needs this ‘x86-64-v2’ feature set, which pretty much all processors have had since 2009. It’s available since the Intel Core 1st Gen processors.

This issue only happens for you when running the container because it’s based on a newer Linux distribution.

If the VM is virtualized with KVM/QEMU, check if the CPU type is defined as ‘kvm64’. This CPU type is limiting the type of instructions that can be used and it’s equivalent to veeeery old processor. In this case, the CPU type need to be changed to ‘host’ or ‘host-passthrough’.

This is the topic that helped me: Setting the correct processor for QEMU/KVM - Server Tutorials - Cfx.re Community