[v12] bench update fails

I am running a version-12 instance inside an LXD container.
Installed with the install.py script run with the --container option.

now The instance runs fine but bench update (as well as i.e. bench restart) fails with the following error

sudo: no tty present and no askpass program specified
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/franch/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/franch/.bench/bench/commands/update.py", line 61, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
  File "/home/franch/.bench/bench/commands/update.py", line 107, in _update
    restart_supervisor_processes(bench_path=bench_path)
  File "/home/franch/.bench/bench/utils.py", line 396, in restart_supervisor_processes
    supervisor_status = subprocess.check_output(['sudo', 'supervisorctl', 'status'], cwd=bench_path)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['sudo', 'supervisorctl', 'status']' returned non-zero exit status 1.

I am quite familiar with the sudo: no tty present and no askpass program specified issue inside LXD containers which you can get around by using a sudo -S .... So I wonder whether the current bench used ‘sudo’ somehow and fails due to this. I have not seen those issues with v11.

alternatively … how can I update erpnext/frappe without bench commands?
tries git pull origin version-12 in each apps folder. This works well but the instance is not available afterwards with an Internal Server Error in the browser (and I can not run bench restart as I mentioned.

any ideas how to get past this?

hm … just while I wrote the post above I tried bench update once again and ended up with the same error message, but not in Internal Server Error but “Your System is under Maintenance” (not the exact wording I believe though, but something along those lines.

changeing "maintenance_mode": 1, to "maintenance_mode": 0, in ~/frappe-bench/sites/common_site_config.json took care of that and I am on the latest release.

so this does away with my concrete issue but not quite yet with the bench problem with sudo

1 Like

edit the /etc/sudoers file and add this for your user (in the user privilege section - note without the % sign)

myuser ALL=(ALL) NOPASSWD: ALL

log off and login again.

PS: Your user will be allowed to execute without password. Hopefully you have disabled ssh access into lxd container for that user (or root) and dont use that username on erpnext. You can ssh into host and then bash into the container.