0

I want to access with QEMU this USB stick:

$ lsusb | grep Kingston
Bus 001 Device 011: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102/2.0 / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick

The problem is that I need to change the group from root to kvm:

$ LC_ALL=C ls -l /dev/bus/usb/001/011
crw-rw-r-- 1 root root 189, 10 Feb  3 22:25 /dev/bus/usb/001/011
$ sudo chgrp kvm /dev/bus/usb/001/011
$ LC_ALL=C ls -l /dev/bus/usb/001/011
crw-rw-r-- 1 root kvm 189, 10 Feb  3 22:25 /dev/bus/usb/001/011

How can I make the group change persistent? Alternatively, are there better ways to fix permissions?

This is the command I use:

qemu-system-x86_64 \
-enable-kvm \
-m 4G \
-smp 2 \
-hda myVirtualDisk.qcow2 \
-boot d \
-cdrom linuxmint-21.1-cinnamon-64bit.iso \
-netdev user,id=net0,net=192.168.0.0/24,dhcpstart=192.168.0.9 \
-device virtio-net-pci,netdev=net0 \
-vga qxl \
-device AC97 \
-device usb-ehci,id=ehci \
-usb \
-device usb-host,bus=ehci.0,vendorid=0x0930,productid=0x6545
2
  • 1
    Why do you need to change the group in the first place? Feb 3, 2023 at 23:44
  • If I do not change the group from root to kvm, the virtual machine cannot access the usb stick. Feb 4, 2023 at 13:45

1 Answer 1

0

This solution works on Linux Mint 21 (derivative of Ubuntu 22.04):

# echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0930", ATTR{idProduct}=="6545", OWNER="root", GROUP="kvm", MODE="0666"' > /etc/udev/rules.d/99-usb-stick.rules
# udevadm control --reload-rules && udevadm trigger

More info about this solution:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .