<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Docker] Hardcoded pgsql in dbinit.sh and missing dbinit_mariadb.sql template]]></title><description><![CDATA[<p dir="auto">I am deploying NetXMS via Docker using the official deployment-example/compose.yaml from netxms/docker (commit 55e823c), but replacing the built-in PostgreSQL container with an existing MariaDB instance.</p>
<p dir="auto">During the database initialization phase, I encountered two related issues:</p>
<ol>
<li>
<p dir="auto">The server/files/dbinit.sh script has "pgsql" strictly hardcoded (<strong>nxdbmgr init pgsql</strong>), which forces PostgreSQL initialization regardless of the DBDriver configured in <strong>/etc/netxmsd.conf</strong> or environment variables.</p>
</li>
<li>
<p dir="auto">If we manually override /dbinit.sh on <strong>init</strong> container to initialize MariaDB (<strong>nxdbmgr init mariadb</strong>), the process fails because nxdbmgr looks for a specific dbinit_mariadb.sql file in a directory that does not exist in the Docker image.</p>
</li>
</ol>
<p dir="auto"><strong>Environment</strong>:</p>
<ul>
<li>NetXMS Version: 6.1.1 (Build 6.1-452-gc20a8a4247)</li>
<li>Deployment: Docker (using official deployment-example/compose.yaml)</li>
<li>Database: MariaDB 10.11</li>
</ul>
<p dir="auto"><strong>Steps to Reproduce</strong>:</p>
<ol>
<li>Setup the deployment using the example <strong>compose.yml</strong> file, pointing <strong>/etc/netxmsd.conf</strong> to a MariaDB database (<strong>DBDriver = mariadb.ddr</strong>).</li>
<li>Override /dbinit.sh (entrypoint) on <strong>init</strong> container via bind mount to execute <strong>nxdbmgr init mariadb</strong>.</li>
<li>Start the init container.</li>
</ol>
<p dir="auto"><strong>Error Log (when using mariadb driver for init)</strong>:</p>
<pre><code>NetXMS Database Manager Version 6.1.1 Build 6.1-452-gc20a8a4247
Initializing database...
ERROR: Cannot load SQL command file /usr/share/netxms/sql/dbinit_mariadb.sql
Database initialization failed
Unable to determine database syntax
</code></pre>
<p dir="auto"><em>Note: I verified inside the container that the directory /usr/share/netxms does not exist on the NetXMS Server Docker image.</em></p>
<p dir="auto">If I change the <strong>/etc/netxmsd.conf</strong>  to use <strong>mysql</strong> instead (<strong>nxdbmgr init mysql</strong>), the database initializes perfectly, even though I am using a MariaDB container:</p>
<pre><code>NetXMS Database Manager Version 6.1.1 Build 6.1-452-gc20a8a4247
Initializing database...
IMPORTANT: Generated admin password
   Login:    admin
   Password: PaSsWd
Please save this password - it will not be shown again.
You will be required to change it on first login.
Database initialized successfully
</code></pre>
<p dir="auto"><strong>Suggested Fixes</strong>:</p>
<ol>
<li><strong>Dynamic Driver Selection</strong>: Update /dbinit.sh to dynamically read the database driver from a Docker environment variable (e.g., NETXMS_DB_DRIVER) or directly from /etc/netxmsd.conf, falling back to pgsql only if nothing is set. Changing <strong>nxdbmgr init pgsql</strong> to simply <strong>nxdbmgr init</strong> allows the utility to dynamically deduce the driver from <strong>/etc/netxmsd.conf</strong>, as intended by the documentation.</li>
<li><strong>Template Mapping</strong>: Either include the <strong>dbinit_mariadb.sql</strong> template in the image build process or alias the mariadb initialization argument to use the mysql SQL template internally, since the schema structure is identical.</li>
</ol>
]]></description><link>https://forum.netxms.org/topic/8370/docker-hardcoded-pgsql-in-dbinit.sh-and-missing-dbinit_mariadb.sql-template</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 06:22:55 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/8370.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Apr 2026 16:51:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Docker] Hardcoded pgsql in dbinit.sh and missing dbinit_mariadb.sql template on Tue, 05 May 2026 13:48:04 GMT]]></title><description><![CDATA[<p dir="auto">Hello Alex!<br />
Thank you for your fast reply.<br />
The documentation states that there is a specific MariaDB driver and the “netxms-dbdrv-mariadb” package for Debian: <a href="https://www.netxms.org/documentation/adminguide/installation.html#mariadb" rel="nofollow ugc">https://www.netxms.org/documentation/adminguide/installation.html#mariadb</a><br />
So it didn’t exist on the Docker image, and I should use MySQL instead even after DB init? Because DB initialization still fails when using MariaDB as DBDriver on Docker, I think there's some issue where the code is not sharing the same code init template with MySQL for some reason.<br />
Edit: My bad, the fix works as expected; there is a PR that improves the error handling at: <a href="https://github.com/netxms/docker/pull/3" rel="nofollow ugc">https://github.com/netxms/docker/pull/3</a></p>
]]></description><link>https://forum.netxms.org/post/35363</link><guid isPermaLink="true">https://forum.netxms.org/post/35363</guid><dc:creator><![CDATA[cold]]></dc:creator><pubDate>Tue, 05 May 2026 13:48:04 GMT</pubDate></item><item><title><![CDATA[Reply to [Docker] Hardcoded pgsql in dbinit.sh and missing dbinit_mariadb.sql template on Tue, 21 Apr 2026 06:40:16 GMT]]></title><description><![CDATA[<p dir="auto">Hi cold,</p>
<p dir="auto">Thanks for the report. This has been fixed in commit <a href="https://github.com/netxms/docker/commit/4e26775" rel="nofollow ugc">4e26775</a>.</p>
<p dir="auto">The <a href="http://dbinit.sh" rel="nofollow ugc">dbinit.sh</a> script now auto-detects the database driver from the DBDriver setting in netxmsd.conf instead of hardcoding pgsql. If you set DBDriver=mariadb (or mysql) in your netxmsd.conf, the initialization will work automatically.</p>
<p dir="auto">For the second issue — the missing dbinit_mariadb.sql — this is expected behavior. NetXMS uses "mysql" as the umbrella driver name for both MySQL and MariaDB SQL templates. So you should use DBDriver=mariadb in your config (the driver itself handles the connection correctly), but the schema initialization template is shared. With this fix, nxdbmgr init auto-selects the correct template, so you don't need to worry about it.</p>
<p dir="auto">As a bonus, the fix also adds support for TimescaleDB initialization via the NETXMS_PG_TYPE environment variable (set NETXMS_PG_TYPE=tsdb on the init service).</p>
<p dir="auto">The fix will be included in the next Docker image release (already in :latest).</p>
]]></description><link>https://forum.netxms.org/post/35358</link><guid isPermaLink="true">https://forum.netxms.org/post/35358</guid><dc:creator><![CDATA[alk]]></dc:creator><pubDate>Tue, 21 Apr 2026 06:40:16 GMT</pubDate></item></channel></rss>