Bench update on fresh install

Hi Team,

I just tried a fresh install on a local hosted vm Ubuntu 14 and Im getting a permission error. I have noticed that the install now puts frappe-bench in /home/frappe which im assuming is my challenge. Im logged in as ‘hemant’ and when I go to the frappe-bench folder as recommended in other post to do the update I get this error:

hemant@ubuntu:/home/frappe/frappe-bench$ bench update
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
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1057, in invoke
Command.invoke(self, ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/init.py”, line 21, in bench_command
setup_logging(bench_path=bench_path)
File “/home/frappe/.bench/bench/utils.py”, line 265, in setup_logging
hdlr = logging.FileHandler(log_file)
File “/usr/lib/python2.7/logging/init.py”, line 903, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python2.7/logging/init.py”, line 928, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: ‘/home/frappe/frappe-bench/logs/bench.log’

I have tried to add ‘hemant’ to the ‘frappe’ group but still getting this error. I am trying not to run bench command as sudo cause I have tried that in another fresh install and the update works…I think when doing bench as sudo is not right.

Is there a recommendation from a fresh install point of view or additional steps that needed to be done to get this to work. ERPNext works, but the update does not.

awaiting your feedback.

regards
Hemant

You can try as frappe user in case you have set it up during production install

@hemant

Try this:

cd /home/frappe/frappe-bench
sudo chown -R hemant frappe-bench
sudo chown -R hemant bench-repo

Then try running bench update. I was getting the same error when initiating a bench update from v6 to v7. I ran into other errors afterward, but this one got solved.

Hi @Tropicalrambler

Thanks for the assist…i did as u recommend and still had an issue with git which I solved by this post: When updating bench - CommandFailedError: git pull upstream develop - #5

But now when I create a custom doctype I dont see any folder or py files created under my app like it used todo in the past. I still think something not correct with rights, any ideas?

regards
Hemant

@hpema108 Great to see it worked, I have also been running into some bugs while updating. I solved the git problem by configuring git to my user, then doing git stash, then once that is done I used git clean -f-d to remove the files I had modified.

I do not know where the custom .py files would reside, and perhaps it has something to do with the fact that you changed permissions back to your user, then updated, I have to wonder if you have to redo the permission commands once more after the update?

@Tropicalrambler

I think I figured it out, just dont know how to update the core. Maybe I can report a bug.

I changed the code in the install.py file where it tests for args.production first and sets the user to frappe. This is usually if you logged in as root and have not other sudo user.

if not args.user:
if os.environ.has_key(‘SUDO_USER’):
args.user = os.environ[‘SUDO_USER’]
elif args.production:
args.user = ‘frappe’
else:
args.user = getpass.getuser()

you can see I changed it around cause I already have sudo user as hemant. Im running the install script as :
sudo python install.py --production

I letting it finish the install then I will test the custom doctype etc.

regards

1 Like