-
Notifications
You must be signed in to change notification settings - Fork 11
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
icmplib==2.1.1 doesn't work in plugin jail #39
Comments
Sorry, I'm not really sure what I can do. The only immediate work around I can suggest is running Home Assistant as From inside the jail, run
According to https://pypi.org/project/icmplib/ -- Use the library without root privileges...
So I added from functools import lru_cache
from icmplib import SocketPermissionError, ping as icmp_ping
# In python 3.9 and later, this can be converted to just be `cache`
@lru_cache(maxsize=None)
def can_create_raw_socket():
"""Verify we can create a raw socket."""
try:
icmp_ping('127.0.0.1', count=3, timeout=1, privileged=False)
return True
except SocketPermissionError:
return False
print (can_create_raw_socket()) However, that results in the following error
|
Thanks for looking into it so quickly! I think that's good to know about the user work-around. Another work-around I've implemented so far is to not use the built in For anyone else who wants to do that I'll put the link here: https://github.com/davidlang42/ha-old-ping |
As of HomeAssistant 2021.4.1, the inbuilt
ping
integration usesicmplib==2.1.1
: https://github.com/home-assistant/core/pull/43868/filesPing in this version of icmplib fails in the HA iocage jail when run as the
homeassistant
user, but works when run as root. I don't understand the exact problem, but this seems to suggest that there is some type of network permission issue in the jails config.This can be verified using the jail shell, updating to HA 2021.4.*, then entering the python venv:
source /usr/local/share/homeassistant/bin/activate
then running python interactively:
python
and pasting the following code:
(test code sourced from a similar issue: home-assistant/core#43188)
If you enter the venv as root, this code prints
True
.If you
su homeassistant
before entering the venv, then it returnsFalse
.If you manually roll back the python icmplib to v1.2.2, then it will return
True
regardless of user.The text was updated successfully, but these errors were encountered: