Подключить usb виртуальная машина linux

How to set up USB for Virtualbox?

I’m using Ubuntu Maverick and Virtual Box 3+. I have Windows 7 Ultimate. The problem is that it doesn’t detect USB drives in Windows 7, but USB peripherals (mouse + keybord) are working. I followed these instructions, but I can’t find the user group vboxusers . How can I continue? I would also like to upgrade to the latest version without any risk (without losing my virtual hard disk drive).

For your second question, the one about upgrading, you should probably have a look at this: askubuntu.com/questions/19268/…

10 Answers 10

1. Install Extension Pack

USB 1.0 is supported in the version installed from the Ubuntu repositories (from VirtualBox > 4.x).

For USB 2.0 and USB 3.0 we need to install the free (but closed source) VirtualBox Extension Pack (NOT the «platform packages») from the VirtualBox download page. If you had installed VirtualBox from the repositories you have to make sure to choose the extension pack for the right version of VirtualBox. You can see the version of your installed VirtualBox in the help > About VirtualBox menu. For regular updates and bug fixes, it is recommended to install the most recent VirtualBox version from the Oracle repository.

All virtual machines need to be powered off before installing the extension.

2. Become a «vboxuser» in Host machine (local machine)

To be able to get access to an attached USB device, the Ubuntu host user needs to be in the vboxusers group. Add your user to this group by running the following command

sudo usermod -aG vboxusers

and reboot or logout/login.

3. Activate USB support in VirtualBox Manager

Shut down your virtual machine and open USB settings in the VirtualBox Manager. Tick Enable USB Controller and USB 2.0 (EHCI) Controller or USB 3.0 (xHCI) Controller .

If these settings are greyed out, you need to shut down the virtual machine.

enter image description here

4. Select host USB device for access from the guest

To grant access to USB devices we need to select a device to disable in the host and to enable in the guest (this is a precaution to avoid simultaneous access from host and guest). This can be done from the panel Devices menu or by right mouse click in the bottom panel of the VirtualBox Manager on the USB icon:

enter image description here

Tick the device you need in the guest, untick it if you need it in the host. If you can’t see your USB device in that list, it means that VirtualBox cannot access your host USB devices. Make sure your user is added to the vboxusers group and that you restarted your host.

The selected device will immediately be accessible from the guest. A Windows guest may need additional drivers.

  • Windows 7 needs an additional driver for USB 3.0 support.
  • Windows 10 does not accept an NTFS formatted USB pen drive.
Читайте также:  Изменить rpm пакет linux

enter image description here

[optional] Use USB filters for permanent access in the guest

By defining USB filters we can define USB devices that will automatically be presented to the guest when booting the guest OS.

enter image description here

Click on the green + symbol on the right to add a known device.

Note, that some devices may lead to a boot failure of the guest. We can not use these devices for filters.

Read more on USB support in the VirtualBox User Manual.

May be its late to comment but I’m using VirtualBox 4.3.14 in Ubuntu 14.04 and the command you have provided to add users to vboxusers ( sudo usermod -aG vboxusers ) was not working. instead a small change was required while providing options. I did give -a -G instead of giving -aG to make it work.

@learner That’s very strange, since -aG and -a -G should have the same effect when passed as options to usermod . Is it possible that instead you had not logged out and back in the first time, but had done so the second time?

@EliahKagan its been so many months so I have forgotten. But your explanation is the logical one so may be I have logged out and back the second time.

sudo apt-get install gnome-system-tools 

enter image description here

I had a host ubuntu and a guest ubuntu. Most importantly do this on host not guest and one also needs Virtualbox extension pack apart from the guest additions (and save yourself an hour and a frustration).

The vboxusers will be in the /etc/group file. You edit it with something like nano .

Add your user to the vboxusers line, or create one if necessary.

As Takkat has pointed out, to get full USB device support, you’ll need to install the full version of Virtualbox (not the OSE).

The ppa I have for the «official» virtualbox is here:

/etc/apt/sources.list.d/virtualbox-offical-source.list: deb http://download.virtualbox.org/virtualbox/debian maverick contrib #VirtualBox Offical Source 

In Ubuntu 16.04 LTS, after the initial install with

sudo apt install virtualbox virtualbox-guest-additions-iso 
sudo usermod -a -G vboxusers $USER sudo apt install virtualbox-ext-pack 

Then I could enable USB 2/3 support in the machine settings.

What the virtualbox-ext-pack actually does, is download the required files from http://download.virtualbox.org/virtualbox and prompt you to accept the license before installing.

I had the same problem. After trying all the other solutions I realised my problem.

I had downloaded virtualbox from the Ubuntu Software Center, which didn’t have the latest version of virtualbox, so I had accidently downloaded the wrong version of «Oracle VM VirtualBox Extension Pack».

  1. open virtualbox, click help, click about, find your virtualbox version number.
  2. Goto https://www.virtualbox.org/wiki/Download_Old_Builds_4_3 (replace «4_3» with your version).
  3. Download the «Extension Pack» that matches your virtualbox version.
  4. Install that, and it might ask you if you would like to downgrade, click yes.

I had the same problem and fixed it by clicking in the VirtualBox group of my user. You can access it installing gnome-system-tools (it does not come with Ubuntu 12.04 Precise Pangolin), either via the Ubuntu Software Center, Synaptic or by typing in the terminal:

sudo apt-get install gnome-system-tools 

Remember that to paste in the terminal you have to use Ctrl + Shift + V , as opposed to Ctrl + V .

You will probably have to enter your password to allow the installation and add a Y (as in yes) to finish installing the packages.

Читайте также:  Редактор реестра для линукс

Then you head to your Dash home and type users. You will see two applications. The good one is Users and Groups.

You then have to click on Advanced settings for your user and enter your password.

Now you will be shown a window with three tabs. Click on User Privileges. Find the line that says Use Virtualbox virtualization solution and then OK.

Change user group privileges

You may be asked to enter your password again. Then click on Close and log-out and log-in again.

When you start VirtualBox, you should see a whole bunch of new USB devices.

Источник

How to Enable USB in VirtualBox

If your data center depends on VirtualBox and your virtual machines depend on the USB device, you’ve perhaps noticed that USB doesn’t support by default unless you’ve manually enabled it.

In this article, we will explain to you how to enable USB support on Virtualbox. The current version of VirtualBox 6.0 comes with support for USB 3.0, and to take advantage of it, you need to install the latest version of VirtualBox Extension Pack.

This tutorial presumes that you already installed VirtualBox on your Linux and VirtualBox guest additions on your virtual machines. If you haven’t, you can install it using the following articles.

How to Install the VirtualBox Extension Pack

To install the latest version of Extension Pack, head over to the Virtualbox Downloads page and grab the file for All supported platforms.

1. Once you’ve downloaded, open up VirtualBox –> Click File –> Preferences in the Menu.

VirtualBox Preferences

2. Next, click on the Extension tab and then click the + sign.

Virtualbox Extension

3. Select the downloaded Extension Pack and install it as shown.

Install Virtualbox Extension Pack

4. Scroll through the Virtualbox License and then click I Agree button to install it.

Virtualbox License Agreement

5. Enter your sudo password and allow the installation to finish.

Installing Virtualbox Extension PackInstalled Virtualbox Extension Pack

Enabling USB Access to User

To allow a user to access the USB subsystem, you need to add the user (running VirtualBox) to the vboxusers group using the following command.

$ sudo usermod -aG vboxusers

Where USERNAME is the name of the user running the VirtualBox.

Add User to vboxusers Group

Once the command runs successfully, logout and log back into the system.

Enabling USB Support in VirtualBox

Start up VirtualBox, right-click on the virtual machine that needs access to a USB device, and click Settings.

VirtualBox VM Settings

In the virtual machine’s Setting tab, click on USB to see the available USB devices. Click on the + sign to add a new device.

Enable USB Support in VM

Once USB device added, start up the virtual machine to have access to the data on the USB device. If you want to enable more USB devices, go back into the Settings –> USB and add the devices.

Источник

How to Access USB from VirtualBox Guest OS

There are times when you need to access USB from VirtualBox. For instance, you installed Kali Linux in VirtualBox and a USB wireless network adapter is required to do penetration testing. This simple tutorial will show you how to easily access your USB thumb drive, USB hard disk, or USB wireless network adapter in your Virtualbox guest OS.

It’s assumed that you have already set up VirtualBox on your host OS.

Step 1: Install Virtualbox Extension Pack

VirtualBox by default only supports USB 1.x devices. VirtualBox extension pack includes support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards. You must install the extension pack with the same version as your installed version of VirtualBox.

Читайте также:  Удалить все пустые строки linux

To check the version of your VirtualBox, open VirtualBox manager, then go to Help > About VirtualBox . Once you know the version number, go to http://download.virtualbox.org/virtualbox/ in your web browser to download VirtualBox extension pack which ends with .vbox-extpack extension.

install VirtualBox extension pack

Once downloaded, in VirtualBox manager go to File > Preferences > Extensions. Click the add button to add VirtualBox extensions pack from your hard disk.

virtualbox extensions pack usb 2.0 usb 3.0

Once you choose the extension pack, click Install button to install it. You can see what functionalities it adds to your virtual machine in the description.

Oracle VM VirtualBox extension pack

Then click Agree to accept VirtualBox license.

VirtualBox License

So now Virtualbox USB support is enhanced.

Step 2: Add Your User to vboxusers Group

In order for VirtualBox to see your USB devices, your user must be in the vboxusers group. Open up a terminal window (Ctrl+Alt+T), then run the following command. Replace your-username with your real username. (I assume your host OS is a Linux distro such as Ubuntu, instead of Windows).

sudo gpasswd -a your-username vboxusers

Now log out and log back in so the changes can take effect. To check which groups your user account belongs to, run:

If you still aren’t in the vboxuser group, then restart your computer.

Step 3: Enable USB Controller and Add New USB filter

Click settings for your virtual machine.

Access USB devices in virtualbox

Select USB on the left pane. Then choose USB 2.0 controller or USB 3.0 controller. Note that you can only enable one type of controller. Next, insert your USB device to your host machine and click the add button to add new USB filter.

virtualbox add new usb filter

Choose your USB device and Click OK.

Selection_009

Step 4: Access USB from VirtualBox

Now boot up your virtual machine and you will see your USB device in the guest OS. It should be noted that your host OS won’t be able to see the USB device while it’s being used by VirtualBox.

To unmount USB device from guest OS, select devices > USB and uncheck your USB device.

access USB drive in virtualbox guest os

To mount USB in VirtualBox again, simply select your USB drive in the list.

How to Boot VM From USB Stick

Let’s say you created a bootable USB stick and you want to boot your VirtualBox VM from the USB stick. Virtualbox allows your VM to access raw hard disk, by creating a special VMDK image. I assume your host OS is Linux.

First, find the device name of your USB stick.

Mine is /dev/sdb . Then run the following command to create a VMDK image file /tmp/usb.vmdk .

sudo VBoxManage internalcommands createrawvmdk -filename /tmp/usb.vmdk -rawdisk /dev/sdb

Change the ownership of this file. Replace username with your real username.

sudo chown username:vboxusers /tmp/usb.vmdk -R

Then add your user account to the disk group, so you can access raw hard disk.

sudo adduser username disk

Log out and log back in for the changes to take effect. Then open Virtualbox and attach the raw disk ( /tmp/usb.vmdk ) to your VM.

Wrapping Up

Does this post helped you access USB drive in VirtualBox guest OS? Let me know in the comments section below. As always, if you found this post useful, subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page.

Источник

Оцените статью
Adblock
detector