Bench update fails due to no "bench --backup" option ?!?

After performing a “bench update” successfully this morning (no errors), bench now reports that the “–backup” option doesn’t exist!

frappe@ubuntu:~/frappe-bench$ bench update
INFO:bench.utils:Updating bench
$ git pull
Already up-to-date.
INFO:bench.utils:Bench Updated!
Usage: bench update [OPTIONS]
Try "bench update --help" for help.

Error: no such option: --backup
frappe@ubuntu:~/frappe-bench$

Is this a side-effect of there being no updates available?

Fwiw, I’m using the production vm from erpnext.org, updated to v12 (but no updates to Ubuntu).

frappe@ubuntu:~/frappe-bench$ bench --version
4.1.0
frappe@ubuntu:~/frappe-bench$ bench version
erpnext 12.5.2
frappe 12.3.0
frappe@ubuntu:~/frappe-bench$

Thanks,
Dale

I’m having the same problem, tried bench update --reset as well. Apps are not being updated :frowning:

Solved by bench update --no-backup

1 Like

Thanks @iMoshi for your suggestion. I confirmed bench update executes correctly when --no-backup is specified.

For the benefit of others, this this does not solve the underlying problem, and “bench update” still fails afterwards, which I assume means something is broken and will be fixed (“bench update --help” even says “–no-backup” is not recommended on production systems!) I will snapshot the server vm before updating and create backups manually as a workaround until it’s fixed.

Cheers,
Dale

This is a bug. I made a PR fix: "Error: no such option: --backup" by ccfiel · Pull Request #946 · frappe/bench · GitHub @nabinhait @gavindsouza. Hope this will be merge to fix the bug

1 Like

I’ve reviewed it. Please make the necessary changes so that we can merge this ASAP

@gavindsouza I responded to your comment.

@Dale_Scott @iMoshi Please do git pull in your .bench and test again if its working and please test if putting parameter --no-backup it will not do a backup.

@ccfiel sorry to have to ask, but I’m still a newb at low level work. Could you list the exact commands? (starting with “cd …” ) thanks

Hi Dale,

The bench code git repo is found in .bench that sits next to the frappe-bench directory, for eg typically /home/frappe/frappe-bench & /home/frappe/.bench

In my local case, this lists the last merge commits included in my most recent bench update a few weeks ago, destined for my local bench code repo:

frappe@ubuntu:~/frappe-bench$ cd …/.bench/
frappe@ubuntu:~/.bench$ git log --merges
commit c8fa035e4c4b8f9ad3c975ca453060e948ebcf3d
Merge: 857868e 66dd5af
Author: gavin gavin18d@gmail.com
Date: Mon Feb 10 14:57:17 2020 +0530

Merge pull request #920 from frappe/revert-907-pip-pin

Revert "fix: pip pinned to 19.3.1 after v20 breaking"

commit 857868eb5c713c99a6c461a1efd05a65c25fb79c
Merge: e3bfe3a 1ae9bfb
Author: gavin gavin18d@gmail.com
Date: Mon Feb 10 14:07:07 2020 +0530

Merge pull request #914 from gavindsouza/migrate-env-fix

refactor: bench migrate-env command

Meanwhile off in the bench code remote repo, here are the latest commits to the ‘master’ branch of the bench:

That list includes ccfiel’s commit yesterday fix: “Error: no such option: --backup”

fix: "Error: no such option: --backup" by ccfiel · Pull Request #946 · frappe/bench · GitHub))fix: "Error: no such option: --backup" (#946) · frappe/bench@76943e0 · GitHub

So I would hazard to guess just cd ~/.bench then a git pull will update your local with all the commits to the bench?

2 Likes

Hey

You could also try bench update from outside a bench directory. If you’re not sure if you are in a bench directory, you could try bench find . just to be sure. Or even just execute cd && bench update. If you want to manually just pull the bench changes but not update it’s requirements, you could also try cd $(bench src) && git pull

Running bench update outside of a bench directory will update the bench tool.

2 Likes

@ccfiel I did a “git pull” in /home/frappe/.bench and can confirm “bench update” now completes correctly.

The logic seems to be backward though for the “–no-backup” option (or I could be utterly wrong).

frappe@ubuntu:~$ cd .bench
frappe@ubuntu:~/.bench$ git pull
frappe@ubuntu:~/.bench$ cd ../frappe-bench
frappe@ubuntu:~/frappe-bench$ bench update
...
frappe@ubuntu:~/frappe-bench$ ls -l sites/site1.local/private/backups/
total 14328
-rw-rw-r-- 1 frappe frappe 1169084 Mar  4 11:00 20200304_110008-site1_local-database.sql.gz
-rw-rw-r-- 1 frappe frappe 4648960 Mar  4 11:00 20200304_110008-site1_local-files.tar
-rw-rw-r-- 1 frappe frappe 1515520 Mar  4 11:00 20200304_110008-site1_local-private-files.tar
-rw-rw-r-- 1 frappe frappe 1169226 Mar  5 11:00 20200305_110008-site1_local-database.sql.gz
-rw-rw-r-- 1 frappe frappe 4648960 Mar  5 11:00 20200305_110008-site1_local-files.tar
-rw-rw-r-- 1 frappe frappe 1515520 Mar  5 11:00 20200305_110008-site1_local-private-files.tar
frappe@ubuntu:~/frappe-bench$ bench update --no-backup
INFO:bench.utils:Updating bench
$ git pull
Already up-to-date.
INFO:bench.utils:Bench Updated!
...
frappe@ubuntu:~/frappe-bench$ ls -l sites/site1.local/private/backups/
total 8308
-rw-rw-r-- 1 frappe frappe 1169226 Mar  5 11:00 20200305_110008-site1_local-database.sql.gz
-rw-rw-r-- 1 frappe frappe 4648960 Mar  5 11:00 20200305_110008-site1_local-files.tar
-rw-rw-r-- 1 frappe frappe 1515520 Mar  5 11:00 20200305_110008-site1_local-private-files.tar
-rw-rw-r-- 1 frappe frappe 1169415 Mar  5 23:42 20200305_234155-site1_local-database.sql.gz
frappe@ubuntu:~/frappe-bench$

@gavindsouza this is what I was trying to tell you. Me and @Dale_Scott have the same behavior the logic is switch when you put --no-backup it will backup if you do not put the option it will not backup. My first PR solve this problem.