SOLVED FreeNAS 11.3 - rclone (via CLI & shellscripts) failing

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Hi All

I recently upgraded to FreeNAS v11.3, and because of issues with the upgrade (it failed for some reason), I did a clean reinstall from USB of v11.3. Once that was done and working, I noticed (the next morning) that my rclone backup script was failing (see my resource).

The error I was getting was:
Code:
2020/02/15 00:00:00 NOTICE: Config file "/.config/rclone/rclone.conf" not found - using defaults
2020/02/15 00:00:00 Failed to create file system for "secret:/": didn't find section in config file


Ahh, easy fix I thought, as obviously due to the fresh install the rclone.conf file was missing my particular settings and needed creating. So I proceeded to run rclone config from a SSH connection, and recreated my B2 configuration.

I then ran the script from the CLI:
Code:
cd /mnt/tank/Sysadmin/scripts
./rclonebackup.sh


And it worked, and I got my email with the backup results in - great I though.

The next day I get up and find that the scheduled cron task at midnight had failed again, and with the same error as last time (see above). So I logged in a SSH session and reran it from the CLI again, and it worked fine. I was now slightly confused!!

I then had a brainstorm, and came up with the command rclone config file, which tells you the location of the config file, and I got the following response:
Code:
rclone config file
configuration file is stored at:
/root/.config/rclone/rclone.conf


Immediately, I saw that the config file was in a different location that the path detailed in the error I was getting. So I copied the file over:
Code:
cp /root/.config/rclone/rclone.conf /.config/rclone/rclone.conf


and the overnight cron job now works as expected!

What I don't understand is why running a shellscript via cron (setup via the GUI) is looking for the rclone.conf config file in a different location than when you run the same script from the CLI via an SSH connection - this was never the case in FreeNAS v11.2-U7. I was previously informed that the rclone config file saved via the CLI is different to the one used in the FreeNAS GUI Cloud Sync Tasks, so its safe to update this configuration file via rclone config without affecting anything you have configured in the FreeNAS GUI.

Has the functionality changed, or is it a bug (NAS-105088)?

Any ideas?

Thanks,
Jonathan
 
Last edited:

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Hi All

IX have responded to my bug report and closed it with the following:

In general rclone is used for UI bits to support the cloud sync feature. For this issue specifically to determine why a 3rd party script is broken we would recommend seeking support over at the community forums. It's more likely that someone in the community has encountered this, and would know what to do to resolve issues with custom scripting.

I don't believe its a script issue, but a functional issue with rclone - does anyone have any ideas?

Jonathan
 

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Anyone have any idea? With the upgrade to 11.3-U1, the workaround of copying rclone.conf to the other folder, now no longer allows it to work when run via cron, but still works fine if I run the script from the CLI.

Jonathan
 

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Have got around this by hard coding the location of the rclone.conf file within my script. I still believe this is a bug with the HOME variable though.

Marked as SOLVED as have a workaround which works!

J.
 
Joined
Apr 10, 2020
Messages
1
This worked for me, thank you for posting this all! Scared me pretty bad when I realized that my backup script cron job (with rclone) hadn't run in over a week, which was when I updated to 11.3.

Since this is a top search engine result (how I got here), and to save others the digging, you'll need to add this flag to your rclone script:

Code:
--config /root/.config/rclone/rclone.conf
 

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Top