[GH-ISSUE #880] Question: ...Unable to create the django_migrations table (database is locked) #544

Closed
opened 2026-03-01 14:44:27 +03:00 by kerem · 2 comments
Owner

Originally created by @tunloop on GitHub (Oct 23, 2021).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/880

Can anyone help me with this error?



$ archivebox init --setup

[i] [2021-10-23 03:51:34] ArchiveBox v0.6.2: archivebox init --setup
> /media/WebArchive

[^] Verifying and updating existing ArchiveBox collection to v0.6.2...
----------------------------------------------------------------------

[*] Verifying archive folder structure...
+ ./archive, ./sources, ./logs...
+ ./ArchiveBox.conf...

[*] Verifying main SQL index and running any migrations needed...
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 242, in _commit
return self.connection.commit()
sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/django/db/migrations/recorder.py", line 68, in ensure_schema
editor.create_model(self.Migration)
File "/usr/local/lib/python3.9/dist-packages/django/db/backends/sqlite3/schema.py", line 36, in exit
super().exit(exc_type, exc_value, traceback)
File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/schema.py", line 117, in exit
self.atomic.exit(exc_type, exc_value, traceback)
File "/usr/local/lib/python3.9/dist-packages/django/db/transaction.py", line 232, in exit
connection.commit()
File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 266, in commit
self._commit()
File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 242, in _commit
return self.connection.commit()
File "/usr/local/lib/python3.9/dist-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 242, in _commit
return self.connection.commit()
django.db.utils.OperationalError: database is locked

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/archivebox", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/init.py", line 140, in main
run_subcommand(
File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/init.py", line 80, in run_subcommand
module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore
File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/archivebox_init.py", line 43, in main
init(
File "/usr/local/lib/python3.9/dist-packages/archivebox/util.py", line 114, in typechecked_function
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/archivebox/main.py", line 328, in init
for migration_line in apply_migrations(out_dir):
File "/usr/local/lib/python3.9/dist-packages/archivebox/util.py", line 114, in typechecked_function
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/archivebox/index/sql.py", line 138, in apply_migrations
call_command("migrate", interactive=False, stdout=out)
File "/usr/local/lib/python3.9/dist-packages/django/core/management/init.py", line 168, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python3.9/dist-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.9/dist-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/django/core/management/commands/migrate.py", line 243, in handle
post_migrate_state = executor.migrate(
File "/usr/local/lib/python3.9/dist-packages/django/db/migrations/executor.py", line 91, in migrate
self.recorder.ensure_schema()
File "/usr/local/lib/python3.9/dist-packages/django/db/migrations/recorder.py", line 70, in ensure_schema
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (database is locked)

Originally created by @tunloop on GitHub (Oct 23, 2021). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/880 Can anyone help me with this error? \ \ \ $ archivebox init --setup [i] [2021-10-23 03:51:34] ArchiveBox v0.6.2: archivebox init --setup \> /media/WebArchive [^] Verifying and updating existing ArchiveBox collection to v0.6.2... \---------------------------------------------------------------------- [*] Verifying archive folder structure... + ./archive, ./sources, ./logs... + ./ArchiveBox.conf... [*] Verifying main SQL index and running any migrations needed... Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 242, in _commit return self.connection.commit() sqlite3.OperationalError: database is locked The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/django/db/migrations/recorder.py", line 68, in ensure_schema editor.create_model(self.Migration) File "/usr/local/lib/python3.9/dist-packages/django/db/backends/sqlite3/schema.py", line 36, in __exit__ super().__exit__(exc_type, exc_value, traceback) File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/schema.py", line 117, in __exit__ self.atomic.__exit__(exc_type, exc_value, traceback) File "/usr/local/lib/python3.9/dist-packages/django/db/transaction.py", line 232, in __exit__ connection.commit() File "/usr/local/lib/python3.9/dist-packages/django/utils/asyncio.py", line 26, in inner return func(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 266, in commit self._commit() File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 242, in _commit return self.connection.commit() File "/usr/local/lib/python3.9/dist-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.9/dist-packages/django/db/backends/base/base.py", line 242, in _commit return self.connection.commit() django.db.utils.OperationalError: database is locked During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/bin/archivebox", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/__init__.py", line 140, in main run_subcommand( File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/__init__.py", line 80, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/usr/local/lib/python3.9/dist-packages/archivebox/cli/archivebox_init.py", line 43, in main init( File "/usr/local/lib/python3.9/dist-packages/archivebox/util.py", line 114, in typechecked_function return func(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/archivebox/main.py", line 328, in init for migration_line in apply_migrations(out_dir): File "/usr/local/lib/python3.9/dist-packages/archivebox/util.py", line 114, in typechecked_function return func(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/archivebox/index/sql.py", line 138, in apply_migrations call_command("migrate", interactive=False, stdout=out) File "/usr/local/lib/python3.9/dist-packages/django/core/management/__init__.py", line 168, in call_command return command.execute(*args, **defaults) File "/usr/local/lib/python3.9/dist-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.9/dist-packages/django/core/management/base.py", line 85, in wrapped res = handle_func(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/core/management/commands/migrate.py", line 243, in handle post_migrate_state = executor.migrate( File "/usr/local/lib/python3.9/dist-packages/django/db/migrations/executor.py", line 91, in migrate self.recorder.ensure_schema() File "/usr/local/lib/python3.9/dist-packages/django/db/migrations/recorder.py", line 70, in ensure_schema raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc) django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (database is locked)
kerem closed this issue 2026-03-01 14:44:27 +03:00
Author
Owner

@tunloop commented on GitHub (Oct 23, 2021):

Disregard, solved the problem by adding nobrl option to cifs smb mount

<!-- gh-comment-id:950053276 --> @tunloop commented on GitHub (Oct 23, 2021): Disregard, solved the problem by adding nobrl option to cifs smb mount
Author
Owner

@pirate commented on GitHub (Apr 12, 2022):

Note I've added a new DB/filesystem troubleshooting area to the wiki that may help people arriving here from Google: https://github.com/ArchiveBox/ArchiveBox/wiki/Upgrading-or-Merging-Archives#database-troubleshooting

Contributions/suggestions welcome there.

<!-- gh-comment-id:1097264469 --> @pirate commented on GitHub (Apr 12, 2022): Note I've added a new DB/filesystem troubleshooting area to the wiki that may help people arriving here from Google: https://github.com/ArchiveBox/ArchiveBox/wiki/Upgrading-or-Merging-Archives#database-troubleshooting Contributions/suggestions welcome there.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#544
No description provided.