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

Config parser error: no LinkKey section #7

Open
OopsYao opened this issue Sep 30, 2022 · 17 comments
Open

Config parser error: no LinkKey section #7

OopsYao opened this issue Sep 30, 2022 · 17 comments
Labels

Comments

@OopsYao
Copy link

OopsYao commented Sep 30, 2022

Listing devices gives me the following error

Traceback (most recent call last):
  File "/usr/bin/bt-dualboot", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/bt_dualboot/cli/app.py", line 342, in main
    app.run()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/cli/app.py", line 252, in run
    self.list_devices()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/cli/app.py", line 173, in list_devices
    devices=sync_manager.devices_both_synced(),
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_sync_manager/bt_sync_manager.py", line 111, in devices_both_synced
    index = self._index_devices()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_sync_manager/bt_sync_manager.py", line 61, in _index_devices
    linux_devices   = get_linux_devices()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/devices.py", line 40, in get_devices
    return [bluetooth_device_factory(device_path) for device_path in get_devices_paths()]
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/devices.py", line 40, in <listcomp>
    return [bluetooth_device_factory(device_path) for device_path in get_devices_paths()]
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/bluetooth_device_factory.py", line 55, in bluetooth_device_factory
    info = extract_info(device_info_path)
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/bluetooth_device_factory.py", line 39, in extract_info
    "pairing_key":  config.get("LinkKey", "Key"),
  File "/usr/lib/python3.10/configparser.py", line 782, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.10/configparser.py", line 1153, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'LinkKey'

The command I used

sudo bt-dualboot -l

And reinstalling seems not working.

bt-dualboot: 1.0.1
Python: 3.10.7
OS: Arch Linux with kernel 5.19.11-arch1-1

@BlackOutedMind
Copy link

Can confirm, same error here, same python version and bt-dualboot, but on Arch Linux 5.15.72-1 LTS

@eathtespagheti
Copy link

Same error here, Python 3.10.7, kernel 5.19.13

@paultaiton
Copy link

Same issue, Windows 11 w/o ntfs encryption, C drive mounts fine, on Gentoo python 3.10.8 and kernel 6.0.2

@pramodhrachuri
Copy link

Same error.

@eCompassion
Copy link

Same issue on Arch 6.0.2-arch1-g14-1 and Python 3.10.8. Decrypted Bitlocker and have R/W access.

@eCompassion
Copy link

#5 sort of resolved the issue. Looks like the Logitech MX Ergo

[evie@wendy-endeavour bt-dualboot]$ sudo ./bt-dualboot -l

Needs sync

No device found ready to sync.
Try pair devices first.

Missing pairing key

Following devices do not have a pairing key and so cannot be synced

[ED:E3:CD:17:19:BA] MX Ergo

@matan129
Copy link

matan129 commented Nov 5, 2022

This happened to me as well.
Devices without LinkKey sometimes appear because their pairing failed for whatever reason / was cancelled in the middle.

The easiest way around it is just

sudo bluetoothctl remove 00:00:5e:00:53:af  # MAC of offending device.

Afterwards, just re-pair properly and run bt-dualboot again.

@jorgicio
Copy link

jorgicio commented Nov 5, 2022

Maybe there's a missing support for Bluetooth 5.1, which uses other keys: LTK, ERand and EDiv.

@s-ol s-ol mentioned this issue Nov 7, 2022
@isak102
Copy link

isak102 commented Nov 24, 2022

This happened to me as well. Devices without LinkKey sometimes appear because their pairing failed for whatever reason / was cancelled in the middle.

The easiest way around it is just

sudo bluetoothctl remove 00:00:5e:00:53:af  # MAC of offending device.

Afterwards, just re-pair properly and run bt-dualboot again.

This pull request had the same issue as the master branch for me but using your solution fixed it, thanks

@ghost
Copy link

ghost commented Jan 14, 2023

That pull request is to disable devices without a LinkKey but the thing is that BT5.1 devices correctly don't have a LinkKey. They use the keys mentioned above by @jorgicio

The copying of such values should be supported as well

@Konfekt
Copy link

Konfekt commented May 16, 2023

Somehow both the Microsoft Designer Bluetooth keyboard and mouse are working fine under Linux (right now), but neither one of them has an entry LinkKey in their info file in contrast to all the other bluetooth devices

@Konfekt
Copy link

Konfekt commented May 17, 2023

For the time being, https://gist.github.com/Mygod/f390aabf53cf1406fc71166a47236ebf seems to complement bt-dualboot well: run bt-dualboot after removing the LE devices and then export-ble-infos.py to import those.

@TurnOffNOD
Copy link

Listing devices gives me the following error

Traceback (most recent call last):
  File "/usr/bin/bt-dualboot", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/bt_dualboot/cli/app.py", line 342, in main
    app.run()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/cli/app.py", line 252, in run
    self.list_devices()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/cli/app.py", line 173, in list_devices
    devices=sync_manager.devices_both_synced(),
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_sync_manager/bt_sync_manager.py", line 111, in devices_both_synced
    index = self._index_devices()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_sync_manager/bt_sync_manager.py", line 61, in _index_devices
    linux_devices   = get_linux_devices()
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/devices.py", line 40, in get_devices
    return [bluetooth_device_factory(device_path) for device_path in get_devices_paths()]
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/devices.py", line 40, in <listcomp>
    return [bluetooth_device_factory(device_path) for device_path in get_devices_paths()]
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/bluetooth_device_factory.py", line 55, in bluetooth_device_factory
    info = extract_info(device_info_path)
  File "/usr/lib/python3.10/site-packages/bt_dualboot/bt_linux/bluetooth_device_factory.py", line 39, in extract_info
    "pairing_key":  config.get("LinkKey", "Key"),
  File "/usr/lib/python3.10/configparser.py", line 782, in get
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.10/configparser.py", line 1153, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'LinkKey'

The command I used

sudo bt-dualboot -l

And reinstalling seems not working.

bt-dualboot: 1.0.1 Python: 3.10.7 OS: Arch Linux with kernel 5.19.11-arch1-1

Bump into the same problem, my device is a bluetooth keyboard.

@Konfekt
Copy link

Konfekt commented Jul 18, 2023

Try #14 by installing bt-dualboot via sudo pip install git+https://github.com/Simon128/bt-dualboot. If that does not help, as mentioned above, try export-ble-infos.py

@mc0e
Copy link

mc0e commented Aug 2, 2023

I'm seeing the same problem. In my case the device file is my PineTime smart watch. I haven't done much with it from Linux, but it may be that pairing is not expected. Certainly that's the case when accessing he watch from my phone, and pairing in the phone settings actually creates problems for the app that talks to the watch.

I did use Linux to update the phone's operating system over bluetooth, so the device info file would be what's left there from that.

I tried sudo pip install git+https://github.com/Simon128/bt-dualboot, but that still fails:

root@x1x:/home/mc0e# bt-dualboot -l
Traceback (most recent call last):
  File "/usr/local/bin/bt-dualboot", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/cli/app.py", line 342, in main
    app.run()
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/cli/app.py", line 252, in run
    self.list_devices()
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/cli/app.py", line 173, in list_devices
    devices=sync_manager.devices_both_synced(),
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/bt_sync_manager/bt_sync_manager.py", line 111, in devices_both_synced
    index = self._index_devices()
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/bt_sync_manager/bt_sync_manager.py", line 61, in _index_devices
    linux_devices   = get_linux_devices()
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/bt_linux/devices.py", line 40, in get_devices
    return [bluetooth_device_factory(device_path) for device_path in get_devices_paths()]
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/bt_linux/devices.py", line 40, in <listcomp>
    return [bluetooth_device_factory(device_path) for device_path in get_devices_paths()]
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/bt_linux/bluetooth_device_factory.py", line 65, in bluetooth_device_factory
    info = extract_info(device_info_path)
  File "/usr/local/lib/python3.9/dist-packages/bt_dualboot/bt_linux/bluetooth_device_factory.py", line 41, in extract_info
    raise KeyError("Neither LinkKey->Key nor LongTermKey->Key exist")
KeyError: 'Neither LinkKey->Key nor LongTermKey->Key exist'

I suggest that correct behaviour if a device cannot be synced would be to report the issue in a user friendly way and proceed to sync the other devices.

@mc0e
Copy link

mc0e commented Aug 2, 2023

I was thinking that I could sync the devices one by one, using bt-dualboot --b PATH --sync MAC, but it seems that also fails with the same error: raise KeyError("Neither LinkKey->Key nor LongTermKey->Key exist"). I imagine this could be avoided by only running bluetooth_device_factory() for devices matching the requested MAC address.

@Konfekt
Copy link

Konfekt commented Aug 2, 2023

It is likely related to #14 (comment) . That's also a place to comment on possible improvements on https://github.com/Simon128/bt-dualboot

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

No branches or pull requests