Cp: etc/collectd.conf: No such file or directory -> broken symlink

Hi

I regularly backup the config into git.

tar xvfz backup-OpenWrt-2020-09-08.tar.gz
cp -r etc /Users/ccc/Documents/backup/openwrt/
cp: etc/collectd.conf: No such file or directory
ls -al etc/collectd.conf
lrwxr-xr-x@ 1 ccc  staff  22 Aug  4 05:17 etc/collectd.conf -> /var/etc/collectd.conf

How to fix this stuff with broken symlink?

I use macOS.

1 Like

/var is normally just an alias for /tmp

And the config file collectd.conf gets created there by luci_statistics config each time you start the statistics service. If you have not started that service yet, the temporary config file is empty/non-existent.

2 Likes

I restarted the service but still same problem

OpenWrt treats /var as a symlink to /tmp that is tmpfs.
When you start a service, its init script translates the persistent config to the runtime.
A symlink to /var means this is a runtime config.
There's virtually no reason to back up runtime configs.
You can safely ignore that file, or exclude it from the backup.

3 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.