signalfx-agent icon indicating copy to clipboard operation
signalfx-agent copied to clipboard

package doesn't include libnss_resolve

Open tchernomax opened this issue 3 years ago • 2 comments

root@ host ~ # dpkg -l signalfx-agent
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  signalfx-agent 5.12.0-1     amd64        The SignalFx metric agent

root@ host ~ # dpkg -L signalfx-agent | grep libnss
/usr/lib/signalfx-agent/lib/libnss_compat-2.27.so
/usr/lib/signalfx-agent/lib/libnss_dns-2.27.so
/usr/lib/signalfx-agent/lib/libnss_files-2.27.so
/usr/lib/signalfx-agent/lib/libnss_hesiod-2.27.so
/usr/lib/signalfx-agent/lib/libnss_nis-2.27.so
/usr/lib/signalfx-agent/lib/libnss_nisplus-2.27.so
/usr/lib/signalfx-agent/lib/libnss_compat.so.2
/usr/lib/signalfx-agent/lib/libnss_dns.so.2
/usr/lib/signalfx-agent/lib/libnss_files.so.2
/usr/lib/signalfx-agent/lib/libnss_hesiod.so.2
/usr/lib/signalfx-agent/lib/libnss_nis.so.2
/usr/lib/signalfx-agent/lib/libnss_nisplus.so.2

So it can fail if lbnss_resolve is use instead of libnss_dns :

root@ host ~ # grep hosts  /etc/nsswitch.conf
hosts: files resolve [!UNAVAIL=return] myhostname

for example:

root@ host ~ # /usr/lib/signalfx-agent/bin/python
Python 3.8.0 (default, Aug 10 2021, 13:56:58)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostbyname("google.com")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno -2] Name or service not known

tchernomax avatar Sep 01 '21 19:09 tchernomax

The agent is compiled against Ubuntu 16.04 and includes the libnss plugins available there. libnss_resolve is needed for systemd-resolved but if you allow DNS queries to fallback to DNS instead of forcing them to fail with the [!UNAVAIL=return] option then it should work. Given that the libnss_resolve.so doesn't exist in the ubuntu 16.04 container image it won't be easy to add it in a compatible way, so I would recommend allowing regular DNS resolution.

CC @rmfitzpatrick for Otel Collector implications.

keitwb avatar Sep 02 '21 15:09 keitwb

@keitwb no problem, I fixed the problem by using :

root@ host ~ # grep hosts  /etc/nsswitch.conf
hosts: files resolve [!UNAVAIL=return] myhostname dns

I created the issue mainly so that others can found about it if they experience failed name resolution.

Feel free to close this issue.

tchernomax avatar Sep 02 '21 15:09 tchernomax