[GH-ISSUE #688] Error "Database is locked" during installation with Docker #244

Closed
opened 2026-02-27 08:16:07 +03:00 by kerem · 6 comments
Owner

Originally created by @zkvvoob on GitHub (Sep 16, 2023).
Original GitHub issue: https://github.com/lldap/lldap/issues/688

Hello,

I've just tried to run LLDAP using the sample Docker compose file and the only things I've really changed are the Base DN and the local directory. Every time I try to start the container, it exits with the following log messages:

> Setup permissions..
> Starting lldap..
Loading configuration from /data/lldap_config.toml
Configuration: Configuration {
    ldap_host: "0.0.0.0",
    ldap_port: 3890,
    http_host: "0.0.0.0",
    http_port: 17170,
    jwt_secret: ***SECRET***,
    ldap_base_dn: "dc=xxx,dc=xxx",
    ldap_user_dn: UserId(
        "zkvvoob",
    ),
    ldap_user_email: "zkvvoob@example.com",
    ldap_user_pass: ***SECRET***,
    database_url: "sqlite:///data/users.db?mode=rwc",
    ignored_user_attributes: [],
    ignored_group_attributes: [],
    verbose: true,
    key_file: "/data/private_key",
    key_seed: Some(
        ***SECRET***,
    ),
    smtp_options: MailOptions {
WARNING: A key_seed was given, we will ignore the server_key and generate one from the seed!
        enable_password_reset: false,
        from: None,
        reply_to: None,
        server: "localhost",
        port: 587,
        user: "",
        password: ***SECRET***,
        smtp_encryption: Tls,
        tls_required: None,
    },
    ldaps_options: LdapsOptions {
        enabled: false,
        port: 6360,
        cert_file: "cert.pem",
        key_file: "key.pem",
    },
    http_url: Url {
        scheme: "http",
        cannot_be_a_base: false,
        username: "",
        password: None,
        host: Some(
            Domain(
                "localhost",
            ),
        ),
        port: None,
        path: "/",
        query: None,
        fragment: None,
    },
    server_setup: None,
}
2023-09-16T20:17:32.848383291+00:00  INFO     set_up_server [ 460µs | 77.26% / 100.00% ]
2023-09-16T20:17:32.848420258+00:00  INFO     ┝━ i [info]: Starting LLDAP version 0.5.0
2023-09-16T20:17:32.849254666+00:00  DEBUG    ┕━ get_schema_version [ 105µs | 22.74% ]
2023-09-16T20:17:32.850091140+00:00  DEBUG       ┕━ 🐛 [debug]:  | return: None
2023-09-16T20:17:37.870171003+00:00  ERROR    🚨 [error]: Could not bring up the servers: while creating the tables: Execution Error: error returned from database: (code: 5) database is locked: error returned from database: (code: 5) database is locked
2023-09-16T20:17:37.870224458+00:00  INFO     i [info]: End.

The container is set with UID=1000 and GID=1000, which are the correct ones for my own user, who also owns the mounted directory. In it is the lldap_config.toml file and a users.db file has also appeared, along with users.db-journal.

Running on Debian 12, Docker 24.

Can someone please help me figure out what's wrong with my setup?

Thanks!

Originally created by @zkvvoob on GitHub (Sep 16, 2023). Original GitHub issue: https://github.com/lldap/lldap/issues/688 Hello, I've just tried to run LLDAP using the sample Docker compose file and the only things I've really changed are the Base DN and the local directory. Every time I try to start the container, it exits with the following log messages: ``` > Setup permissions.. > Starting lldap.. Loading configuration from /data/lldap_config.toml Configuration: Configuration { ldap_host: "0.0.0.0", ldap_port: 3890, http_host: "0.0.0.0", http_port: 17170, jwt_secret: ***SECRET***, ldap_base_dn: "dc=xxx,dc=xxx", ldap_user_dn: UserId( "zkvvoob", ), ldap_user_email: "zkvvoob@example.com", ldap_user_pass: ***SECRET***, database_url: "sqlite:///data/users.db?mode=rwc", ignored_user_attributes: [], ignored_group_attributes: [], verbose: true, key_file: "/data/private_key", key_seed: Some( ***SECRET***, ), smtp_options: MailOptions { WARNING: A key_seed was given, we will ignore the server_key and generate one from the seed! enable_password_reset: false, from: None, reply_to: None, server: "localhost", port: 587, user: "", password: ***SECRET***, smtp_encryption: Tls, tls_required: None, }, ldaps_options: LdapsOptions { enabled: false, port: 6360, cert_file: "cert.pem", key_file: "key.pem", }, http_url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some( Domain( "localhost", ), ), port: None, path: "/", query: None, fragment: None, }, server_setup: None, } 2023-09-16T20:17:32.848383291+00:00 INFO set_up_server [ 460µs | 77.26% / 100.00% ] 2023-09-16T20:17:32.848420258+00:00 INFO ┝━ i [info]: Starting LLDAP version 0.5.0 2023-09-16T20:17:32.849254666+00:00 DEBUG ┕━ get_schema_version [ 105µs | 22.74% ] 2023-09-16T20:17:32.850091140+00:00 DEBUG ┕━ 🐛 [debug]: | return: None 2023-09-16T20:17:37.870171003+00:00 ERROR 🚨 [error]: Could not bring up the servers: while creating the tables: Execution Error: error returned from database: (code: 5) database is locked: error returned from database: (code: 5) database is locked 2023-09-16T20:17:37.870224458+00:00 INFO i [info]: End. ``` The container is set with UID=1000 and GID=1000, which are the correct ones for my own user, who also owns the mounted directory. In it is the `lldap_config.toml` file and a `users.db` file has also appeared, along with `users.db-journal`. Running on Debian 12, Docker 24. Can someone please help me figure out what's wrong with my setup? Thanks!
kerem closed this issue 2026-02-27 08:16:07 +03:00
Author
Owner

@nitnelave commented on GitHub (Sep 16, 2023):

Hi! "Database is locked" means that there's already another process accessing it. My guess is that you have 2 LLDAP containers running, both using the same DB file. Unless you have another service using this very specific DB file, but I doubt that :)

<!-- gh-comment-id:1722309628 --> @nitnelave commented on GitHub (Sep 16, 2023): Hi! "Database is locked" means that there's already another process accessing it. My guess is that you have 2 LLDAP containers running, both using the same DB file. Unless you have another service using this very specific DB file, but I doubt that :)
Author
Owner

@zkvvoob commented on GitHub (Sep 16, 2023):

This is a fresh Debian VM, the only other Docker container running on it is Portainer, nothing else.

<!-- gh-comment-id:1722310156 --> @zkvvoob commented on GitHub (Sep 16, 2023): This is a fresh Debian VM, the only other Docker container running on it is Portainer, nothing else.
Author
Owner

@nitnelave commented on GitHub (Sep 16, 2023):

Is the /data folder mounted? Could another process be accessing it from outside the VM? What if you delete the DB?

<!-- gh-comment-id:1722311069 --> @nitnelave commented on GitHub (Sep 16, 2023): Is the /data folder mounted? Could another process be accessing it from outside the VM? What if you delete the DB?
Author
Owner

@zkvvoob commented on GitHub (Sep 16, 2023):

I've tried deleting the db; I've also tried deleting the whole lldap_data folder and creating it manually – the effect is the same.

The mount comes from a TrueNAS VM, if that matters. Could be something there is accessing it...

<!-- gh-comment-id:1722311461 --> @zkvvoob commented on GitHub (Sep 16, 2023): I've tried deleting the db; I've also tried deleting the whole lldap_data folder and creating it manually – the effect is the same. The mount comes from a TrueNAS VM, if that matters. Could be something there is accessing it...
Author
Owner

@nitnelave commented on GitHub (Sep 16, 2023):

You could try lsof to see if any other process has the file open.
And maybe try putting in a local-only folder to see if the mount is the issue?

<!-- gh-comment-id:1722314057 --> @nitnelave commented on GitHub (Sep 16, 2023): You could try `lsof` to see if any other process has the file open. And maybe try putting in a local-only folder to see if the mount is the issue?
Author
Owner

@zkvvoob commented on GitHub (Sep 16, 2023):

Thank you! I resorted to Postgres and LLDAP is running just fine now.

<!-- gh-comment-id:1722314587 --> @zkvvoob commented on GitHub (Sep 16, 2023): Thank you! I resorted to Postgres and LLDAP is running just fine now.
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/lldap-lldap#244
No description provided.