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

Can't init hci #25

Open
des-gan09 opened this issue Feb 22, 2022 · 6 comments
Open

Can't init hci #25

des-gan09 opened this issue Feb 22, 2022 · 6 comments

Comments

@des-gan09
Copy link

I was trying to run the mcumgr cli via the ble and encounter this error. I managed to circumvent this using sudo. Is there any other method without using sudo.

@sjanc
Copy link

sjanc commented Feb 22, 2022

this tool uses so called "user channel" to access HCI interface and that requires CAP_NET_ADMIN privilege

@des-gan09
Copy link
Author

So how do i give myself CAP_NET_ADMIN privilege at the user level

@muratdolaz
Copy link

When i tried the example 'mcumgr --conntype ble --connstring peer_name=Zephyr echo hello' i encountered an error that 'Error: [hci0]: can't init hci: can't down device: operation not permitted'. Using the command with sudo gave 'sudo: mcumgr: command not found' error. So how can i make it work?

@sjanc
Copy link

sjanc commented Oct 25, 2022

depends on where you put your mcumgr binary, you may try with sudo -E which preserves your local user environment variables (ie PATH), or you may provide full path to mcumgr binary

@sk3p71c
Copy link

sk3p71c commented Aug 2, 2024

I have just come across the same error two years later: "Error: [hci0]: can't init hci: can't down device: operation not permitted".

Giving the utility the CAP_NET_ADMIN capability worked for me; once you do so, the user does not need to be in sudoers when running the utility. To do so, I did the following under debian Bookworm. You'll need to run these commands as root, replacing the path with your installation location.

apt-get install libcap2-bin
setcap 'cap_net_admin=ep' /home/dev/go/bin/mcumgr

Could this capability be granted by the installer, or a warning given if a non-root user installs it? The error message alone does not make obvious what the solution should be, and I spent a lot of time trying to add my user to various groups for instance, under the assumption it was a permissions issue.

Thanks.

@sjanc
Copy link

sjanc commented Aug 5, 2024

Hi,

Yeah, I guess we could make error message more descriptive and also update web documentation...

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

4 participants