Error during update 5-5-16

Please can you help in this error:

root@work:~# su frappe
frappe@work:/root$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch master → FETCH_HEAD
    Already up-to-date.
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    Migrating site3.local
    Updating frappe : [========================================]
    Updating erpnext : [========================================]
    Migrating site1.local
    Updating frappe : [========================================]
    Updating erpnext : [========================================]
    Migrating site2.local
    Updating frappe : [========================================]
    Updating erpnext : [========================================]
    Wrote ./assets/js/print_format_v3.min.js - 18k
    Wrote ./assets/js/frappe-web.min.js - 101k
    Wrote ./assets/js/form.min.js - 113k
    Wrote ./assets/js/report.min.js - 157k
    Wrote ./assets/js/erpnext.min.js - 36k
    Wrote ./assets/css/list.min.css - 6k
    Wrote ./assets/js/erpnext-web.min.js - 1k
    Wrote ./assets/css/report.min.css - 7k
    Wrote ./assets/css/frappe-web.css - 51k
    Wrote ./assets/js/list.min.js - 66k
    Wrote ./assets/js/dialog.min.js - 58k
    Wrote ./assets/js/desk.min.js - 874k
    Wrote ./assets/css/form.min.css - 2k
    Wrote ./assets/js/editor.min.js - 26k
    Wrote ./assets/css/erpnext.css - 1k
    Wrote ./assets/css/desk.min.css - 256k
    Wrote ./assets/css/module.min.css - 2k
    [sudo] password for frappe:
    Sorry, user frappe is not allowed to execute ‘/usr/bin/supervisorctl status’ as root on work.
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
    File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
    bench_command()
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 664, in call
    return self.main(*args, **kwargs)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 644, in main
    rv = self.invoke(ctx)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 464, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/bench-repo/bench/commands/update.py”, line 61, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
    File “/home/frappe/bench-repo/bench/commands/update.py”, line 97, in _update
    restart_supervisor_processes(bench=bench_path)
    File “/home/frappe/bench-repo/bench/utils.py”, line 280, in restart_supervisor_processes
    supervisor_status = subprocess.check_output([‘sudo’, ‘supervisorctl’, ‘status’], cwd=bench)
    File “/usr/lib/python2.7/subprocess.py”, line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command ‘[‘sudo’, ‘supervisorctl’, ‘status’]’ returned non-zero exit status 1
    frappe@work:/root$ sudo bench update
    [sudo] password for frappe:
    Sorry, user frappe is not allowed to execute ‘/usr/local/bin/bench update’ as root on work.
    frappe@work:/root$

Apparently it has to do with users, but I never faced this before, and we don’t run anything on this server except ERPnext.

Regards,
Ahmed

Did you setup manually? Can you run bench update as root?

I tried running it as root and as frappe user also. Same result in both.

Can you run :

visudo -f /etc/sudoers
and
visudo -f /etc/sudoers.d/frappe

And give the output here

This file MUST be edited with the ‘visudo’ command as root.

Please consider adding local content in /etc/sudoers.d/ instead of

directly modifying this file.

See the man page for details on how to write a sudoers file.

Defaults env_reset
Defaults mail_badpass
Defaults secure_path=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”

Host alias specification

User alias specification

Cmnd alias specification

User privilege specification

root ALL=(ALL:ALL) ALL

Members of the admin group may gain root privileges

%admin ALL=(ALL) ALL

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

See sudoers(5) for more information on “#include” directives:

#includedir /etc/sudoers.d

frappe ALL=(ALL) NOPASSWD: /usr/bin/supervisorctl restart frappe:

Ok, here is how it got fixed:
I ran “bench setup sudoers frappe” from root, then I ran bench update, then it worked without errors!

Regards,
Ahmed

3 Likes