{"record":{"id":"475905fcb631214e","repo":"louislam/uptime-kuma","slug":"embedded-mariadb-supports-only-node-or-root-us","errorCode":null,"errorMessage":"Embedded Mariadb supports only 'node' or 'root' user, but the current user is: ${this.username}","messagePattern":"Embedded Mariadb supports only 'node' or 'root' user, but the current user is: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/embedded-mariadb.js","lineNumber":61,"sourceCode":"    }\n\n    /**\n     * @returns {boolean} If the singleton instance is created\n     */\n    static hasInstance() {\n        return !!EmbeddedMariaDB.instance;\n    }\n\n    /**\n     * Start the embedded MariaDB\n     * @throws {Error} If the current user is not \"node\" or \"root\"\n     * @returns {Promise<void>|void} A promise that resolves when the MariaDB is started or void if it is already started\n     */\n    start() {\n        // Check if the current user is \"node\" or \"root\"\n        this.username = require(\"os\").userInfo().username;\n        if (this.username !== \"node\" && this.username !== \"root\") {\n            throw new Error(\n                \"Embedded Mariadb supports only 'node' or 'root' user, but the current user is: \" + this.username\n            );\n        }\n\n        this.initDB();\n\n        this.startChildProcess();\n\n        return new Promise((resolve) => {\n            let interval = setInterval(() => {\n                if (this.started) {\n                    clearInterval(interval);\n                    resolve();\n                } else {\n                    log.info(\"mariadb\", \"Waiting for Embedded MariaDB to start...\");\n                }\n            }, 1000);\n        });","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/embedded-mariadb.js#L43-L79","documentation":"EmbeddedMariaDB.start() reads os.userInfo().username and only allows 'node' or 'root'. The embedded mariadbd child is spawned with --user=node and writes under /app/data, so any other OS user would either fail the daemon's privilege drop or produce files with the wrong owner. The class doc comment says explicitly 'It is only used inside the docker container', and the official image runs as the node user.","triggerScenarios":"Running Uptime Kuma outside the official Docker image (e.g. as your own user on bare metal, under systemd as 'kuma', inside a modified container that switched USER) and selecting db-config type 'embedded-mariadb'. The check fires before any mariadbd subprocess is spawned.","commonSituations":"Custom Docker images that override USER; Podman/rootless deployments where the mapped user is neither node nor root; dev environments running `npm run start:dev` as the developer's account with a hand-edited db-config.json.","solutions":["Use the official Docker image, which runs as the node user — embedded-mariadb works there out of the box.","If you must run another way, either run the process as root (not recommended) or rename your runtime user to 'node' so the check passes.","For bare-metal/non-Docker, prefer external MariaDB (type 'mariadb') or SQLite instead of 'embedded-mariadb' — the embedded build is intentionally container-only.","If building a custom image, ensure `USER node` (or root) is set before the entrypoint."],"exampleFix":"# before — custom Dockerfile that overrides the user\nUSER mykuma\n\n# after — keep the user the embedded mariadbd expects\nUSER node","handlingStrategy":"validation","validationCode":"// Detect the unsupported-user condition before EmbeddedMariaDB.start()\nconst os = require(\"os\");\nfunction assertEmbeddedMariadbUser() {\n    const u = os.userInfo().username;\n    if (u !== \"node\" && u !== \"root\") {\n        throw new Error(`embedded-mariadb requires user 'node' or 'root', running as '${u}'`);\n    }\n}","typeGuard":"function canRunEmbeddedMariaDB() {\n    const u = require(\"os\").userInfo().username;\n    return u === \"node\" || u === \"root\";\n}","tryCatchPattern":"try {\n    await embeddedMariaDB.start();\n} catch (e) {\n    if (/supports only 'node' or 'root' user/.test(e.message)) {\n        // switch to sqlite or external mariadb, or run inside the official image\n    }\n    throw e;\n}","preventionTips":["Run the official Docker image when you want embedded MariaDB.","Do not override USER in derived images without setting it to node or root.","For bare metal, choose type 'sqlite' or an external 'mariadb'."],"tags":["mariadb","docker","startup","permissions"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}