when I boot RPi4 running DietPi a can see errors related to netdata service.
Means the service fails to start because directory /var/log/netdata does not exist.
In fact this directory /var/log/netdata is missing after reboot if created during runtime.
I started investigation and I think this issue is related to the “Log System Mode”; I have enabled DietPi-RAMlog #2 because I think this suits best when booting DietPi from SSD.
I can see in file /boot/dietpi/.installed that the related log mode is enabled:
It’s clear that netdata-logdirectory is not included.
My understanding is after reboot some script will restore any data from /root/logfile_storage/ to /var/log/netdata/.
If this is true there’s a logical failure regarding netdata, then.
Because netdata’s logfile will be removed after reboot and not be restored before service netdata is starting.
And this results in failure when netdata service is supposed to start after reboot.
Independant of this issue I would like to ask this question:
Why are you controlling netdata service with dietpi-service?
What’s the benefit of this?
Usually content of /var/log should be stored automatically to /var/tmp/dietpi/logs/dietpi-ramlog_store on shutdown. And content should be restored on reboot automatically.
The script used is /boot/dietpi/func/dietpi-ramlog, triggered by service dietpi-ramlog.service. How do you reboot? Using reboot command?. You can try to manually trigger the save to /var/tmp/dietpi/logs/dietpi-ramlog_store manually.
/boot/dietpi/func/dietpi-ramlog 1
It should looks like this
root@DietPi3:/var/log# /boot/dietpi/func/dietpi-ramlog 1
2022-03-10 22:08:25 [ INFO ] DietPi-RAMlog | Storing /var/log to /var/tmp/dietpi/logs/dietpi-ramlog_store...
2022-03-10 22:08:25 [ OK ] DietPi-RAMlog | Stored /var/log to /var/tmp/dietpi/logs/dietpi-ramlog_store.
root@DietPi3:/var/log#
We it make sense to have some service controlled by DietPi? Because on thinks like backup we are able to stop services. Same on updates and software installations. A couple of important services are excluded like DNS server and SSH server.
This is the content of file /var/tmp/dietpi/logs/dietpi-ramlog.log:
2022-03-10 21:38:08 [ INFO ] DietPi-RAMlog | Restoring /var/log from /var/tmp/dietpi/logs/dietpi-ramlog_store...
2022-03-10 21:38:08 [ INFO ] DietPi-RAMlog | /var/tmp/dietpi/logs/dietpi-ramlog_store does not exist. Aborting...
This is confirmed; after running /boot/dietpi/func/dietpi-ramlog 1 directory /var/tmp/dietpi/logs/dietpi-ramlog_store/ will be created and /var/log/ will be copied.
However, this job runs daily vs. job /boot/dietpi/func/dietpi-logclear 0 that runs hourly.
My understanding is that job /boot/dietpi/func/dietpi-logclear 0 will delete the content in /var/log/before job /boot/dietpi/func/dietpi-ramlog 1 can create a backup of this directory.
If this is true, I don’t think it makes sense.
And why is directory netdata not included in /root/logfile_storage/ after running /boot/dietpi/func/dietpi-logclear 0?
Although there could be services that you prefer to control with DietPi, I don’t agree that netdata is belonging to this list.
Question:
How can I consistently remove netdata from the list of services controlled by DietPi?
I run this command to disable DietPi service controlling netdata:
dietpi-services systemd_controlled netdata
Then I disabled netdata.service using systemctl:
systemctl disable --now netdata.service
After this I rebooted RPi.
But the error message for starting netdata is still there; this error message shows two things:
netdata is still controlled by DietPi service
netdata fails to start because directory /var/log/netdata does not exist
root@eddie:~# dietpi-services status netdata
DietPi-Services
─────────────────────────────────────────────────────
Mode: status netdata
[FAILED] DietPi-Services | ● netdata.service - netdata - Real-time performance monitoring
Loaded: loaded (/lib/systemd/system/netdata.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2022-03-11 15:52:43 CET; 3min 17s ago
Docs: man:netdata
file:///usr/share/doc/netdata/html/index.html
https://github.com/netdata/netdata
Process: 556 ExecStart=/usr/sbin/netdata -D (code=exited, status=1/FAILURE)
Main PID: 556 (code=exited, status=1/FAILURE)
CPU: 140ms
Mar 11 15:52:43 eddie netdata[556]: 2022-03-11 15:52:43: netdata FATAL : netdata : Cannot cd to directory '/var/log/netdata' # : No such file or directory
Mar 11 15:52:43 eddie netdata[556]: 2022-03-11 15:52:43: netdata INFO : MAIN : EXIT: netdata prepares to exit with code 1...
Mar 11 15:52:43 eddie netdata[556]: 2022-03-11 15:52:43: netdata INFO : MAIN : EXIT: cleaning up the database...
Mar 11 15:52:43 eddie netdata[556]: 2022-03-11 15:52:43: netdata INFO : MAIN : Cleaning up database [0 hosts(s)]...
Mar 11 15:52:43 eddie netdata[556]: 2022-03-11 15:52:43: netdata INFO : MAIN : EXIT: all done - netdata is now exiting - bye bye...
Mar 11 15:52:43 eddie netdata[556]: EXIT: cleaning up the database...
Mar 11 15:52:43 eddie netdata[556]: Cleaning up database [0 hosts(s)]...
Mar 11 15:52:43 eddie netdata[556]: EXIT: all done - netdata is now exiting - bye bye...
Mar 11 15:52:43 eddie systemd[1]: netdata.service: Main process exited, code=exited, status=1/FAILURE
Mar 11 15:52:43 eddie systemd[1]: netdata.service: Failed with result 'exit-code'.
I would prefer to solve issue netdata is still controlled by DietPi service first.
Issue “netdata fails to start after reboot” is solved.
The root cause was an entry in /etc/fstab:
After deleting this line
tmpfs /var/tmp tmpfs size=25M,noatime,lazytime,nodev,nosuid,mode=1777
netdata is starting after reboot.
However I still cannot disable DietPi service control of netdata.
With this status before reboot
the service is started after reboot automatically.
root@eddie:~# dietpi-services status netdata
DietPi-Services
─────────────────────────────────────────────────────
Mode: status netdata
[ OK ] DietPi-Services | netdata active (running) since Fri 2022-03-11 16:45:39 CET; 3min 36s ago
This means I have no control of netdata.service at all.
did you tried my suggestion above, to simply exclude the service using dietpi-services and selecting netdata? There you have the configuration menu to set
Yes, I tried to exclude/disable DietPi service for netdata.
Please check my posting here.
In my opinion the issue with DietPi service is netdata is starting automatically after reboot although I executed dietpi-services systemd_controlled netdata.
I guess we still misunderstood. Pls open dietpi-services UI and navigate to your netdata service inside the UI. Once selected, you would need to set following to line as follow
Setting the excluded value is the important one. Ensure both values are set and reboot your system. Now you should be able to control netdata service by your own and have it disabled to avoid autostart on boot.
Just tested on my test system and it was working this way. netdata stays disabled even after reboot.