Skip to content

Authentication initialisation failed with database is locked #10506

Description

@gadeynebram

LocalAI version:
v4.5.0 (deb430f)

Environment, CPU architecture, OS, and Version:
Azure Container App with Azure SMB storage (mfsymlinks enabled)

Describe the bug
When setting -e LOCALAI_AUTH=true the following error appears. It is a clean install.

To Reproduce
Set -e LOCALAI_AUTH=true

Expected behavior
The local DB is intialised

Logs
2026-06-25T06:42:18.7732550Z stdout F CPU info:
2026-06-25T06:42:18.7732648Z stdout F model name : AMD EPYC 7V12 64-Core Processor
2026-06-25T06:42:18.7739575Z stdout F flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr rdpru arat umip rdpid
2026-06-25T06:42:18.7758965Z stdout F CPU: AVX found OK
2026-06-25T06:42:18.7773955Z stdout F CPU: AVX2 found OK
2026-06-25T06:42:18.7788265Z stdout F CPU: no AVX512 found
2026-06-25T06:42:18.9308836Z stdout F Jun 25 06:42:18 INFO Using forced capability run file capabilityRunFile="/run/localai/capability" capability="nvidia-cuda-13\n" env=""
2026-06-25T06:42:18.9310216Z stdout F Jun 25 06:42:18 INFO Starting LocalAI threads=8 modelsPath="//models"
2026-06-25T06:42:18.9310297Z stdout F Jun 25 06:42:18 INFO LocalAI version version="v4.5.0 (deb430f)"
2026-06-25T06:42:18.9361217Z stdout F Jun 25 06:42:18 INFO LocalAI Assistant in-memory MCP server initialised tools=27 read_only=false
2026-06-25T06:42:24.0387922Z stdout F Jun 25 06:42:24 ERROR Error running the application error=LocalAI failed to start: failed to initialize auth database: failed to migrate auth tables: database is locked.
2026-06-25T06:42:24.0388130Z stdout F Troubleshooting steps:
2026-06-25T06:42:24.0388373Z stdout F 1. Check that your models directory exists and is accessible: //models
2026-06-25T06:42:24.0388387Z stdout F 2. Verify model config files are valid YAML: 'local-ai util usecase-heuristic '
2026-06-25T06:42:24.0388398Z stdout F 3. Check available disk space and file permissions
2026-06-25T06:42:24.0388407Z stdout F 4. Run with --log-level=debug for more details
2026-06-25T06:42:24.0388417Z stdout F See https://localai.io/basics/troubleshooting/ for more help

Additional context
I've also tried a local run and then a similar error appears but the application does start. I Have the following logs here

CPU info:
model name : Intel(R) Core(TM) Ultra 9 275HX
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni vnmi umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
CPU: AVX found OK
CPU: AVX2 found OK
CPU: no AVX512 found
Jun 25 06:29:16 INFO Using forced capability run file capabilityRunFile="/run/localai/capability" capability="nvidia-cuda-13\n" env=""
Jun 25 06:29:16 INFO Starting LocalAI threads=32 modelsPath="//models"
Jun 25 06:29:16 INFO LocalAI version version="v4.4.3 (4d3d54d)"
Jun 25 06:29:16 INFO LocalAI Assistant in-memory MCP server initialised tools=29 read_only=false
Jun 25 06:29:16 INFO Generated new HMAC secret for API key hashing path="/data/.hmac_secret"
Jun 25 06:29:16 INFO Auth enabled database="/data/database.db"
Jun 25 06:29:16 INFO stats: using auth DB for usage records
Jun 25 06:29:16 INFO stats: fallback user wired local_user_id="290dfc12-019f-4c21-adf3-4070a15477b8"
Jun 25 06:29:16 INFO pii: filter enabled patterns=6 config_path="" persisted_overrides=0
Jun 25 06:29:16 ERROR Failed to create job store for auth DB error=migrating job tables: advisorylock: acquiring lock 105: no such function: pg_advisory_lock
Jun 25 06:29:16 INFO Loaded tasks from persister count=0
Jun 25 06:29:16 INFO Loaded jobs from persister count=0
Jun 25 06:29:16 INFO AgentJobService started retention_days=30
Jun 25 06:29:16 INFO Preloading models path="//models"
Jun 25 06:29:16 INFO core/startup process completed!
Jun 25 06:29:16 INFO LocalAI is started and running address=":8080"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions