Bench New Site fails

SystemSettings.enable_scheduler is UNSET
*** Scheduler is disabled ***

ailed to restart supervisor.service: Unit supervisor.service not found.

run this command and post output here.

sudo service supervisor status
1 Like
bench --site <sitename> set-config pause_scheduler 0
bench --site <sitename> enable-scheduler

I have resolved that problem by scrubbing the installation and using a new set of instructions these being Guide-to-Install-Frappe-ERPNext-v14-Ubuntu-22.04-LTS-/README.md at main · datawisepro/Guide-to-Install-Frappe-ERPNext-v14-Ubuntu-22.04-LTS- · GitHub

This one has gotten me almost to the completion stage but for one issue

At The “bench start” command i get this response
erpnext@erpserver:~/frappe-bench$ bench start
13:56:16 system | redis_cache.1 started (pid=3029)
13:56:16 system | redis_socketio.1 started (pid=3031)
13:56:16 redis_socketio.1 | 3035:C 30 Jul 2023 13:56:16.712 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13:56:16 redis_socketio.1 | 3035:C 30 Jul 2023 13:56:16.712 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=3035, just started
13:56:16 redis_socketio.1 | 3035:C 30 Jul 2023 13:56:16.712 # Configuration loaded
13:56:16 redis_socketio.1 | 3035:M 30 Jul 2023 13:56:16.712 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:56:16 redis_socketio.1 | 3035:M 30 Jul 2023 13:56:16.713 # Could not create server TCP listening socket 127.0.0.1:12000: bind: Address already in use
13:56:16 redis_cache.1 | 3033:C 30 Jul 2023 13:56:16.713 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13:56:16 system | socketio.1 started (pid=3040)
13:56:16 system | redis_socketio.1 stopped (rc=1)
13:56:16 system | web.1 started (pid=3038)
13:56:16 redis_cache.1 | 3033:C 30 Jul 2023 13:56:16.718 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=3033, just started
13:56:16 redis_cache.1 | 3033:C 30 Jul 2023 13:56:16.718 # Configuration loaded
13:56:16 redis_cache.1 | 3033:M 30 Jul 2023 13:56:16.719 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:56:16 redis_cache.1 | 3033:M 30 Jul 2023 13:56:16.720 # Could not create server TCP listening socket 127.0.0.1:13000: bind: Address already in use
13:56:16 system | redis_queue.1 started (pid=3037)
13:56:16 system | worker.1 started (pid=3046)
13:56:16 worker.1 | /bin/sh: 1: cannot create logs/worker.log: Permission denied
13:56:16 system | worker.1 stopped (rc=2)
13:56:16 system | redis_cache.1 stopped (rc=1)
13:56:16 system | schedule.1 started (pid=3053)
13:56:16 system | watch.1 started (pid=3051)
13:56:16 system | sending SIGTERM to redis_queue.1 (pid 3037)
13:56:16 system | sending SIGTERM to web.1 (pid 3038)
13:56:16 system | sending SIGTERM to socketio.1 (pid 3040)
13:56:16 system | sending SIGTERM to watch.1 (pid 3051)
13:56:16 system | sending SIGTERM to schedule.1 (pid 3053)
13:56:16 system | web.1 stopped (rc=-15)
13:56:16 system | redis_queue.1 stopped (rc=-15)
13:56:16 system | socketio.1 stopped (rc=-15)
13:56:16 system | watch.1 stopped (rc=-15)
13:56:16 system | schedule.1 stopped (rc=-15)
erpnext@erpserver:~/frappe-bench$

This appears to be a permissions issue and I am unable to resolve it

erpnext@erp:~/frappe-bench$ sudo service supervisor status
● supervisor.service - Supervisor process control system for UNIX
Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2023-07-31 16:57:00 UTC; 47s ago
Docs: http://supervisord.org
Process: 1417 ExecStart=/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf (code=exited, status=1/FAILURE)
Main PID: 1417 (code=exited, status=1/FAILURE)
CPU: 338ms

Lets first fix this. No its not a permission issue. If you closely take a look at log, redis cache unable to create tcp connection because that port is already in use.
First of all if you are using docker, make sure another container is not blocking that port. If you are not using docker then follow these steps.

in frappe_bench/config folder. you have these files

redis_cache.conf
redis_socketio.conf
redis_queue.conf

In each of the above config file there is a line like this

port 13000

make sure port number is different in each of the above file. If you found duplicate port number, most likely
its causing the error. change port number to something else, make sure you also update your common_site_config.json file accordingly.

If everything else is normal, and you are not using docker, use this command it will tell you which program is blocking that port

sudo ss -tup -a sport = :13000

On my system the output looks like this

Netid  State   Recv-Q  Send-Q     Local Address:Port      Peer Address:Port   Process
tcp    LISTEN  0       511            127.0.0.1:13000          0.0.0.0:*       users:(("redis-server",pid=9093,fd=6))
tcp    ESTAB   0       0              127.0.0.1:13000        127.0.0.1:35428   users:(("redis-server",pid=9093,fd=9))
tcp    ESTAB   0       0              127.0.0.1:13000        127.0.0.1:37342   users:(("redis-server",pid=9093,fd=12))
tcp    ESTAB   0       0              127.0.0.1:13000        127.0.0.1:40824   users:(("redis-server",pid=9093,fd=11))
tcp    ESTAB   0       0              127.0.0.1:13000        127.0.0.1:43198   users:(("redis-server",pid=9093,fd=7))
tcp    ESTAB   0       0              127.0.0.1:13000        127.0.0.1:40820   users:(("redis-server",pid=9093,fd=10))
tcp    ESTAB   0       0              127.0.0.1:13000        127.0.0.1:43214   users:(("redis-server",pid=9093,fd=8))

As you can see from above output, redis server is using port 13000 on my system.

if your problem is not resolved, try above command and share your output here and we ll investigate further.

1 Like

Its hard to tell anything why your process is failing. Lets try to restart supervisor using command

sudo systemctl restart supervisor

then check its status again if the failure is not resolved. check the last few lines of log using this command.

sudo tail -f /var/log/supervisor/supervisord.log

It will spit out some log lines and most likely will give you the cause of error. If you are not sure what that means, paste those log lines here.

redis_cache.conf

dbfilename redis_cache.rdb
dir /home/erpadmin/frappe-bench/config/pids
pidfile /home/erpadmin/frappe-bench/config/pids/redis_cache.pid
bind 127.0.0.1
port 13000
maxmemory 195mb
maxmemory-policy allkeys-lru
appendonly no

save “”

aclfile /home/erpadmin/frappe-bench/config/redis_cache.acl

redis_socketio.conf

dbfilename redis_socketio.rdb
dir /home/erpadmin/frappe-bench/config/pids
pidfile /home/erpadmin/frappe-bench/config/pids/redis_socketio.pid
bind 127.0.0.1
port 12000

aclfile /home/erpadmin/frappe-bench/config/redis_socketio.acl

redis_queue.conf

dbfilename redis_queue.rdb
dir /home/erpadmin/frappe-bench/config/pids
pidfile /home/erpadmin/frappe-bench/config/pids/redis_queue.pid
bind 127.0.0.1
port 11000

aclfile /home/erpadmin/frappe-bench/config/redis_queue.acl

As you can see there are no duplicated port settings

This is the result of the noted commands,

erpadmin@erp:~/frappe-bench$ sudo systemctl restart supervisor
erpadmin@erp:~/frappe-bench$ sudo tail -f /var/log/supervisor/supervisord.log
2023-07-31 15:12:12,881 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2023-07-31 15:12:12,881 WARN No file matches via include “/etc/supervisor/conf.d/.conf"
2023-07-31 15:12:12,885 INFO RPC interface ‘supervisor’ initialized
2023-07-31 15:12:12,886 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking
2023-07-31 15:12:12,886 INFO supervisord started with pid 1797
2023-07-31 15:41:09,685 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2023-07-31 15:41:09,685 WARN No file matches via include "/etc/supervisor/conf.d/
.conf”
2023-07-31 15:41:09,689 INFO RPC interface ‘supervisor’ initialized
2023-07-31 15:41:09,689 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking
2023-07-31 15:41:09,689 INFO supervisord started with pid 4520

Additional info;

The environment I am using is as follows,

I have a cluster of 5 Dell Rack Servers running a ProxMox Virtual Environment 7.4-16
In this environment I have Virtual machines built from Ubuntu Server 22.04.2 ISO’s with 100GB disks 4 CPU cores and 4 to 6 GB of RAM. These VM configurations run many applications without issue.

Hi @TimRyanKaslovia

Try This

bench --site [site-name] enable-scheduler

I hope this helps.
Thank You!

enable the scheduler as mentioned by @Mohammadali and then restart your supervisor. From logs, It doesnt look like anything wrong with supervisor. Let me know your results.

1 Like

This was the result of the bench --site comxpertise enable-scheduler command
Traceback (most recent call last):
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 606, in get_values
out = self._get_values_from_table(
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 835, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 220, in sql
self._cursor.execute(query, values)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/cursors.py”, line 158, in execute
result = self._query(query)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/cursors.py”, line 325, in _query
conn.query(q)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 779, in _read_query_result
result.read()
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 1157, in read
first_packet = self.connection._read_packet()
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 729, in _read_packet
packet.raise_for_error()
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, “Table ‘_5c4da1c4001e878c.tabDocType’ doesn’t exist”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 109, in
main()
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/commands/init.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/commands/scheduler.py”, line 46, in enable_scheduler
frappe.utils.scheduler.enable_scheduler()
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 135, in enable_scheduler
toggle_scheduler(True)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 131, in toggle_scheduler
frappe.db.set_single_value(“System Settings”, “enable_scheduler”, int(enable))
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 762, in set_single_value
return self.set_value(doctype, doctype, fieldname, value, *args, **kwargs)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 904, in set_value
modified = modified or now()
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/data.py”, line 366, in now
return now_datetime().strftime(DATETIME_FORMAT)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/data.py”, line 299, in now_datetime
dt = convert_utc_to_system_timezone(datetime.datetime.utcnow())
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/data.py”, line 346, in convert_utc_to_system_timezone
time_zone = get_system_timezone()
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/data.py”, line 320, in get_system_timezone
return frappe.cache().get_value(“time_zone”, _get_system_timezone)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 81, in get_value
val = generator()
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/utils/data.py”, line 313, in _get_system_timezone
return frappe.db.get_system_setting(“time_zone”) or “Asia/Kolkata” # Default to India ?!
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 1216, in get_system_setting
return frappe.get_system_settings(key)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/init.py”, line 2329, in get_system_settings
local.system_settings = get_cached_doc(“System Settings”)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/init.py”, line 1104, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/init.py”, line 1197, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/model/document.py”, line 72, in get_doc
controller = get_controller(doctype)
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 82, in get_controller
site_controllers[doctype] = _get_controller()
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 48, in _get_controller
module_name, custom = frappe.db.get_value(
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 509, in get_value
result = self.get_values(
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 626, in get_values
out = self.get_values_from_single(
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 676, in get_values_from_single
r = frappe.qb.get_query(
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
File “/home/erpadmin/frappe-bench/apps/frappe/frappe/database/database.py”, line 220, in sql
self._cursor.execute(query, values)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/cursors.py”, line 158, in execute
result = self._query(query)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/cursors.py”, line 325, in _query
conn.query(q)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 549, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 779, in _read_query_result
result.read()
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 1157, in read
first_packet = self.connection._read_packet()
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py”, line 729, in _read_packet
packet.raise_for_error()
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/erpadmin/frappe-bench/env/lib/python3.10/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, “Table ‘_5c4da1c4001e878c.tabSingles’ doesn’t exist”)

Are you sure you are using the right database. Usually this is the point where I suggest, if its not production system, drop everything, and reinstall your system. That’s more convenient. rather dealing with long list of errors.

Thanks and thats what I will do

This should be part of all installation instructions