Solve “qemu-system-x86_64”: executable file not found in $PATH

I recently experienced the error Failed creating Qemu driver: exec: “qemu-system-x86_64”: executable file not found in $PATH while trying to create a Qcow2 image for KVM/QEMU using Packer on a CentOS 8 system. After some google searches trying to solve the issue I discovered the quickest solution is hard copying “qemu-kvm” to “qemu-system-x86_64” , in /usr/libexec

Locate the path of qemu-kvm binary:

$ which qemu-kvm
/usr/libexec/qemu-kvm

Copy the /usr/libexec/qemu-kvm file to /usr/libexec/qemu-system-x86_64:

sudo su -
cp /usr/libexec/qemu-kvm /usr/libexec/qemu-system-x86_64

Once the file is copied add /usr/libexec to your PATH:

export PATH=$PATH:/usr/libexec

You can also persist this in bash profile.

$ vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/libexec
export PATH

You can then rerun packer command to build your OS image with debug on:

export PACKER_LOG=1
packer build <options> <hcl-or-json-file>

I hope this guide was helpful in solving the said error message.

Also check:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

AlmaLinux OS is a Linux operating systemd forked from RHEL by the team behind CloudLinux. It is meant to be […]

In a Linux file system, files are stored within a single directory structure, called a virtual directory. The virtual directory […]

VSCodium is an open source, free to use, and community-driven binary distribution of Microsoft’s editor VSCode. The VSCodium binaries are […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.