[solved] Dropbox backup Failed - grant user ownership

Hi, i need help with my dropbox integration. It was working fine until today when i got the following error in my mail:

Oops, your automated backup to Dropbox failed.

Error message:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 45, in take_backup_to_dropbox
did_not_upload, error_log = backup_to_dropbox()
File “/home/frappe/frappe-bench/apps/frappe/frappe/integrations/doctype/dropbox_settings/dropbox_settings.py”, line 96, in backup_to_dropbox
backup = new_backup(ignore_files=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 169, in new_backup
delete_temp_backups(older_than = frappe.conf.keep_backups_for_hours or 24)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 186, in delete_temp_backups
os.remove(this_file_path)
OSError: [Errno 13] Permission denied: ‘./site1.local/private/backups/20170826_000213_a4515080_database.sql.gz’

Please contact your system manager for more information.

i’ve tried to find out what the cause of the error is but i can’t seem to figure it out. I would be glad if someone can advise me on how to resolve it.

thanks.

The problem is the OS forbids ERPNext from deleting old backup files.

Have you console access? if so please run this and report what you get:

ls -al /home/frappe/frappe-bench/sites/site1.local/private/backups/

For example in my case:

frappe@erpnext:~/frappe-bench$ ls -al sites/erpnext.vm/private/backups/
total 2288
drwxrwxr-x 2 frappe frappe 4096 Jun 4 12:50 .
drwxrwxr-x 4 frappe frappe 4096 Jan 22 2017 …
-rw-rw-r-- 1 frappe frappe 447436 Jun 4 11:34 20170605_000416_88f64c0d_database.sql.gz
-rw-rw-r-- 1 frappe frappe 940200 Jun 4 12:48 20170605_011818_af89e213_database.sql.gz
-rw-rw-r-- 1 frappe frappe 940190 Jun 4 12:50 20170605_012019_be89f2c8_database.sql.gz

@clarkej Thanks for the reply. I have console access and i’ve run the script. this is what i got:

Blockquote ubuntu@ip-172-31-24-66:/home/frappe/frappe-bench$ ls -al /home/frappe/frappe-bench/sites/site1.local/private/backups/
total 2228
drwxr-xr-x 2 frappe frappe 4096 Aug 26 23:02 .
drwxr-xr-x 4 frappe frappe 4096 Aug 25 14:52 …
-rw-r–r-- 1 frappe frappe 1133191 Aug 25 23:16 20170826_000213_a4515080_database.sql.gz
-rw-r–r-- 1 frappe frappe 1135064 Aug 26 23:02 20170827_000210_09f8deb7_database.sql.gz

Also, the backup files are listed in dark orange so that must indicate something right? (I’m a newbie to ERPNext and linux generally to be honest so i don’t know much).

I fixed the issue!!! I continued to research after my last reply and i realized that i needed to grant user ownership of the directory so i used this console command on the directory:
sudo chown -R ubuntu /home/frappe/frappe-bench/sites/site1.local/private/backups

I ran the take backup now command again from dropbox integration and backup was successful this time without the error!

1 Like

Excellent learning for me too, thanks @flexy2ky