Failed to write claiming configuration : command not found

Hello!

I’m trying to install netdata agent on fresh new debian 12 VPS using the kickstart.sh snippet.

If I try to run the wget [.....] snippet using a normal user (not root), the installation completes with a warning:

[/tmp/netdata-kickstart-CKpNZWeafd]$ sudo reload-claiming-state
sudo: : command not found
FAILED
WARNING Failed to write claiming configuration. This usually means you do not have permissions to access the configuration directory.

If I try to run the wget [...] snipped using root, I do not get any warning and I noticed that the command above is different:

[/tmp/netdata-kickstart-vvNCshGN0C]# /usr/sbin/netdatacli reload-claiming-state

As you can see, the /usr/sbin/netdatacli part is present only when the script is run with root

So, I open the script file and I’ve noticed these lines

  # more lines
  netdatacli="$(command -v netdatacli)"
  # more lines

  if [ -z "${NETDATA_CLAIM_NORELOAD}" ]; then
    run_as_root "${netdatacli}" reload-claiming-state || return 1
  fi

So the problem must be with command -v netdatacli

In fact, when I run command -v netdatacli with my normal user I get nothing, when I run it as root I get /usr/sbin/netdatacli

That’s because my normal user does not have /usr/sbin in its PATH, while root user has it.

So, my question is: is this a bug in the netdata installation script? Or, should I always run the installation script as root ? The documentation does not say that you have to run it as root though, and it supports sudo so I suppose this should work even when it is run as a normal user

It’s arguably a matter of a design issue in Debian (the /bin versus /sbin distinction has essentially no meaning these days, Debian and Ubuntu just choose to hold on to the historical differentiation).

But it also is a bug in our code, we should be adding /sbin and /usr/sbin to the search path regardless of UID, and we should also be checking to make sure we actually found netdatacli before trying to invoke it.

1 Like

I’ve opened Fix issues with $PATH and netdatacli detection. by Ferroin · Pull Request #19371 · netdata/netdata · GitHub to fix this. Once that’s merged, it should go live relatively quickly.

1 Like

Thank you very for the fast fix!