使用DPDK配置移动边缘计算NES环境时Qemu缺失usvhost-1设备报错
Hey there, let's break down what's going wrong here and get your NES environment up and running smoothly.
The Core Issue
The error Qemu-System-X86_64: -Chardev Socket,Id=Char1,Path=/Usr/Bin/Usvhost-1: Failed To Connect Socket: No Such File Or Directory boils down to two key problems:
- You’re pointing QEMU to look for a vhost-user socket at
/usr/bin/usvhost-1— this path is totally incorrect./usr/binis meant for executable binaries, not the socket files that DPDK/NES generates. - The socket file
usvhost-1simply doesn’t exist at that location (and shouldn’t be there in the first place).
Step-by-Step Fixes
1. Correct the Vhost-User Socket Path in NES Configuration
First, open your NES config file (the one referenced by NES_SERVER_CONF=/opt/intel/nev_sdk/nes_root/scripts/nes.cfg):
vi /opt/intel/nev_sdk/nes_root/scripts/nes.cfg
Look for settings related to vhost-user sockets (usually labeled something like vhost_socket_path). Update the path to a valid, writable directory — common choices include:
/tmp/usvhost-1(temporary directory, easy to access and manage)/mnt/huge-1048576kB/usvhost-1(same directory as your hugepages, keeps related files grouped)
Save the config file after making this change.
2. Verify the Socket is Created by nes-daemon
Restart the nes-daemon to apply the new config:
cd /opt/intel/nev_sdk/nes_root/scripts/ ./nes-daemon-stop # Run this if the daemon is already active ./nes-daemon-start
After starting, confirm the socket file exists at your new path with:
ls -l /tmp/usvhost-1 # Replace with your chosen path
You should see a socket file listed (it will have an s in the permissions column, indicating it’s a socket type).
3. Fix the QEMU Command
Update your QEMU command to use the corrected socket path. Here’s the adjusted version of your command:
/usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu host -m 4096 -no-reboot -no-hpet \ -drive file=/home/tcs/ubuntu-14.04.5-desktop-amd64.iso,if=virtio,id=drive-virtio-disk1,format=raw \ -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/huge-1048576kB/,share=on \ -numa node,memdev=mem -mem-prealloc \ -device virtio-net-pci,netdev=net0,mac=ac:1f:6b:09:cb:9a -netdev type=tap,id=net0 \ -chardev socket,id=char1,path=/tmp/usvhost-1 \ # This line is fixed! -netdev type=vhost-user,id=mynet1,chardev=char1 \ -device virtio-net-pci,mac=52:54:00:00:00:01,netdev=mynet1,id=net1,csum=off,gso=off,guest_csum=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
4. Additional Checks to Avoid Future Issues
- Load the vhost kernel module: DPDK’s vhost-user functionality requires the
vhost_netmodule. Load it with:modprobe vhost_net - Match permissions: Ensure the user running QEMU has read/write access to the socket file. If nes-daemon runs as root, run QEMU as root too, or adjust socket permissions with
chmod 666 /tmp/usvhost-1. - Validate DPDK environment: Double-check that your
RTE_SDKandRTE_TARGETvariables are set correctly, and that nes-daemon was compiled against the same DPDK version you’re using.
内容的提问来源于stack exchange,提问作者sanjay

