Netdata Community

Netdata-updater script does not run

Environment

This is for Ubuntu 20.04.2 LTS on x86_64 and also aarch64.

Problem/Question

From reading the docs I understand that by default the agent is set to auto-update.
I also believe that this is done by executing the script located at:
/etc/cron.daily/netdata-updater.sh
which I believe is a link to:
/usr/libexec/netdata/netdata-updater.sh

And then I’m assuming that there must be a cronjob to do the actual execution.
However, I can’t seem to find the cronjob and my agents are not getting updated.

When I check the crontab for the netdata user ( “sudo crontab -u netdata -e”), I find nothing configured and the same for the root user; for completeness there is nothing for netdata in my user’s crontab.

So where should the job exist? Do I need to open a bug for this?

What I expected to happen

I would expect a cronjob in the crontab for the netdata user (or perhaps root).

For a standard setup on most systems, including Ubuntu, the contents of /etc/cron.daily (and the hourly, weekly, and monthly equivalents) get run by entries in the system-wide crontab (/etc/crontab), or occasionally by specially configured systemd timer units.

We preferentially take advantage of this wherever possible because:

  • It’s more consistent with how most other software configures things that similarly need to run at a set frequency without caring exactly when they run.
  • It lets the system administrator configure what time such things run at without having to change things in multiple places.
  • It’s a lot easier and cleaner for us to install, update, and remove than if we were manipulating a user’s crontab.

As a side note, we actually do support handling auto-updates via a crontab installed in /etc/cron.d or via a systemd timer unit, but these are only used as fallbacks if we cannot use the /etc/cron.daily method (or the equivalent path /etc/periodic/daily). Even then though, the updater gets handled in a system-wide manner instead of as a per-user thing for the Netdata user, as it must run with root-equivalent privileges to actually update things properly (otherwise it can’t replace any of the files that are being updated).

If you really want to use one of those alternative methods (note that the systemd timer does not send failure emails like the cronjobs do), you can explicitly ask for one on install by passing the --auto-update-type option to the installer with either systemd (for the systemd timer unit method) or `crontab) (for the crontab method).

@Austin_Hemmelgarn Thank you very much for that detailed and prompt reply :slight_smile:
I checked under /etc/cron.daily and found the link to the script (which lives at /usr/libexec/netdata/netdata-updater.sh).
When I look at my settings it seems that Ubuntu runs daily tasks at 6:25AM.
I can confirm this is happening because I see syslog entries for that time running the anacron test jobs.

This might be a cron issue rather than netdata because when I execute:

run-parts /etc/cron.daily/

I can see the initial netdata update script output. So I’ve dropped a script of my own into that directory and it runs fine when I use run-parts. I’ll check back tomorrow to see if it ran at 6:25AM.

Can you also confirm where to updater script logs out to? I see the script references the logfile but am not sure where it’s going to create it.