Lessons learned WRT bt-tethering to Android

Lessons learned WRT bt-tethering to Android

  • Enable bt-tethering on your phone
    mine runs on lineageOs 16.x and has an entry for this in the network/hotspot section.
    Enable it there. You do not need to enable the hotspot (for wifi) main entry.

  • bluetoothctl steps:
    power on, scan on, pair phoneMac, trust phoneMac, paired-devices, info phoneMac

  • there is fog of confusion about the format of /etc/pwnagotchi/config.yml
    if you are on v1.1.1 the correct version is like

    bt-tether:
        enabled: true
        mac: 'C0:EE:FB:73:A2:EA'
        ip: '192.168.44.44'
        netmask: 24
        interval: 1
        share_internet: true

The website documents a more diversificated format with devices: entries.
This is the future and fits to the plugin version on the server but it does not fit to the v1.1.1 version.
v1.1.2 will change that

  • Case matters
    while in many scenarios MAC addresses are valid regardless of case (i.e. B8:27:EB:89:2F:B7 is equivalent to b8:27:eb:89:2f:b7) this is not so with gotchi setup. Stick to UPPERCASE

  • 192.168.44.44 is magic
    do not doubt, believe in it. Credo quia absurdum

  • a decent network info app on the android helps.
    mine is called network info II and it shows an interface bt-pan on my mobile with 192.168.44.1
    It was most helpful when I had my gotchi to face BT AE (adress error) state and had doubts regarding the right IP. When the gotchi is off bt-pan disappears.

  • typos hurt
    this is trivial but still very true. After a bazillion of failed attempts we may turn blind to the most obvious misconfigurations.
    Let s.o. else have a look at your settings. For this, do a precise docu of yr settings in preparation to a post in this or another forum.
    Explain the reason of every setting - you may actually find the problem (or one of them) while doing this.

  • restarting with the touch-call is not enough.
    You need a real reboot to see if your bt-tethering config works.
    And, what’s worse, you need to wait a while to see it. Patience pays…

9 Likes

that’s great, pinning just in case :smiley:

Despite the different config in the docs, the old one should still work^^

it does, i updated the plugin without updating the config.yml to the new format and i can still use the bt-tether

1 Like

Worked for me. You were right about waiting, I had tried manually connecting thru bluetoothctl and it didn’t work but this did. Thank you

any suggestions if the tethering works - i can view the UI from my phone by going to the IP (192.168.44.41) but cant seem to ping 8.8.8.8?

I had that once, rebooting the phone did the trick for me.

after the upgrade to v1.2.1 tethering failed for me.

sudo tail /var/log/daemon.log -n100|grep blue
Nov  6 11:36:16 milanogotchi bluetoothd[479]: a2dp-source profile connect failed for C0:EE:FB:43:A8:ED: Protocol not available
Nov  6 11:36:21 milanogotchi bluetoothd[479]: connect error: Host is down (112)

a2dp is for stereo audio, why would my gotchi even need this? and where is the config for it? I searched the net and the logs in vain until dadav had the info that this message would appear when the phone doesn’t actually tether. I rebooted the phone and everything worked again.

Thanks for the writeup!
I’m using a Pixel2 but can’t get bt-tether to connect
In /var/log/pwnagotchi.log I see:
error while running bt-tether.on_loaded : ‘NoneType’ object has no attribute ‘items’
Bluetooth tethering is on and works with other devices
Can SSH in, but can’t seem to get the BT PAN to come up.
Any further troubleshooting I can do?
Thanks!!

Are you sure your bt tether is formatted correctly?

I believe so. Here’s my config.yml:
main:
name: ‘DADpwnagotchi’
whitelist:
plugins:
bt-tether:
enabled: true
devices:
DadsPixel2:
enabled: true
search_order: 1
mac: ‘40:4E:36:46:BA:3D’
ip: ‘192.168.44.44’
netmask: 24
interval: 1
scantime: 15
share_internet: true
priority: 99
max_tries: 0
grid:
enabled: false
report: false
exclude:
ui:
fps: 0.0
display:
enabled: true
type: ‘waveshare_2’
color: ‘black’
video:
enabled: true
address: 0.0.0.0
port: 8080

SON OF A BISCUIT! I was missing an indent. Its working now, thanks for pointing me in the right direction!!!

Sorry, not sure how to paste with formatting, but my file has the correct indents

I also see this error in the log:
[2019-07-10 15:30:42,645] [ERROR] error while running bt-tether.on_loaded : argument of type ‘NoneType’ is not iterable
[2019-07-10 15:30:42,653] [ERROR] argument of type ‘NoneType’ is not iterable
Traceback (most recent call last):
File “/usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/init.py”, line 34, in one
callback(*args, **kwargs)
File “/usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/default/bt-tether.py”, line 432, in on_loaded
if ‘enabled’ in options and options[‘enabled’]:
TypeError: argument of type ‘NoneType’ is not iterable

Here is the code that it is referencing:
if ‘enabled’ in options and options[‘enabled’]:
for device_opt in [‘enabled’, ‘priority’, ‘scantime’, ‘search_order’,
‘max_tries’, ‘share_internet’, ‘mac’, ‘ip’,
‘netmask’, ‘interval’]:

it is tripple back-tick >```< the gt/lt serve as quotes here, ignore
those triple backticks go on a extra line for their own before your code and below
easy and rewarding once you’ve figured it out

As a side note, there is an online .yml syntax checker which works much better than letting other people eye through your config:
https://yaml-online-parser.appspot.com/

I also have to always make sure that Internet Sharing over Bluetooth is enabled from my phone or else it gives the BE Error before D/Cing and giving the NF Error