Last active
October 14, 2023 15:15
-
-
Save gon1332/70422af1fa6bed497964701b81fef124 to your computer and use it in GitHub Desktop.
VirtualBox+Ubuntu: Fix USB device list not showing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Heavily inspired by https://github.com/dnschneid/crouton/wiki/VirtualBox-udev-integration | |
# | |
vbox_usbnode_path=$(find / -name VBoxCreateUSBNode.sh 2> /dev/null | head -n 1) | |
if [[ -z $vbox_usbnode_path ]]; then | |
echo Warning: VBoxCreateUSBNode.sh file has not been found. | |
exit 1 | |
fi | |
chmod 755 $vbox_usbnode_path | |
chown root:root $vbox_usbnode_path | |
vboxusers_gid=$(getent group vboxusers | awk -F: '{printf "%d\n", $3}') | |
vbox_rules="SUBSYSTEM==\"usb_device\", ACTION==\"add\", RUN+=\"$vbox_usbnode_path \$major \$minor \$attr{bDeviceClass} $vboxusers_gid\" | |
SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$vbox_usbnode_path \$major \$minor \$attr{bDeviceClass} $vboxusers_gid\" | |
SUBSYSTEM==\"usb_device\", ACTION==\"remove\", RUN+=\"$vbox_usbnode_path --remove \$major \$minor\" | |
SUBSYSTEM==\"usb\", ACTION==\"remove\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"$vbox_usbnode_path --remove \$major \$minor\"" | |
echo "$vbox_rules" > /etc/udev/rules.d/virtualbox.rules | |
rm -f /etc/udev/rules.d/*-virtualbox.rules | |
udevadm control --reload | |
adduser `logname` vboxusers | |
echo All actions succeeded. | |
echo Log out and log in to see if the issue got fixed. |
Thanks works perfectly.
It worked for Ubuntu 18.04 host / Win 10 guest
Thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. This fix resolves a VirtualBox usb issue for guest OS Windows 7 on Mac mini mid-2010 host running Linux Mint.