I successfully ran bench update as frappe earlier this week after stashing git and the .bench repo then today when I went in to do bench update same issue we have made no modifications to files outside of ERPNext application so what going on I should not have to do anything with repo except bench update at this point?
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/update.py”, line 34, in update
File “/home/frappe/.bench/bench/utils.py”, line 275, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/.bench/bench/utils.py”, line 145, in exec_cmd
bench.utils.CommandFailedError: git pull
the error relates to file permissions, not changes. Can you check if all files are owned by frappe? I.e. run
$ sudo chown -R frappe:frappe /home/frappe/*
If you run a
$ sudo git pull, updated files will be owned by root and the issue will occur again…
Hope this helps.
that’s the problem we are making no changes to file permissions we went through these steps earlier this week and it worked then I come back today and it errors out again…
“If you do not fix the underlying cause, the error will keep coming back and you’ll have to keep re-running the above commands over and over again.”
This may explain your situation https://stackoverflow.com/questions/6448242/git-push-error-insufficient-permission-for-adding-an-object-to-repository-datab
Been through all of this at least twice we are doing nothing out of the ordinary on this box I think there is something more at work here as I don’t post until I am reasonably sure I have tried everything available in the forums…
I guess then you will have to keep looking for the problem!
Have you checked your umask settings?
@magic-overflow I am very familiar with the commands you speak of just not sure why I have to keep doing them every time I go into bench update… this system has been up for over a year and it is only recently that I have to do this so I am wonder what has changed on script side and if anyone else know what to look for?
@trentmu what should umask be set for?
Depending on how you have set up your system, the default is normally 022.
Is this your system, or a multiuser setup? (Maybe another admin has made changes that you don’t know about).
Perhaps check if there is a cron job running that is making changes on a timed basis.
log files are a wealth of useful info that are under-utilised
this is a lightsail vps so perhaps there is something there however I did discover this cron job which from review is installed automatically by ERPNext but it does run successfully when I run it which would explain why it is not auto updating:
cd /home/frappe/frappe-bench && /home/frappe/frappe-bench/env/bin/bench update --auto >> /home/frappe/frappe-bench/logs/auto_update_log.log 2>&1
here is what is in the log:
/bin/sh: 1: /home/frappe/frappe-bench/env/bin/bench: not found
And indeed bench is not in there so there is a problem with this auto created script.
given the issues with updates I’m kind of glad it doesn’t run I would like to fix it then disable so I can update manually which is what I will check into now…
Normally… once you
cd /home/frappe/frappe-bench the environment allows running bench commands, but they would fail from a different subdir