ERROR: Read crontab erpnext: b'must be privileged to use -u\n'

Did an update (upgrade using bench init --frappe-branch --version-13…) and then restoring the older backup. I’m getting a permission error:
ERROR: Read crontab erpnext: b’must be privileged to use -u\n’

the output looks like this:

$ bench update --patch
ERROR: Read crontab erpnext: b’must be privileged to use -u\n’
Traceback (most recent call last):
File “/home/frappe/.local/bin/bench”, line 8, in
File “/home/frappe/.local/lib/python3.7/site-packages/bench/”, line 121, in cli
raise e
File “/home/frappe/.local/lib/python3.7/site-packages/bench/”, line 111, in cli
File “/home/frappe/.local/lib/python3.7/site-packages/click/”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/.local/lib/python3.7/site-packages/click/”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/.local/lib/python3.7/site-packages/click/”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/.local/lib/python3.7/site-packages/click/”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/.local/lib/python3.7/site-packages/click/”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.local/lib/python3.7/site-packages/bench/commands/”, line 23, in update
update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, compile=not no_compile, force=force, reset=reset)
File “/home/frappe/.local/lib/python3.7/site-packages/bench/utils/”, line 373, in update
File “/home/frappe/.local/lib/python3.7/site-packages/bench/patches/”, line 21, in run
result = execute(bench_path)
File “/home/frappe/.local/lib/python3.7/site-packages/bench/patches/v5/”, line 11, in execute
user_crontab = CronTab(user=user)
File “/usr/local/lib/python3.7/dist-packages/”, line 227, in init
File “/usr/local/lib/python3.7/dist-packages/”, line 288, in read
raise IOError(“Read crontab %s: %s” % (self.user, err))
OSError: Read crontab erpnext: b’must be privileged to use -u\n’
frappe@erpa:/opt/erpnext/frappe$ ERROR: Read crontab erpnext: b’must be privileged to use -u\n’
-bash: ERROR:: command not found


It might help to say the operating environment and how bench and frappe were installed. Is this the first time an upgrade has been attempted or have the same commands been used successfully in the past?

Hi @smino

The operating env is Debian server v 10. This system is a virtual server in our local facility and is fairly old. It started out with an old version and was recently running at v13.06 if I’m not mistaken. I wanted to upgrade it to 13.24 and wanted to set up a new environment, as soon as I did a bench update it went berserk. The only thing I can think of is an app to manage Italian SDI invoices. The system on each update would complain about that app, even though I was not using it. So I did try to update it a multitude of times and never succeeded, then I made a backup of the database and did that reinstall and tried to reinstate the database, but now all hell is loose. I need the server to be up…

So I’m currently setting up a new clean server and will try to do a restore on that one.

Thank you,

Are you restoring the db as a username that existed earlier. It looks as if the user may not have a crontab , or have permission to create one. See what crontab -l returns for the user.

Ok, I have not done the installation on that server. I installed a new virtual machine with Ubuntu-20 LTS server… Then on a clean one I installed frappe, erpnext, and the same site that was on the other server. Then I got the clean erpnext running, but I didn’t log into it or do anything on the interface. Following that, I restored the backups from the old server using bench. I believe that the new bench does not recognize --site switch. After the restore I did bench migrate, then bench restart, then got to the website which had the wrong switch for maintenance_mode and I changed it by bench set-config maintenance_mode 0, now everything is running fine. I did my stuff that was to generate the transport document and have thought of digging into this next week when I may have some more time.

The other server corrupted server is still alive. Running crontab -l gives proper response. I’m not going to kill that server just to understand what went wrong.

$ crontab -l
0 10 * * * cd /opt/erpnext/erpnext && /opt/erpnext/erpnext/env/bin/bench update --auto >> /opt/erpnext/erpnext/logs/auto_update_log.log 2>&1
0 */6 * * * cd /opt/erpnext/erpnext && /usr/local/bin/bench --site all backup >> /opt/erpnext/erpnext/logs/backup.log 2>&1
0 10 * * * cd /opt/erpnext/frappe-bench && /opt/erpnext/frappe-bench/env/bin/bench update --auto >> /opt/erpnext/frappe-bench/logs/auto_update_log.log 2>&1
0 */6 * * * cd /opt/erpnext/frappe-bench && /usr/local/bin/bench --site all backup >> /opt/erpnext/frappe-bench/logs/backup.log 2>&1
0 10 * * * cd /opt/erpnext/frappe && /opt/erpnext/frappe/env/bin/bench update --auto >> /opt/erpnext/frappe/logs/auto_update_log.log 2>&1
0 */6 * * * cd /opt/erpnext/frappe-bench-develop && /usr/local/bin/bench --site all backup >> /opt/erpnext/frappe-bench-develop/logs/backup.log 2>&1
0 10 * * * cd /opt/erpnext/frappe-dev && /opt/erpnext/frappe-dev/env/bin/bench update --auto >> /opt/erpnext/frappe-dev/logs/auto_update_log.log 2>&1