The virtual machine does not see usb. Virtualbox does not see USB in Ubuntu. Permanent setup and one-time connection

In this post, I will tell you how to connect a USB drive to a virtual machine so that the guest system treats it as a regular hard drive.

This trick will not only allow you to boot from the installation USB - which, in my opinion, is quite pointless, since an ISO image is written to a flash drive, which is much easier to connect to a virtual computer in VirtualBox. If you connect a USB drive or flash drive to the guest system as a regular drive, you can do such interesting things as:

  • booting from a physical SATA drive via a USB adapter
  • installing Windows on a USB disk or flash drive

If you do not have the opportunity to connect a SATA drive directly to a computer - for example, to a laptop - but you really need to boot into the operating system that is deployed on it, then the trick described here will help you do this: connect the SATA drive to the computer using a USB adapter, and then connect the USB disk to the virtual machine as a regular disk, as shown in this instruction.

Regarding the second point - installing Windows on a USB drive - if you want to install Linux on a flash drive (not burn a Live image, but install a full-fledged system), then for installation it is not necessary to do the trick shown here - since Linux installs perfectly on a portable drive. But Windows prohibits installation on USB drives and flash drives.

I'll show you how to boot from USB in Windows and Linux. The principle is the same in both of these operating systems, but the commands are slightly different due to the specifics of the OS.

How to boot from USB in VirtualBox in Windows

Connect the USB flash drive or disk to your computer. Then click Win+r and execute diskmgmt.msc.

Find your flash drive and remember the disk number:

For example, in my screenshot the flash drive is number 2.

Close all VirtualBox windows if they are open.

In the window that opens, enter:

Now go to the folder where you have VirtualBox installed. If this program is installed in the default directory, then the command to go to is:

Cd %programfiles%\Oracle\VirtualBox

If you chose a different location for VirtualBox, then edit the previous command accordingly.

Now in the command line paste the following command in which replace # on the disk number that we looked at just above, then press Enter:

VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive#

For example, this is my second disk, then the command looks like this:

VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive2

If everything went well, the following message should appear:

RAW host disk access VMDK file C:\usb.vmdk created successfully.

Please note that you can replace C:\usb.vmdk to any file location you wish.

This command creates a virtual machine disk (VMDK) file pointing to the physical disk you selected. When you load a VMDK file as a disk in VirtualBox, then VirtualBox will actually have access to the physical disk.

Now open VirtualBox as an administrator - this is mandatory, otherwise it will not work as expected. To do this, click the button Start, dial VirtualBox and select " Run as administrator»:

VirtualBox can only access raw disk devices with administrator rights.

Now in VirtualBox, create a new virtual machine, select the appropriate operating system and when it comes to choosing a hard drive, instead of creating a new one, select Use an existing virtual hard disk:

Now open the file C:\usb.vmdk(or another one if you saved it in a different location or under a different name):

Boot your virtual machine, now it should see your USB flash drive as a regular hard drive. That is, if it is a correctly recorded boot disk or flash drive, then the system will boot from it.

Please note that the USB device must be the first hard drive in your VirtualBox virtual machine, otherwise booting will not occur. If you are connecting a new USB drive to an existing machine, try changing the media order in the settings of that machine, or selecting the appropriate drive at the start of booting.

How to boot from USB in Linux in VirtualBox

To understand the principle, read the previous section about Windows. In Linux, to find out the name of the USB drive, run the command:

Sudo fdisk -l

In my case, the disk has a name /dev/sdb.

To create a virtual disk file pointing to a real disk, run a command like:

Sudo VBoxManage internalcommands createrawvmdk -filename /root/usb.vmdk -rawdisk /dev/sd#

Where instead # Enter the letter of the corresponding drive. Example for my conditions:

Sudo VBoxManage internalcommands createrawvmdk -filename /root/usb.vmdk -rawdisk /dev/sdb

In this command, you can replace /root/usb.vmdk with another location of your choice.

To run VirtualBox with administrator rights, run the command:

Sudo VirtualBox

Everything else - creating a virtual machine and selecting an existing virtual disk as a hard disk - is exactly the same as in Windows.

I think many have already been puzzled by the question of how to still configure USB on Virtualbox in their beloved Ubuntu. Sometimes it is so necessary to connect a USB flash drive directly to Virtualbox, but instead you have to copy data from the flash drive to a shared folder and use the data from this folder in the virtual system (note my article “Share the XP guest folder under Ubuntu”). I also tried to solve this problem for a long time, but it didn’t work out for me, and I didn’t really need it then, but now I accidentally came across a video from YouTube that showed how to connect USB devices. 1. So, first, add yourself to the virtualbox group. To do this, run sudo gedit /etc/group and find the line vboxusers:x:121: and add your username there. 2. Then write getent group vboxusers in the terminal and you will see something like this in the output vboxusers:x: 121 :user If you correctly added the user to the group in the previous step, then after the three-digit number there will be your login, in my case user. From this line we need to remember gid this is a three-digit number, in my case it is 123, I highlighted it in bold, you may have a completely different number. Attention: remember this number, we will need it for the next step. 3. Open in a text editor fstab: sudo gedit /etc/fstab and insert the line there: none /sys/bus/usb/drivers usbfs devgid= XXX,devmode=666 0 0 where XXX, the same qid that we remembered in the previous step. Save the changes and restart your computer. 4. After reboot, launch Virtualbox and go to the properties of your virtual machine. Move to the USB section and there check the boxes “enable USB” and “enable USB 2.0” (my system is in English, I translated these names on the fly, maybe they won’t be called that way in the Russian interface). Then you start the system and to connect USB devices in the navigation window of your virtual machine, go to “Devices - USB devices” and check the required devices. You can also add so that USB devices are connected automatically when the virtual OS starts. To do this, in the virtual machine settings, in the USB section, add the required device to the filter. From the sponsor: Italian furniture factories are famous for their products all over the world. Such furniture is created within the framework of the requirements of European quality standards and will serve its owner for a long time. In addition, Italian furniture factories use natural materials in the production process. Buying furniture from Italian manufacturers means getting a quality product with a beautiful design at an affordable price.

Often those who like to experiment have a need to use a USB device in a virtual machine. A trivial connection through the main menu implies repeated actions every time the VM starts, so in this article we will figure out how to connect a flash drive to a Virtualbox virtual machine by adding a filter that will allow us to use the drive without a constant connection at startup.

You can connect an external USB drive to the virtual machine.

First of all, we need to find out which version of Virtualbox we are using. It's easy to do. Open the manager, click on the “Help” button, select “About the program”. The required information will be indicated in the appropriate field below. In my case it is 4.3.12.

Go to the official Virtualbox website and look for your version of the program. If you are not using the latest one, then you need to go down and find a link to older versions of Virtualbox (Virtualbox older builds). In the detailed information you need to find the Extension Pack for all platforms. Pay attention to this point, you cannot make a mistake here, otherwise the plugin will not be suitable for our program. Let's download it.

In the Virtualbox manager, go to the “File” and “Settings” menu. Go to the plugins section, click on the “Add plugin” icon and look for our downloaded file. Select and click “Open”. We are warned that plugins can lead to failures, the usual scare, if you agree, then click “Install”. We accept the license agreement, move the slider to the very bottom, the “I agree” button is activated, click on it. The plugin has been successfully installed, click on the “Ok” button twice.

Add a filter

Now we select our machine in the list, click “Configure”, go to the “USB” section, in order to edit these settings, it must be turned off. Check the “Enable USB 2.0 controller” checkbox; if you have a newer version, 3.0 will be available. Click on the “Add filter” button and look for your device in the list. The filter has been added, click “Ok”. Let's start our car.

Permanent setup and one-time connection

The flash drive will only be available on the created system while it is turned on. When the machine is turned off, the flash drive is available in real life. This method is suitable if you don’t want to connect the device every time inside a running machine, although this can be done.

How to open a flash drive in a virtual machine? In the main Virtualbox window there is a “Properties” item, click on it and select the “USB Devices” item, then just select the desired device, after which the manager will transfer control of the drive from the operating system of the real machine to the created one.

Conclusion

So, we figured out how to connect a flash drive in Virtualbox. The process itself is quite simple and will only take you a few minutes. If we want to disable automatic connection, then we will only need to remove the filter, and that’s it. With each new article about virtual machines, we gain more and more skills when working with them, train, experiment, and after some time they will become your main weapon when working with new applications or utilities.

If you have any questions, ask them in the comments!

First you need to check the VirtualBOX settings and extension versions. This is an important part of the process.

To solve the group problem, use the commands sudo addgroup vboxusers and sudo adduser USERNAME vboxusers, where USERNAME is your Name user. Do both of these things on the host. Reboot device for this to take effect.

Note that the vboxsf you specified in your groups is actually the filesystem type used by the mount command.

Download the correct extension package from this page and when prompted, open it using Virtualbox.

The last step is setting up USB support on your virtual machine, opening the virtual machine settings in virtualbox, disabling the virtual machine, selecting USB and enabling USB 2.0, and adding and activating filters as needed. See below:

Note. In the recent past, USB 3.0 (XHCI) controllers were not supported, but this functionality was added in Virtual Box 5.0

More information is available in the official documentation. If this doesn't sort it for you, message me and I'll expand on it.

To add a user to a group, follow these steps:

sudo usermod -aG vboxusers "Username"

Error message received:

usermod: group "vboxusers" does not exist

My groups are the following:

karl adm cdrom sudo dip plugdev lpadmin sambashare vboxsf

I'm using VirtualBox 5.0.14, Ubuntu 17.04, Guest Additions 5.0.14 and Extension 5.0.14. I see my USB device in my operating system fine. That is everything is working.

That is, if VirtualBox does not see USB in Ubuntu, you need to check settings such as:

  • Installed extensions
  • vboxuser group

Saving these settings

let's do it again

First you need to make sure you have the Virtualbox expansion pack, this allows usb 2.0. USB 3.0 is not yet supported.

sudo usermod -a -G vboxusers

Please log in for the changes to take effect.

Enable USB 2.0 controller (EHCI) in settings for you VM

conclusions

If VirtualBox does not see USB in Ubuntu, then there may be several reasons for this, which we have listed in the list above. They are, accordingly, a complete and quick solution to this error.

If you find an error, please highlight a piece of text and click Ctrl+Enter.