-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
nmap fails to obtain mac address in 2023.2.x #87623
Comments
Same for me, looking at the used python package
It seems to work, when setting the platform to
Not sure, which method was used/working in the past, but the method ArpingHost is not using a compatible 'arping' binary, as the one from busybox is not supporting those options, just:
and as expected listed in the system arp-table:
|
So an (bit ugly) option for a quick-fix might be to force the detection method in this integration before calling the get_mac_address method:
|
Just tested here too @Zasari On the old working container, running:
And on the newer containers:
Will see if your temp fix works for me too |
Same here, after update to last version, nmap stops working |
Following the tips from @Zasari, I have something working.
The |
Thanks @scottsweb I have added your workaround/fix into a pull request for the kef integration which is also affected. It does work, however it generates warnings in the HA logs like below, and not just for one integration, for all integrations using getmac. I'm thinking now should this fix go at HA level, possibly silencing this warning. It seems fixing this at a single integration, affects other integrations also.
|
@mark007 - it looks like a log level can be set for There are also newer versions of |
Indeed I guess the nicest solution would be having support from |
I have tried 0.9.2 in the manifest.json of my copy of the kef integration within my custom_components directory, rebooted HA and it didn't help. I'm not sure if that's the correct way to update the version. Maybe we should involve the getmac Devs? As it feels wrong to have to force override the method doesn't it. |
Perhaps the easiest fix would simply to install a full arping in the HA container - that should at least be a quick-fix for those having the issues right now without extra log messages from getmac:
But idk the process on how HA decides which packages are to be added into the base image... |
Didn't seem to fix it for me unfortuantely. The original patch is still good though. |
As requested by the getmac developer I have created an issue here as he thinks he might know the cause and a quick fix. |
@scottsweb : Indeed, it seems to not work reliably with the arping version - it seems to fail when devices (like Android smartphones) go into some deeper sleep stages - as this phone was resting on battery the whole night at home: |
I've checked for other python packages that could be used - and it seems a pretty stable tool is 'scapy' that would provide the same function:
Ex.:
Of course a much bigger pip package, but seems to be pretty stable. Update: I did a quick test, but it seems always the router's mac address is returned 🤷 So not an option, if I didn't miss something obvious... |
I made these changes and they work, I created a custom component to temporarily override the native nmap_tracker component. I leave here attached the custom_component with the change in case someone needs it |
Thanks @scottsweb
|
I have created this pull request, currently linked to the kef integration issue but should also fix this issue if it was merged. Instead of overriding the getmac method, the proposed approach is to fix the conflict between some integrations still using the old 'get-mac' library and other integrations using the newer 'getmac' library, both of which conflict with eachother (essentially getmac is overridden by its older get-mac counterpart, as internally it uses the same python package name, and I guess as alphabetically it comes first, python chooses it instead of the newer getmac). Any help with this patch is welcome as I'm unsure how to test it any further than simply making the changes to the requirements files, the constraints file (to prevent future integrations bringing back the old get-mac again) and updating the only integration in the core that I see bringing in get-mac (vilfo-api-client) to a newer version, which did actually swap out get-mac for the new getmac. |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as off-topic.
This comment was marked as off-topic.
Can someone confirm that the issue no longer exists? If so the issue can be closed, since the mentioned PR is merged already. |
@freeDom- as of |
It was merged last week, so it is currently only available on the dev environment and should be included in the next update |
This issue should be resolved with getmac 0.9.4. I'm not familiar with developing for Home Assistant and am unable to test if it fixes it for sure. If someone would be willing to test this version I'd appreciate it. side chatter: I'd recommend against using scapy. It's an excellent library for cybersecurity work or constructing custom packets. however, it's quite heavy and takes several seconds just to import it, and some of the util functions are slow (for example on windows it shells out to powershell). |
Confirming this is working again in |
The problem
The
nmap
integration is failing to detect devices in Home Assistant2023.2.x
. I have tested all versions beyond2023.1.7
and the issue is present.I am running Home Assistant in a container with rootless podman. My compose file looks like this:
And my
nmap
configuration is as follows:With a scan interval of
20
and450
second wait until a device is home.What version of Home Assistant Core has the issue?
2023.2.2
What was the last working version of Home Assistant Core?
2023.1.7
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Nmap Tracker
Link to integration documentation on our website
https://www.home-assistant.io/integrations/nmap_tracker/
Diagnostics information
The only nmap failure in the logs is:
Example YAML snippet
No response
Anything in the logs that might be useful for us?
New versions complain that the MAC address cannot be found.
On older versions, getting inside the container and running:
Gives me:
On the newer version the result is:
I don't see any immediate difference here and given its the same version of nmap, it seems strange that something breaks.
Additional information
The only thing I can think of at this stage is that home assistant cannot be run rootless any longer, but I cannot see anything in recent change logs that may have impacted this.
The text was updated successfully, but these errors were encountered: