[SOLVED] Update Error after corrupted DB / powerloss during drop-site

Hi all,

Yesterday I wanted to drop a site from my Testserver (Laptop) unfortunately my Dog unplugged the Powercord during that procedure.
Hence the drop-site process got interrupted.
No I cant Drop the site nor update bench… following is thrown

bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe
 * branch                master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
Updating node packages...
INFO:bench.utils:npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN frappe@ No description
Backing up sites...
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 <module>
    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 294, in backup
    odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, backup_path_private_files=backup_path_private_files, force=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py", line 166, in scheduled_backup
    odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, force=force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py", line 176, in new_backup
    odb.get_backup(older_than, ignore_files, force=force)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py", line 48, in get_backup
    self.set_backup_file_name()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py", line 63, in set_backup_file_name
    todays_date = now_datetime().strftime('%Y%m%d_%H%M%S')
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/data.py", line 122, in now_datetime
    dt = convert_utc_to_user_timezone(datetime.datetime.utcnow())
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/data.py", line 145, in convert_utc_to_user_timezone
    return utcnow.astimezone(timezone(get_time_zone()))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/data.py", line 139, in get_time_zone
    return frappe.cache().get_value("time_zone", _get_time_zone)
  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/utils/data.py", line 133, in _get_time_zone
    return frappe.db.get_system_setting('time_zone') or 'Asia/Kolkata'
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 879, in get_system_setting
    return frappe.cache().get_value("system_settings", _load_system_settings).get(key)
  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/database.py", line 878, in _load_system_settings
    return self.get_singles_dict("System Settings")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 559, in get_singles_dict
    tabSingles where doctype=%s""", doctype))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 136, in sql
    self.connect()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 86, in connect
    charset='utf8mb4', use_unicode = True, conv = conversions)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 699, in __init__
    self.connect()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 936, in connect
    self._request_authentication()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 1156, in _request_authentication
    auth_packet = self._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.OperationalError: (1045, u"Access denied for user '61365c1dbad302df'@'localhost' (using password: YES)")

How can I finally drop that site manually so Bench does not fail wanting to back it up?
I know that is somehow possible with the SQL console but I do not know how

please help

thanks

figured it out - I hope!

since the MySQL user still existed but maybe the DB got corrupted I logged into normal mysql console as root

sudo mysql

then I went for

DROP DATABASE SomeDB1inSite.Config;

that resulted as Query OK so there was at least something
then I checked for user to be presen

SELECT User,Host FROM mysql.user;

which gave me

+-----------------------------+--------------+
| User                        | Host         |
+-----------------------------+--------------+
| root                        | 127.0.0.1    |
| root                        | ::1          |
| SomeDBuser2                 | localhost    |
| SomeDBuser3                 | localhost    |
| debian-sys-maint            | localhost    |
| root                        | localhost    |
+-----------------------------+--------------+

So since SomeDB1inSite.Config = SomeDBuser1
that shoud mean the user and its DB are gone

now I moved the specific site folder into the folder archived_sites
just in case I screwed it and need the credentials again

and the performed

bench update

which completed with no errors

hope that was right or at least a way of handleing it!?

so thanks
this can be closed

1 Like