[Bug]: ERROR: Cannot open database: unable to open database file

Open
#2,665 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
44/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go
Domain
backend, databases

Research direction

Start by reading the database initialization path used by step-ca and how it configures the PKCS#11 ESYSDB backend. The report includes Badger recovery logs and database file permissions, but does not identify a source file or test. Reproduce or investigate the database-open failure and add a regression test; done when the reported startup failure is understood and covered.

Written by the indexing model from the issue text.

Description

bug needs triage
Steps to Reproduce

Maybe a few of unpredictable power-off. Step-ca can't start normally after some months.

Your Environment
  • OS - Ubuntu 22.04
  • step-ca Version - Smallstep CA/0000000-dev (linux/amd64) (compiled from the source-code)
Expected Behavior

Can be start normally and loaded the sighed certificate data.

Actual Behavior

Start failed, while the log from start as following:

Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: badger 2026/04/24 13:32:54 INFO: All 1 tables opened in 3ms
Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: badger 2026/04/24 13:32:54 INFO: Replaying file id: 0 at offset: 47489457
Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: badger 2026/04/24 13:32:54 INFO: Replay took: 141.828989ms
Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: ERROR: Cannot open database: unable to open database file
Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: WARNING: ESYSDB backend was not initialized.
Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: ERROR: Neither FAPI nor ESYSDB backends could be initialized.
Apr 24 13:32:54 wcu-dispatcher step-ca[1866040]: error initializing PKCS#11: failed to initialize PKCS#11 library: pkcs11: 0x5: CKR_GENERAL_ERROR
Apr 24 13:32:54 wcu-dispatcher systemd[1]: step-ca.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

And the DB files can be seen as follow:

total 86M
-rw------- 1   28 Apr 24 12:07 KEYREGISTRY
-rw------- 1 9.3M Apr 24 12:07 000054.sst
-rw------- 1 1.1K Apr 24 13:32 MANIFEST
-rw-r--r-- 1    8 Apr 24 13:32 LOCK
-rw------- 1  77M Apr 24 13:32 000000.vlog
Additional Context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Dominant language
Go
Stars
8.9k
Forks
599
Avg merge
21h 20m
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from smallstep/certificates

All issues in smallstep/certificates

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.