bluetooth icon indicating copy to clipboard operation
bluetooth copied to clipboard

Recent version doesn't work on Debian buster

Open aykevl opened this issue 3 years ago • 15 comments

I haven't investigated this issue yet, but I have bisected it.

Recent versions of the bluetooth package fail on the Raspberry Pi (Debian 10.4, BlueZ 5.50):

$ go run ./examples/heartrate/
starting
panic: failed to add service: Failed to create entry in database

goroutine 1 [running]:
main.must(...)
        /home/ayke/src/tinygo.org/x/bluetooth/examples/heartrate/main.go:64
main.main()
        /home/ayke/src/tinygo.org/x/bluetooth/examples/heartrate/main.go:26 +0x51c
exit status 2

The commit introducing this is 2fb3b08920ae957edaa9deecbb7b16514a055068, introduced in #36.

aykevl avatar Nov 29 '20 19:11 aykevl

Also confirmed this on my laptop, running Debian buster with BlueZ 5.50 (same as the Raspberry Pi).

aykevl avatar Nov 29 '20 20:11 aykevl

I see the same thing. Ubuntu 20.04, bluez 5.53.

mogenson avatar Dec 09 '20 20:12 mogenson

Please give a try with this branch https://github.com/tinygo-org/bluetooth/tree/update-bluez-555 which updates the go-bluetooth package to the latest version with updated Bluez wrappers.

deadprogram avatar Dec 10 '20 06:12 deadprogram

Unfortunately, I get the exact same output as before. I also tried on Arch Linux with bluez 5.55.

mogenson avatar Dec 10 '20 16:12 mogenson

Same for me, it still doesn't work on the update-bluez-555 branch. I suspect it's because the bluetooth package assumes a newer BlueZ version. Maybe BlueZ has made a backwards incompatible change?

aykevl avatar Dec 11 '20 23:12 aykevl

I think it is something to do with changes to the wrapper generation in https://github.com/muka/go-bluetooth/commits/master/gen since the last working version, which at least on my machine is also https://github.com/muka/go-bluetooth/commit/f6113f7141c5f535bea0ce20d918383d4577efe8

Note that I am testing by running "old" version of BlueZ:

$ bluetoothctl --version
bluetoothctl: 5.48

If reverting to older SHA of go-bluetooth "fixes" for most of us, we should do that while we look into what might be the root cause. What does everyone think?

deadprogram avatar Dec 12 '20 09:12 deadprogram

I think that sounds good. Keeping on top of bluez releases is going to be a constantly moving target, so this probably won't be the last time something breaks :)

Happy to try out a new branch or PR when it's available.

mogenson avatar Dec 14 '20 17:12 mogenson

@mogenson and @aykevl please give a try to #49 it appears to correct this issue on my machine with BlueZ 5.50 installed. Thanks!

deadprogram avatar Jan 16 '21 23:01 deadprogram

A quick test shows that it doesn't crash anymore. I haven't checked whether it actually works but assuming you've tested it, LGTM.

aykevl avatar Jan 18 '21 16:01 aykevl

Unfortunately the examples are still failing for me, but now with a different error:

$ go run ./examples/heartrate
go: downloading github.com/muka/go-bluetooth v0.0.0-20200619025933-f6113f7141c5
starting
panic: failed to enable BLE stack: MapToStruct: Field not found: Roles

goroutine 1 [running]:
main.must(...)
	/home/mike/Projects/bluetooth/examples/heartrate/main.go:54
main.main()
	/home/mike/Projects/bluetooth/examples/heartrate/main.go:17 +0x7c5
exit status 2

$ go run ./examples/scanner
panic: failed to enable BLE stack: MapToStruct: Field not found: Roles

goroutine 1 [running]:
main.must(...)
	/home/mike/Projects/bluetooth/examples/scanner/main.go:23
main.main()
	/home/mike/Projects/bluetooth/examples/scanner/main.go:11 +0x1df
exit status 2
$ pacman -Qi bluez
Name            : bluez
Version         : 5.55-1

mogenson avatar Jan 20 '21 15:01 mogenson

@mogenson I thought you were using Ubuntu?

deadprogram avatar Jan 22 '21 07:01 deadprogram

Also, you perhaps want to try 5.50:

$ bluetoothctl --version
bluetoothctl: 5.50

This is the version that the recent commit downgraded to, which is, as @aykevl points out the current version on Raspian.

deadprogram avatar Jan 22 '21 09:01 deadprogram

Sorry for the delay. I have a Ubuntu 20.04 laptop. Just haven't used it recently.

$ bluetoothctl --version
bluetoothctl: 5.53

From the dev branch:

$ go run ./examples/scanner
# works great!

$ go run ./examples/heartrate
starting
panic: failed to start adv: MapToStruct: Field not found: SupportedSecondaryChannels

mogenson avatar Feb 08 '21 22:02 mogenson

@mogenson can you run this while running the program that fails?

sudo dbus-monitor --system "type=error"

Thanks.

deadprogram avatar Feb 14 '21 12:02 deadprogram

this looks like its due to muka generating invalid UUIDs if passed 128 bit uuids for a service.

james-lawrence avatar Aug 10 '21 20:08 james-lawrence

Now closing since 0.9.0 has been released. Thank you!

deadprogram avatar Mar 24 '24 17:03 deadprogram