TrueNAS Scale version: ElectricEel-24.10.2
I have had some cron scripts running for ages, but at some point, I suspect after one of the recent upgrades, the don’t work completely. I know there are a lot of a number of scripts that do what I want to do and a lot more, but I’ve always tried to keep things simple. (try is the operative word!)
I’m looking for some directions to pursue in trouble shooting this issue. Places to look, commands to perform to narrow the problem down. Searching this forum was my first step, but most hits say “Oh, I found the problem and fixed it.” without explaining what they did or how they fixed it.
So here’s what my script does:
- Copies the TrueNAS sqlite3 configuration file to a specific location - Works
- Validates the integrity of the copied file using sqlite3 - Works
- tars the copied file, encrypts it with a passphrase - Problem
- Encrypts the tared file with a passphrase - never gets here
- Emails the encrypted tar file to me - never gets here
So I setup a Pool named Home, located at /mnt/Home.
I then created the subdirectory /mnt/Home/sysfiles
Within that directory I created the subdirectory cBackups
Visually it looks like this:
--> mnt | +--> Home | +-- sysfiles | | | +-- cBackups | | +-- files | : | +-- (other subdirectories) +-- (other TrueNAS datasets) | : : :
Because they were setup before the conversion to Scale, the owner and groups for /mnt, /mnt/Home, /mnt/Home/sysfiles, /mnt/Home/sysfiles/cBackups and /mnt/Home/sysfiles/cBackups/files are ‘root:root’.
The script is located in /mnt/Home/sysfiles/ and is scheduled via the GUI using cron with the user ‘root’.
Step one works fine. The copying of the file: /data/freenas-v1.db to /mnt/Home/sysfiles/cBackups works without any issues. Copy command:
cp /data/freenas-v1.db /mnt/Home/sysfiles/cBackups/files/config.db
Step two works fine. The validation of the integrity of the copied file using sqlite3 works without any issues.Validation command:
sqlite3 "/mnt/Home/sysfiles/cBackups/files/config.db" "pragma integrity_check;"
But step three fails. The command is:
tar -czvf "config.tar.gz" -C "/mnt/Home/sysfiles/cBackups" "freenas-v1.db"
The error is:
config.tar.gz Cannot open. Read-only file system
tar(child):Error is not recoverable exiting now
which is interesting because the copy just worked!
Background:
When I upgraded the OS I also moved the pools to new drives. I exported and imported them. At that time the pools were set to “Read Only” but with the help of this group I was able to reset them and have been happily reading and writing to all my pools with no issues… except this one.
I hope I have given enough information here, but if not, ask me and I’ll provide it.
Thanks so much in advance for your help.