3

I try to run a qemu virtual machine having a folder shared with host. No matter what I do, I have always the same error: 9pnet_virtio: no channels available for device share.

Host machine is under Linux.

Kernel was compiled with all 9P and virtio options enabled (https://wiki.qemu.org/Documentation/9psetup).

Here's my script to run qemu:

#! /bin/bash

HDA=archlinux.img
HDB=myHome.img
KERNEL=linux/arch/x86/boot/bzImage

if [ -n "${KDB}" ]; then
    KGD_WAIT='kgdbwait'
fi

CMDLINE="root=/dev/sda1 rw vga=792 console=ttyS0 kgdboc=ttyS1 ${KGD_WAIT}"

FLAGS="--enable-kvm -s"
VIRTFS+=" --virtfs local,path=./share/,mount_tag=share,security_model=passthrough,id=share "

exec qemu-system-x86_64 ${FLAGS} \
     -hda "${HDA}" -hdb "${HDB}" \
     ${VIRTFS} \
     -net user -net nic \
     -serial stdio -serial tcp::1234,server,nowait \
     -boot c -m 1G \
     -kernel "${KERNEL}" -append "${CMDLINE}"

When I mount the folder manually (https://www.linux-kvm.org/page/9p_virtio)

mkdir share_folder
mount -t 9p -o trans=virtio,version=9p2000.L share share_folder

The result is the same.

1

Resolved for me (with an ubuntu 18.04 host and 14.04 guest) by adding theses modules:

  • virtio_input
  • 9pnet
  • 9pnet_virtio

into guest file /etc/initramfs-tools/modules.

Don't forget to upadate initramfs for your kernel(s) after add:

update-initramfs -uk <kernel|all>

0

In my case it was failing due to missing virtio_pci module and I fixed it with:

modprobe virtio_pci

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.