错误消息
PS D:\Users\user\Desktop\nxbt> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'generic/ubuntu2010' version '4.2.16' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 8000 (guest) => 8000 (host) (adapter 1)
default: 9000 (guest) => 9000 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
A customization command failed:
["usbfilter", "add", "0", "--target", :id, "--name", "TP-Link UB5A Adapter ()", "--product", "TP-Link UB5A Adapter", "--manufacturer", "", "--productid", "0604", "--vendorid", "2357"]
The following error was experienced:
#<Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["usbfilter", "add", "0", "--target", "2b551c47-0ff9-4833-833b-841207314af9", "--name", "TP-Link UB5A Adapter ()", "--product", "TP-Link UB5A Adapter", "--manufacturer", "", "--productid", "0604", "--vendorid", "2357"]
Stderr: Oracle VM VirtualBox Command Line Management Interface Version 7.0.10
Copyright (C) 2005-2023 Oracle and/or its affiliates
VBoxManage.exe: error: Unknown option '0604'
Usage:
VBoxManage usbfilter add <index,0-N> <--target= <uuid | vmname | global> >
<--name=string> <--action=ignore | hold> [--active=yes | no]
[--vendorid=XXXX] [--productid=XXXX] [--revision=IIFF]
[--manufacturer=string] [--product=string] [--port=hex]
[--remote=yes | no] [--serialnumber=string] [--maskedinterfaces=XXXXXXXX]
>
Please fix this customization and try again.
我在这里使用了自定义的 Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2010"
# Publically forwarded ports.
# The below ports are accessible to all machines on the same network.
# To limit access to the local network, add "host_ip".
# Eg: config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 8000, host: 8000 # Web App
config.vm.network "forwarded_port", guest: 9000, host: 9000 # Remote server
# Explicitly create a shared folder of the Vagrantfile directory at /vagrant in the VM
config.vm.synced_folder ".", "/vagrant"
# Install NXBT
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y python3-pip bluez bluetooth pkg-config build-essential libdbus-glib-1-dev libgirepository1.0-dev
cd /vagrant
pip3 install -e .
SHELL
# Enable USB Controller on VirtualBox
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = 2
vb.customize ["modifyvm", :id, "--usb", "on"]
vb.customize ["modifyvm", :id, "--usbehci", "on"]
vb.customize ["usbfilter", "add", "0",
"--target", :id,
"--name", "TP-Link UB5A Adapter ()",
"--product", "TP-Link UB5A Adapter",
"--manufacturer", "",
"--productid", "0604",
"--vendorid", "2357",]
end
end
我在 Windows 11 上,安装了 python3、vagrant 和 VirtualBox,没有任何问题。我对此很陌生,只想让 NXBT 正常工作。我拥有所有需要的东西,但仍然收到该错误。任何详细的帮助都将不胜感激。
我尝试将 productid 选项替换为 0x0604,但随后出现以下错误:第 35 行:usbfilter 命令中的 :id 选项后有一个意外的字符串文字“TP-Link UB5A Adapter ()”。第 35 行:usbfilter 命令中的“TP-Link UB5A Adapter ()”字符串文字后有一个意外的逗号,,。第 35 行:usbfilter 命令中的“manufacturer”选项后有一个意外的逗号,,。第 35 行:usbfilter 命令缺少结束括号,)我原本希望它能像往常一样继续使用 vagrant up,这样我就可以通过 vagrant ssh 进入它。