Create new Site error when installing erpnext on a fresh ubuntu 16.04 server

Good Morning,

Im trying to install frappe bench using easy install and i always get this error during the install process

TASK [Create new site] *********************************************************
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“bench”, “new-site”, “site1.local”, “–admin-password”, “support”, “–mariadb-root-password”, “dolispy14”], “delta”: “0:00:01.362841”, “end”: “2018-01-10 10:42:39.455273”, “failed”: true, “rc”: 1, “start”: “2018-01-10 10:42:38.092432”, “stderr”: “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”, “stderr_lines”: [“ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”], “stdout”: “Database not installed, this can due to lack of permission, or that the database name exists.\nCheck your mysql root password, or use --force to reinstall”, “stdout_lines”: [“Database not installed, this can due to lack of permission, or that the database name exists.”, “Check your mysql root password, or use --force to reinstall”]}
to retry, use: --limit @/tmp/.bench/playbooks/production/install.retry

PLAY RECAP *********************************************************************
localhost : ok=73 changed=45 unreachable=0 failed=1

Traceback (most recent call last):
File “install.py”, line 388, in
install_bench(args)
File “install.py”, line 114, in install_bench
run_playbook(‘production/install.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 326, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib/python2.7/subprocess.py”, line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘production/install.yml’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2

Ive tried it about 5 times on fresh Ubuntu servers.

Please any insight would be greatly appreciated

I’ve been facing same type of issue and I’ve made a post as well. No one replied anything. :frowning:

was it recent?

Yes; I’ve been trying it since yesterday!
So far I know there’s some update or something going on for “MariaDB” (Not sure). I wish one developer would look into this.

exactly what i think because I’ve installed successfully multiple times over the past 6 months and this issue started on Monday.
Hopefully someone should look into this.

2 Likes

Database not installed, this can due to lack of permission, or that the database name exists.”, “Check your mysql root password, or use --force to reinstall”]}

do you have a previous installation ?
just share the full error log and let me check it for you

I checked the mysql password in password.txt file and it is the correct one.

Hello @Bassam_Mamdouh Here’s my error. Getting this error for last 6 installations. FYI, I have successfully installed Frappe/ERPNext several times before.

TASK [Create new site] *************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“bench”, “new-site”, “site1.local”, “–admin-password”, “something”, “–mariadb-root-password”, “something”], “delta”: “0:00:01.568833”, “end”: “2018-01-10 16:23:04.348629”, “failed”: true, “rc”: 1, “start”: “2018-01-10 16:23:02.779796”, “stderr”: “ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”, “stderr_lines”: [“ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”], “stdout”: “Database not installed, this can due to lack of permission, or that the database name exists.\nCheck your mysql root password, or use --force to reinstall”, “stdout_lines”: [“Database not installed, this can due to lack of permission, or that the database name exists.”, “Check your mysql root password, or use --force to reinstall”]}
to retry, use: --limit @/tmp/.bench/playbooks/production/install.retry

PLAY RECAP *************************************************************************************************************************************************************
localhost : ok=73 changed=45 unreachable=0 failed=1

Traceback (most recent call last):
File “install.py”, line 388, in
install_bench(args)
File “install.py”, line 114, in install_bench
run_playbook(‘production/install.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 326, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib/python2.7/subprocess.py”, line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘production/install.yml’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2

Hi,

This happens because mysql.sock is additionally defined in /etc/mysql/conf.d/settings.cnf file and entries are like that:

socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid

As you can see the path is different than default one which is defined in my.cnf

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

You can comment mysql.sock line in /etc/mysql/conf.d/settings.cnf file and restart mysql or override it in .my.cnf setting correct path.

I hope this will help you for solving the problem until it gets fixed globally.

Regards,
Ali Nebi

4 Likes

I’ve been facing the same issue. Hope this getting fixed soon.

Hello @fnrfarid and @benjamin i think the reply from @anebi will solve the problem try it out and give us a feed back to see if its solved or not

Thank You guys @anebi @Sambath1605 so much. It worked!! I just hope I won’t be getting other errors now.

@benjamin & @Sambath1605 try this guys.

Okay @anebi , My first installation was successful but I can’t login to ERPNext; after entering admin user and pass it showing verifying and it never ends. So, I tried again the installation, and this time changed my.cnf’s socket and pid file directory as per setting.cnf. This gives me this error message.

TASK [Install erpnext app] *********************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“bench”, “–site”, “site1.local”, “install-app”, “erpnext”], “delta”: “0:00:01.152170”, “end”: “2018-01-12 13:35:00.898443”, “failed”: true, “rc”: 1, “start”: “2018-01-12 13:34:59.746273”, “stderr”: “Traceback (most recent call last):\n File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main\n "main", fname, loader, pkg_name)\n File "/usr/lib/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in \n main()\n File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main\n click.Group(commands=commands)(prog_name=‘bench’)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in call\n return self.main(*args, **kwargs)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main\n rv = self.invoke(ctx)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke\n return ctx.invoke(self.callback, **ctx.params)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke\n return callback(*args, **kwargs)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func\n return f(get_current_context(), *args, **kwargs)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py", line 24, in _func\n ret = f(frappe._dict(ctx.obj), *args, **kwargs)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 165, in install_app\n _install_app(app, verbose=context.verbose)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 109, in install_app\n frappe.clear_cache()\n File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 516, in clear_cache\n for fn in get_hooks("clear_cache"):\n File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 832, in get_hooks\n hooks = _dict(cache().get_value("app_hooks", load_app_hooks))\n File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 72, in get_value\n val = generator()\n File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 810, in load_app_hooks\n for app in [app_name] if app_name else get_installed_apps(sort=True):\n File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 774, in get_installed_apps\n installed = json.loads(db.get_global("installed_apps") or "[]")\n File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 719, in get_global\n return self.get_default(key, user)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 731, in get_default\n d = self.get_defaults(key, parent)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 737, in get_defaults\n defaults = frappe.defaults.get_defaults(parent)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 57, in get_defaults\n globald = get_defaults_for()\n File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 177, in get_defaults_for\n where parent = %s order by creation""", (parent,), as_dict=1)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 166, in sql\n self._cursor.execute(query, values)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 165, in execute\n result = self._query(query)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 321, in _query\n conn.query(q)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 860, in query\n self._affected_rows = self._read_query_result(unbuffered=unbuffered)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1061, in _read_query_result\n result.read()\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1349, in read\n first_packet = self.connection._read_packet()\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1018, in _read_packet\n packet.check_error()\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 384, in check_error\n err.raise_mysql_exception(self._data)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py", line 107, in raise_mysql_exception\n raise errorclass(errno, errval)\npymysql.err.ProgrammingError: (1146, u"Table ‘1bd3e0294da19198.tabDefaultValue’ doesn’t exist")”, “stderr_lines”: [“Traceback (most recent call last):”, " File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main", " "main", fname, loader, pkg_name)“, " File "/usr/lib/python2.7/runpy.py", line 72, in _run_code”, " exec code in run_globals", " File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in “, " main()”, " File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main", " click.Group(commands=commands)(prog_name=‘bench’)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in call”, " return self.main(*args, **kwargs)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main”, " rv = self.invoke(ctx)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke”, " return _process_result(sub_ctx.command.invoke(sub_ctx))“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke”, " return _process_result(sub_ctx.command.invoke(sub_ctx))“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke”, " return ctx.invoke(self.callback, **ctx.params)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke”, " return callback(*args, **kwargs)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func”, " return f(get_current_context(), *args, **kwargs)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py", line 24, in _func”, " ret = f(frappe._dict(ctx.obj), *args, **kwargs)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 165, in install_app”, " _install_app(app, verbose=context.verbose)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 109, in install_app”, " frappe.clear_cache()“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 516, in clear_cache”, " for fn in get_hooks("clear_cache"):“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 832, in get_hooks”, " hooks = _dict(cache().get_value("app_hooks", load_app_hooks))“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 72, in get_value”, " val = generator()“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 810, in load_app_hooks”, " for app in [app_name] if app_name else get_installed_apps(sort=True):“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/init.py", line 774, in get_installed_apps”, " installed = json.loads(db.get_global("installed_apps") or "[]")“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 719, in get_global”, " return self.get_default(key, user)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 731, in get_default”, " d = self.get_defaults(key, parent)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 737, in get_defaults”, " defaults = frappe.defaults.get_defaults(parent)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 57, in get_defaults”, " globald = get_defaults_for()“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 177, in get_defaults_for”, " where parent = %s order by creation""", (parent,), as_dict=1)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 166, in sql”, " self._cursor.execute(query, values)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 165, in execute”, " result = self._query(query)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py", line 321, in _query”, " conn.query(q)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 860, in query”, " self._affected_rows = self._read_query_result(unbuffered=unbuffered)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1061, in _read_query_result”, " result.read()“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1349, in read”, " first_packet = self.connection._read_packet()“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1018, in _read_packet”, " packet.check_error()“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 384, in check_error”, " err.raise_mysql_exception(self._data)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py", line 107, in raise_mysql_exception”, " raise errorclass(errno, errval)", “pymysql.err.ProgrammingError: (1146, u"Table ‘1bd3e0294da19198.tabDefaultValue’ doesn’t exist")”], “stdout”: “”, “stdout_lines”: []}
to retry, use: --limit @/tmp/.bench/playbooks/production/install.retry

PLAY RECAP *************************************************************************************************************************************************************
localhost : ok=64 changed=9 unreachable=0 failed=1

Try to reinstall like this:

cd /home/frappe/frappe-bench
bench reinstall

This will clean up database and start site creation and database creation from beginning. v10 installation works ok for me. The only error i faced was related to mysql.sock.

From the error you posted it looks like it is complaining for erpnext app install. Try the reinstall process above and let me know if it helped.

@fnrfarid , I did successfully installed regarding the solution above. I’ve faced the same issue that unable to log in. You just need to do “bench update” after everything was done.

I don’t think “bench reinstall” is a valid command.

I did succeed first time. Then I couldn’t log in. So I’m trying to install on another server. And, as for the old one, in which I can’t login, trying bench update (Maybe I tried already, still trying again). Will let you know what happens.

Nah, this isn’t working either. Still the same.And for some unknown reason, my server, this one is damn slow. Still that verifying stage and nothings going ahead from there.

Hi, It actually exists if you use latest bench version. Here is --help output from my installation:

frappe@ubuntu:~/frappe-bench$ bench --help
Usage:  [OPTIONS] COMMAND [ARGS]...

  Bench manager for Frappe

Options:
  --version
  --help     Show this message and exit.

Commands:
  backup                 backup site
  backup-all-sites       backup all sites
  config                 change bench configuration
  disable-production     Disables production environment for the...
  download-translations  Download latest translations
  get-app                clone an app from the internet and set it up...
  init                   Create a new bench
  install                Install system dependancies
  new-app                start a new app
  new-site               Create a new site in the bench
  prepare-staging        Prepare staging branch from develop branch
  release                Release app (internal to the Frappe team)
  remote-reset-url       Reset app remote url to frappe official
  remote-set-url         Set app remote url
  remote-urls            Show apps remote url
  remove-app             completely remove app from bench
  renew-lets-encrypt     Renew Let's Encrypt certificate
  restart                Restart supervisor processes
  retry-upgrade
  set-default-site       Set default site for bench
  set-mariadb-host       Set MariaDB host for bench
  set-nginx-port         Set nginx port for site
  set-ssl-certificate    Set ssl certificate path for site
  set-ssl-key            Set ssl certificate private key path for site
  set-url-root           Set url root for site
  setup                  Setup bench
  shell
  src                    Prints bench source folder path, which can be...
  start                  Start Frappe development processes
  switch-to-branch       Switch all apps to specified branch, or...
  switch-to-develop      Switch frappe and erpnext to develop branch
  switch-to-master       Switch frappe and erpnext to master branch
  update                 Update bench
()
Framework commands:

  add-system-manager          Add a new system manager to a site
  add-to-email-queue          Add an email to the Email Queue
  backup                      Backup
  build                       Minify + concatenate JS and CSS files, build...
  build-docs                  Setup docs in target folder of target app
  build-message-files         Build message files for translation
  bulk-rename                 Rename multiple records via CSV file
  clear-cache                 Clear cache, doctype cache and defaults
  clear-limits                Clears given limit from the site config, and...
  clear-website-cache         Clear website cache
  console                     Start ipython console for a site
  destroy-all-sessions        Clear sessions of all users (logs them out)
  disable-scheduler           Disable scheduler
  disable-user
  doctor                      Get diagnostic info about background workers
  drop-site
  enable-scheduler            Enable scheduler
  execute                     Execute a function
  export-csv                  Export data import template with data for...
  export-doc                  Export a single document to csv
  export-fixtures             Export fixtures
  export-json                 Export doclist as json to the given path, use...
  get-untranslated            Get untranslated strings for language
  import-csv                  Import CSV using data import
  import-doc                  Import (insert/update) doclist.
  import-translations         Update translated strings
  install-app                 Install a new app to site
  list-apps                   List apps in site
  make-app                    Creates a boilerplate app
  make-demo                   Reinstall site and setup demo
  migrate                     Run patches, sync schema and rebuild...
  mysql                       Start Mariadb console for a site
  new-language                Create lang-code.csv for given app
  new-site                    Create a new site
  publish-realtime            Publish realtime event from bench
  purge-jobs                  Purge any pending periodic tasks, if event...
  ready-for-migration
  rebuild-global-search       Setup help table in the current site (called...
  reinstall                   Reinstall site ie.
  reload-doc                  Reload schema for a DocType
  reload-doctype              Reload schema for a DocType
  remove-from-installed-apps  Remove app from site's installed-apps list
  request                     Run a request as an admin
  reset-perms                 Reset permissions for all doctypes
  restore                     Restore site database from an sql file
  run-patch                   Run a particular patch
  run-setup-wizard-ui-test    Run setup wizard UI test
  run-tests                   Run tests
  run-ui-tests                Run UI tests
  schedule
  scheduler
  serve                       Start development web server
  set-admin-password          Set Administrator password for a site
  set-config                  Insert/Update a value in site_config.json
  set-last-active-for-user    Set users last active date to current...
  set-limit                   Sets user / space / email limit for a site
  set-limits
  set-maintenance-mode
  setup-global-help           setup help table in a separate database that...
  setup-help                  Setup help table in the current site (called...
  show-pending-jobs           Get diagnostic info about background jobs
  trigger-scheduler-event     Trigger a scheduler event
  uninstall-app               Remove app and linked modules from site
  update-translations         Update translated strings
  use                         Set a default site
  version                     Show the versions of all the installed apps
  watch                       Watch and concatenate JS and CSS files as and...
  worker

Well, reinstalled my site; bench update; reinstalled erpnext app. But can’t load my site.

Anyway, guys thanks. I will keep trying. Thanks for all the help. Really appreciate it.