Setting Up VirtualBox with Host Webcam Integration

This guide outlines how to connect your computer's webcam to a Linux VM in VirtualBox, detailing steps from installing the required extension pack to attaching and verifying the webcam within the VM.

Prerequisites

  • VirtualBox installed with a Linux environment set up.

  • Oracle VM VirtualBox Extension Pack.

  • To download VirtualBox and the Extensions-pack. visit Official VirtualBox Downloads page.

  • Some commands may requiresudo privileges to execute correctly, especially if you encounter permission issues.

Steps to Integrate Host Webcam

  1. Install the Extension Pack:

    Open a terminal on your host machine and install the VirtualBox Extension Pack by running:

VBoxManage extpack install {path}/{name}

Change "{path}" and "{name}" to the actual file path and name of the extension pack you downloaded.

Example: VBoxManage extpack install /path/to/Oracle_VM_VirtualBox_Extension_Pack-7.0.14.vbox-extpack

  1. Start Your VM:

    Launch your Linux VM through VirtualBox as you usually would. Make a note of your VM-Name for later reference.

  2. List Available Webcams:

    On your host machine's terminal (not within the VM), list the connected webcams by executing:

    VBoxManage list webcams
  3. Attach the Webcam: Attach your host's webcam to the VM by running:

    codeVBoxManage controlvm "VM Name" webcam attach <device_id>

    Replace "VM Name" with your VM-Name and <device_id> with the noted Device-ID. This command might require sudo to execute.

  4. Verify the Webcam in VM:

    Inside your VM, check if the webcam is recognized by executing:

    lsusb

    The USB devices list should show the webcam now.


To Detach the Webcam

When you need to detach the webcam from your VM, use the following command on your host machine's terminal:

VBoxManage controlvm "VM Name" webcam detach <device_id>

Again, Replace "VM Name" with your VM-Name and <device_id> with the noted Device-Id. This command might require sudo to execute.

Last updated