Try ERPNext Buy Support Partners Foundation

Add-to-hosts Bench start isnt working

I added a new site to /etc/hosts from a user Frappe(following the tutorial) And this is the error I am getting.
Bench --site library.test add-to-hosts

13:10:14 system           | redis_socketio.1 started (pid=6051)
13:10:14 redis_socketio.1 | 6060:C 30 Nov 13:10:14.945 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13:10:14 redis_socketio.1 | 6060:C 30 Nov 13:10:14.945 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=6060, just started
13:10:14 redis_socketio.1 | 6060:C 30 Nov 13:10:14.945 # Configuration loaded
13:10:14 redis_socketio.1 | 6060:M 30 Nov 13:10:14.946 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:10:14 redis_socketio.1 | 6060:M 30 Nov 13:10:14.946 * Running mode=standalone, port=12000.
13:10:14 redis_socketio.1 | 6060:M 30 Nov 13:10:14.946 # Server initialized
13:10:14 redis_socketio.1 | 6060:M 30 Nov 13:10:14.946 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:10:14 redis_socketio.1 | 6060:M 30 Nov 13:10:14.946 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:10:14 redis_socketio.1 | 6060:M 30 Nov 13:10:14.946 * Ready to accept connections
13:10:14 system           | worker_short.1 started (pid=6063)
13:10:14 system           | socketio.1 started (pid=6071)
13:10:14 system           | worker_default.1 started (pid=6067)
13:10:14 system           | worker_long.1 started (pid=6053)
13:10:15 system           | redis_cache.1 started (pid=6068)
13:10:14 redis_cache.1    | 6076:C 30 Nov 13:10:14.959 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13:10:14 redis_cache.1    | 6076:C 30 Nov 13:10:14.959 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=6076, just started
13:10:14 redis_cache.1    | 6076:C 30 Nov 13:10:14.959 # Configuration loaded
13:10:14 redis_cache.1    | 6076:M 30 Nov 13:10:14.959 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:10:14 redis_cache.1    | 6076:M 30 Nov 13:10:14.960 * Running mode=standalone, port=13000.
13:10:14 redis_cache.1    | 6076:M 30 Nov 13:10:14.960 # Server initialized
13:10:14 redis_cache.1    | 6076:M 30 Nov 13:10:14.960 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:10:14 redis_cache.1    | 6076:M 30 Nov 13:10:14.960 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:10:14 redis_cache.1    | 6076:M 30 Nov 13:10:14.960 * Ready to accept connections
13:10:15 system           | web.1 started (pid=6059)
13:10:15 system           | watch.1 started (pid=6055)
13:10:15 system           | redis_queue.1 started (pid=6094)
13:10:15 redis_queue.1    | 6096:C 30 Nov 13:10:14.981 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13:10:15 redis_queue.1    | 6096:C 30 Nov 13:10:14.981 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=6096, just started
13:10:15 redis_queue.1    | 6096:C 30 Nov 13:10:14.981 # Configuration loaded
13:10:15 redis_queue.1    | 6096:M 30 Nov 13:10:14.981 * Increased maximum number of open files to 10032 (it was originally set to 1024).
13:10:15 redis_queue.1    | 6096:M 30 Nov 13:10:14.982 * Running mode=standalone, port=11000.
13:10:15 redis_queue.1    | 6096:M 30 Nov 13:10:14.982 # Server initialized
13:10:15 redis_queue.1    | 6096:M 30 Nov 13:10:14.982 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13:10:15 redis_queue.1    | 6096:M 30 Nov 13:10:14.982 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
13:10:15 redis_queue.1    | 6096:M 30 Nov 13:10:14.982 * Ready to accept connections
13:10:15 system           | schedule.1 started (pid=6075)
13:10:16 web.1            |  * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
13:10:16 web.1            |  * Restarting with inotify reloader
13:10:16 watch.1          | Error: EACCES: permission denied, open '/home/frappe/.config/yarn'
13:10:16 watch.1          |     at Object.openSync (fs.js:462:3)
13:10:16 watch.1          |     at readFileSync (fs.js:364:35)
13:10:16 watch.1          |     at /usr/lib/node_modules/yarn/lib/cli.js:100892:58
13:10:16 watch.1          |     at Array.map (<anonymous>)
13:10:16 watch.1          |     at parseRcPaths (/usr/lib/node_modules/yarn/lib/cli.js:100890:78)
13:10:16 watch.1          |     at Object.findRc (/usr/lib/node_modules/yarn/lib/cli.js:100904:10)
13:10:16 watch.1          |     at getRcConfigForCwd (/usr/lib/node_modules/yarn/lib/cli.js:56916:74)
13:10:16 watch.1          |     at /usr/lib/node_modules/yarn/lib/cli.js:92255:56
13:10:16 watch.1          |     at Generator.next (<anonymous>)
13:10:16 watch.1          |     at step (/usr/lib/node_modules/yarn/lib/cli.js:310:30)
13:10:17 socketio.1       | listening on *: 9000
13:10:17 system           | watch.1 stopped (rc=0)
13:10:17 system           | sending SIGTERM to redis_socketio.1 (pid 6051)
13:10:17 system           | sending SIGTERM to worker_long.1 (pid 6053)
13:10:17 system           | sending SIGTERM to redis_queue.1 (pid 6094)
13:10:17 system           | sending SIGTERM to web.1 (pid 6059)
13:10:17 system           | sending SIGTERM to schedule.1 (pid 6075)
13:10:17 system           | sending SIGTERM to worker_default.1 (pid 6067)
13:10:17 system           | sending SIGTERM to socketio.1 (pid 6071)
13:10:17 system           | sending SIGTERM to redis_cache.1 (pid 6068)
13:10:17 system           | sending SIGTERM to worker_short.1 (pid 6063)
13:10:17 system           | worker_short.1 stopped (rc=-15)
13:10:17 redis_socketio.1 | 6060:signal-handler (1606722017) Received SIGTERM scheduling shutdown...
13:10:17 system           | worker_default.1 stopped (rc=-15)
13:10:17 redis_cache.1    | 6076:signal-handler (1606722017) Received SIGTERM scheduling shutdown...
13:10:17 redis_queue.1    | 6096:signal-handler (1606722017) Received SIGTERM scheduling shutdown...
13:10:17 system           | schedule.1 stopped (rc=-15)
13:10:17 redis_cache.1    | 6076:M 30 Nov 13:10:17.063 # User requested shutdown...
13:10:17 redis_cache.1    | 6076:M 30 Nov 13:10:17.063 * Removing the pid file.
13:10:17 redis_cache.1    | 6076:M 30 Nov 13:10:17.063 # Redis is now ready to exit, bye bye...
13:10:17 system           | redis_cache.1 stopped (rc=-15)
13:10:17 redis_socketio.1 | 6060:M 30 Nov 13:10:17.063 # User requested shutdown...
13:10:17 redis_socketio.1 | 6060:M 30 Nov 13:10:17.063 * Removing the pid file.
13:10:17 redis_socketio.1 | 6060:M 30 Nov 13:10:17.063 # Redis is now ready to exit, bye bye...
13:10:17 system           | redis_socketio.1 stopped (rc=-15)
13:10:17 system           | socketio.1 stopped (rc=-15)
13:10:17 system           | worker_long.1 stopped (rc=-15)
13:10:17 redis_queue.1    | 6096:M 30 Nov 13:10:17.085 # User requested shutdown...
13:10:17 redis_queue.1    | 6096:M 30 Nov 13:10:17.085 * Removing the pid file.
13:10:17 redis_queue.1    | 6096:M 30 Nov 13:10:17.085 # Redis is now ready to exit, bye bye...
13:10:17 system           | redis_queue.1 stopped (rc=-15)
13:10:17 system           | web.1 stopped (rc=-15)

@Divan009
It is a permission error
The user in which you’re running bench does not have access to the files
You can also add the site name to the hosts file directly

Hi @Mohammad_Hasnain I checked in /etc/hosts it already exists

127.0.0.1	localhost
127.0.1.1	diva-ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 library.test

@Divan009 This has more to do with file system permissions of (the contents of) the /home/frappe/.config folder than the add-to-hosts command. Try checking if you can execute yarn from the terminal,

The output you’ve shared here is of the bench start process, which starts the development server for Frappe. And the permission error has come up from the bench build process which builds assets as they are updated.