Skip to content

python3.7 throws exceptions about missing getifaddrs #175

Description

@sjorge
Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.7/site-packages/homeassistant/components/discovery.py", line 179, in scan_devices
    results = await hass.async_add_job(_discover, netdisco)
  File "/opt/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/homeassistant/lib/python3.7/site-packages/homeassistant/components/discovery.py", line 207, in _discover
    netdisco.scan()
  File "/opt/homeassistant/lib/python3.7/site-packages/netdisco/discovery.py", line 57, in scan
    self.mdns.start()
  File "/opt/homeassistant/lib/python3.7/site-packages/netdisco/mdns.py", line 23, in start
    self.zeroconf = zeroconf.Zeroconf()
  File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf.py", line 1724, in __init__
    interfaces = normalize_interface_choice(interfaces)
  File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf.py", line 1655, in normalize_interface_choice
    return get_all_addresses()
  File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf.py", line 1645, in get_all_addresses
    for iface in ifaddr.get_adapters()
  File "/opt/homeassistant/lib/python3.7/site-packages/ifaddr/_posix.py", line 44, in get_adapters
    retval = libc.getifaddrs(ctypes.byref(addr))
  File "/opt/local/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
    func = self.__getitem__(name)
  File "/opt/local/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: ld.so.1: python3.7: fatal: getifaddrs: can't find symbol```


We (illumos) do have that! http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libsocket/inet/getifaddrs.c

I think we just might have to add libsocket to the linker libraries?

Activity

  1. added a commit that references this issue on Jul 15, 2019
  2. added a commit that references this issue on Aug 26, 2019
  3. added a commit that references this issue on Feb 6, 2020
  4. liv3010m commented on Mar 6, 2020

    @liv3010m

    Hi there,

    I'm having the same problem:

    2020-03-06 11:25:09 ERROR (MainThread) [homeassistant.setup] Error during setup of component zeroconf
    Traceback (most recent call last):
    File "/opt/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config # type: ignore
    File "/opt/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
    File "/opt/homeassistant/lib/python3.7/site-packages/homeassistant/components/zeroconf/__init__.py", line 42, in setup
    zeroconf = Zeroconf()
    File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf/__init__.py", line 2134, in __init__
    interfaces, unicast, ip_version, apple_p2p=apple_p2p
    File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf/__init__.py", line 2056, in create_sockets
    interfaces = normalize_interface_choice(interfaces, ip_version)
    File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf/__init__.py", line 1922, in normalize_interface_choice
    result.extend(get_all_addresses())
    File "/opt/homeassistant/lib/python3.7/site-packages/zeroconf/__init__.py", line 1844, in get_all_addresses
    for iface in ifaddr.get_adapters()
    File "/opt/homeassistant/lib/python3.7/site-packages/ifaddr/_posix.py", line 44, in get_adapters
    retval = libc.getifaddrs(ctypes.byref(addr))
    File "/opt/local/lib/python3.7/ctypes/__init__.py", line 377, in __getattr__
    func = self.__getitem__(name)
    File "/opt/local/lib/python3.7/ctypes/__init__.py", line 382, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
    AttributeError: ld.so.1: python3.7: fatal: getifaddrs: can't find symbol

  5. sjorge commented on Mar 6, 2020

    @sjorge
    Author

    IIRC you can patch /opt/homeassistant/lib/python3.7/site-packages/ifaddr/_posix.py to use libsocket instead of libc and it works.

  6. sjorge commented on Mar 6, 2020

    @sjorge
    Author
  7. liv3010m commented on Mar 6, 2020

    @liv3010m

    Thanks @sjorge!

  8. added a commit that references this issue on May 20, 2020
  9. 103 remaining items

  10. added a commit that references this issue on May 14, 2026
  11. added 2 commits that reference this issue on Jul 26, 2026
  12. added a commit that references this issue on Aug 7, 2026
  13. added a commit that references this issue on Aug 25, 2026
  14. added a commit that references this issue on Sep 6, 2026
  15. added a commit that references this issue on Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions