[Fixed] Ubuntu – /lib64/ld-linux-x86-64.so.2: No such file or directory error – Linux

by
Ali Hasan
alpine-linux raspberry-pi ubuntu

Quick Fix: Check if the virtual machine’s architecture is compatible with the required library. Ensure you are using a Linux/x86_64 or emulated x86 image instead of an ARM image.

The Problem:

I’m facing an issue while running an executable file (Hello world) created on my PC in Virtual Box using Qt Creator and clang on Ubuntu 20.04 on Raspberry Pi 4. The error message I encounter is ‘x86_64-binfmt-P: Could not open ‘/lib64/ld-linux-x86-64.so.2′: No such file or directory’. Upon searching for the missing library file using ‘find / -name "ld-linux-x86-64.so.2"’, I couldn’t find it in the system. As I’m new to Linux, I need assistance in setting up the correct library path to resolve this error.

The Solutions:

Solution 1: Check VirtualBox settings for Raspberry PI 4

To fix the error, ensure that you are using the correct VirtualBox image for your Raspberry Pi 4. Here’s a step-by-step guide:

  1. Open VirtualBox on your PC.
  2. Select the virtual machine where you are trying to run the executable file.
  3. Click on the "Settings" icon (gear icon) in the toolbar.
  4. Navigate to the "System" tab and select "Processor."
  5. Under "CPU Execution Cap," make sure that "Linux/x86_64 | Emulated x86" is selected instead of ARM or ARM64.
  6. Click "OK" to save the changes.

Now, try running the executable file again. It should work without the "No such file or directory" error.

Q&A

Which version of Linux image you are using in virtual box?

Make sure you are using linux/x86_64 | emulated x86 and not ARM image.

Is ld-liux-x86-64.so.2 library installed in the system?

You can use ‘find / -name "ld-linux-x86-64.so.2"’ to check.

How to run executable file made on PC in virtual box?

Use the right library path.

Video Explanation:

The following video, titled "Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Unix: qemu-aarch64: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory. 268 views · 6 months ago ...more ...