-
Notifications
You must be signed in to change notification settings - Fork 490
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
Cannot use bluepy without sudo #313
Comments
The linux protocol stack needs additional capabilities. If you do not want to run your script as sudo setcap 'cap_net_raw,cap_net_admin+eip' bluepy-helper For more details check this stackexchange thread: https://unix.stackexchange.com/a/182559 |
On my Pi (currently Debian Stretch) the above command just gives a very unhelpful
The following two commands do, however, fix it:
Where
|
Hi nescio007, many thanks for the advice. Works perfect on Ubuntu 17.10. I found regards spachner |
Why don't include the setcap call to the install tool? |
I have the exact same issue on my Raspberry Pi Zero W with Raspbian Stretch lite (4.14). I tried all possible combinations of setcap (also looking into #190), without any success.
The strange thing is: after setting the capabilities, I was able to execute 'le on' manually without using sudo:
Any ideas what might be going wrong here? Thanks a lot! |
Adding a note here since all other solutions suggestions failed in my case. As per noble/noble#682 (comment) The Feel free to follow up with a less-hacky solution if you happen upon one. |
Did you find out how to fix this? I'm having exactly the same problem. |
@alindl @mivola From the logs it seems that you have two bluepy installations:
It appears that you added the capabilities to the helper-binary of the system-wide installations, but then tried to use the local one, which has its own helper-binary that was not given additional capabilities. TL;DR: when using |
I should ask more questions, because I JUST figured it out myself as your message was plopping up here. That's the second time that happened this week 😅 So yeah, that was the problem and it's working now. |
I also had 2 installations, because it seemed that the command-line would use Python-2, whereas Thonny used Python-3:
so the
commands had to be repeated for each installation |
I meet the same problem ,and after using command above ,i do not need to use sudo run the program and then get the (code:17 ,error : Invalid Index) |
actually ,after tried many times and search for a lot of infomation then I change to use pybluez, and it works, and the process of using pybluez can be exhausted, good luck for the coming questioners. |
I had said that I change to pybluez after the incredible bug in using bluepy,
and maybe you will meet problem when installing bluetooth ,then firstly install gattlib
and if you meet more problem in installing gattlib,then follow with these commands:
then I guess you can successfully install the gattlib and pybluez, and from my perspective, I think gattlib is enough if you just want to have some basic development needs in bluetooth such as scan or pass data. and here are the github links about gattlib and pybluez: |
Hi,
I am starting with bluepy and found that I cannot call the scanner without sudo.
Calling with sudo works fine:
How avoid using sudo?
Thanks in advance
spachner
The text was updated successfully, but these errors were encountered: