Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant deploy / adapter issue + webapp packages not compatible - Solution, not yet implemented in code. #165

Open
RFlintstone opened this issue Dec 8, 2024 · 0 comments

Comments

@RFlintstone
Copy link

RFlintstone commented Dec 8, 2024

There seem to be some issues with NXBT but real solutions, at least in my case, were not really available. Now I've solved them I'll share them here so you could fix it to, or better yet the developers patch them so these fixes are not needed anymore, so here it is:

Lets start that I'm working on windows so I cloned the repo, and am following the official guide which is located here.


My first real issue was that my Bluetooth adapter: TP-Link UB500 Adapter didn't seem to be supported as Vagrant gave the follow error in the windows terminal:

A customization command failed:

["usbfilter", "add", "0", "--target", :id, "--name", "TP-Link UB500 Adapter ()", "--product", "TP-Link UB500 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\nfor controlling VirtualBox. The command and stderr is shown below.\n\nCommand: [\"usbfilter\", \"add\", \"0\", \"--target\", \"ab2a2216-6bb2-4753-be69-1067d8d24b04\", \"--name\", \"TP-Link UB500 Adapter ()\", \"--product\", \"TP-Link UB500 Adapter\", \"--manufacturer\", \"\", \"--productid\", \"0604\", \"--vendorid\", \"2357\"]\n\nStderr: Oracle VirtualBox Command Line Management Interface Version 7.1.4\r\nCopyright (C) 2005-2024 Oracle and/or its affiliates\r\n\r\nVBoxManage.exe: error: Invalid parameter '0604'\r\nUsage:\r\n\r\n  VBoxManage usbfilter add <index,0-N> <--target= <uuid | vmname | global>>\r\n      <--name=string> <--action=ignore | hold> [--active=yes | no]\r\n      [--vendorid=XXXX] [--productid=XXXX] [--revision=IIFF]\r\n      [--manufacturer=string] [--product=string] [--port=hex]\r\n      [--remote=yes | no] [--serialnumber=string] [--maskedinterfaces=XXXXXXXX]\r\n">

Please fix this customization and try again.

Somehow Vagrant failed to add the dongle, and after some trial and error the main issue seemed to be that the dongle's name included (). After some digging I edited the Vagrantfile anyway and changed it so the config looked like this:

  # 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 UB500 Adapter",
      "--product", "TP-Link UB500 Adapter",
      "--vendorid", "2357",
      "--productid", "0604",
      "--action", "hold"]

Note that this almost identical than the one you have, but now we hardcoded the attributes. We've also defined an action for good measure.


The second issue was that the WebApp didn't seem to have the correct versions of 3 pip packages installed. Identified by this error, and others like it directly following after:

vagrant@ubuntu2010:~$ sudo nxbt webapp
Traceback (most recent call last):
  File "/usr/local/bin/nxbt", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/nxbt/cli.py", line 321, in main
    from .web import start_web_app
  File "/usr/local/lib/python3.8/dist-packages/nxbt/web/__init__.py", line 1, in <module>
    from .app import start_web_app
  File "/usr/local/lib/python3.8/dist-packages/nxbt/web/app.py", line 9, in <module>
    from flask import Flask, render_template, request
  File "/usr/local/lib/python3.8/dist-packages/flask/__init__.py", line 14, in <module>
    from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/usr/local/lib/python3.8/dist-packages/jinja2/__init__.py)

I stumbled upon an older issue from 2022 where they solved it. It comes down to running the following commands in the Vagrant VM as soon as the tests succeed.

sudo pip install jinja2==3.0.3
sudo pip install itsdangerous==2.0.1
sudo pip install werkzeug==2.0.2

When this is done you should just be able to run sudo nxbt webapp (again, in the Vagrant VM) and be on your way!

Note

To add: I just looked into the pip3 install nxbt / PyPi release history and it seems that the latest version is from Oct. 2021. This would explain why this repo does have code which should be able to fix the second problem mentioned in this issue. I hope an updated version will be pushed to PyPi or that the installation readme's will be updated to reflect the fact that the latest versions there are outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant