odbcinst-generate - Man Page
regenerate /etc/odbcinst.ini from drop-in snippets
Synopsis
odbcinst-generate
Description
odbcinst-generate assembles /etc/odbcinst.ini from drop-in snippet files shipped by ODBC driver packages and administrator overrides. It is normally invoked automatically by RPM file triggers when driver packages are installed or removed. Administrators may also run it manually after editing drop-in files.
The generated file is replaced atomically (write to a temporary file, then rename). The command is idempotent and safe to run at any time.
Drop-in Directories
- /usr/lib/odbc/odbcinst.d/
Vendor defaults. ODBC driver packages ship static .ini snippet files here. These files are never modified by the administrator.
- /etc/odbc/odbcinst.d/
Administrator overrides and additions. Files placed here take precedence over vendor defaults.
File Naming
Snippet files are named NN-name.ini, where NN is a two-digit numeric prefix that controls merge order.
Recommended ranges:
- 10–29
Distro vendor (Fedora-shipped driver packages).
- 30–49
Third-party / out-of-tree (COPR packages, vendor RPMs such as SeerODBC, Oracle Instant Client, etc.).
- 50–99
Administrator overrides and additions.
The numeric prefix controls tie-breaking within a single directory (see Override Semantics). It does not affect output order; output sections are sorted alphabetically by the stripped name.
Override Semantics
Files from both directories are merged using stripped-name matching: the numeric prefix is removed from each filename (10-mariadb.ini becomes mariadb.ini), and files that share the same stripped name compete. Only one file per stripped name survives; the rest are discarded.
Tie-breaking follows two rules, applied in order:
- Directory wins. A file in the administrator directory (/etc/odbc/odbcinst.d/) always takes precedence over a file with the same stripped name in the vendor directory (/usr/lib/odbc/odbcinst.d/), regardless of numeric prefix.
- Higher prefix wins. Within the same directory, the file with the higher numeric prefix wins. For example, 30-mariadb.ini overrides 10-mariadb.ini when both reside in the vendor directory.
After tie-breaking, the surviving snippets are sorted alphabetically by their stripped name and concatenated to produce the output file.
Disabling a Driver
To disable a vendor-shipped driver, create a symlink to /dev/null in the administrator directory:
ln -sf /dev/null /etc/odbc/odbcinst.d/10-freetds.ini odbcinst-generate
Symlinks pointing to /dev/null are detected and skipped during regeneration.
Path Resolution
Snippet files should use bare library names for the Driver (and Setup) keys:
Driver = libmaodbc.so
During generation, odbcinst-generate resolves each bare name to an absolute, architecture-correct path by probing the filesystem per-driver. For each bare .so name, it checks both /usr/lib64/odbc/ and /usr/lib/odbc/.
Multilib resolution
On a multilib system where both the 64-bit and 32-bit packages of a driver are installed (e.g. mariadb-connector-odbc.x86_64 and mariadb-connector-odbc.i686), the generator emits two keys:
Driver = /usr/lib/odbc/libmaodbc.so Driver64 = /usr/lib64/odbc/libmaodbc.so
unixODBC selects the matching key based on the calling application's word size: a 64-bit application reads Driver64, a 32-bit application (e.g. Wine) reads Driver. The same logic applies to Setup/Setup64.
When only one architecture is present, only Driver is emitted with that architecture's path. If the bare name is not found in either directory, it is left unchanged so that unixODBC can still locate it via its compiled-in driver search path.
Edge cases
- A 32-bit-only driver on a 64-bit host is correctly resolved to /usr/lib/odbc/ instead of /usr/lib64/odbc/.
- A third-party driver whose shared library lives outside /usr/lib*/odbc/ (e.g. in /usr/lib64/) is not rewritten to a non-existent path.
- iODBC does not recognize the Driver64 key, but ignores unknown keys harmlessly. On iODBC-only hosts, the Driver key provides the correct path.
Absolute paths ensure the generated odbcinst.ini works with all ODBC driver managers (both unixODBC and iODBC) without hard-coding architecture directories. Using bare names in snippets keeps them noarch-portable: the same .ini file works on x86_64, aarch64, ppc64le, etc., because the generator handles path differences at generation time.
File Conflicts
Each snippet filename must be unique within its directory. If two RPM packages ship the same file (e.g. both install 30-oracle.ini), RPM will raise a file conflict and refuse to install both.
Third-party packagers should choose unique names that include the driver's identity, for example:
30-seerodbc.ini 31-oracle-instantclient.ini 32-snowflake.ini
Output File
- /etc/odbcinst.ini
The generated ODBC driver configuration file. This file is marked as %ghost in the RPM package and should not be edited directly. Changes will be overwritten on the next regeneration.
Exit Status
- 0
Success.
- >0
An error occurred (e.g. unable to write the output file).
Examples
Adding an administrator driver
Create a snippet with a bare library name and regenerate:
cat > /etc/odbc/odbcinst.d/60-mydriver.ini << 'EOF' [MyDriver] Driver = libmydriver.so EOF odbcinst-generate
If libmydriver.so exists only in /usr/lib64/odbc/, the generated /etc/odbcinst.ini will contain the resolved absolute path:
[MyDriver] Driver = /usr/lib64/odbc/libmydriver.so
If both 64-bit and 32-bit versions are installed, the output contains both keys:
[MyDriver] Driver = /usr/lib/odbc/libmydriver.so Driver64 = /usr/lib64/odbc/libmydriver.so
If the library is not found in /usr/lib*/odbc/ (e.g. it is installed in /usr/lib64/), the bare name is kept as-is.
Vendor snippet (distro-shipped)
A Fedora driver package installs a snippet in the vendor directory:
# Shipped as /usr/lib/odbc/odbcinst.d/10-mariadb.ini [MariaDB] Driver = libmaodbc.so
Overriding a vendor snippet
An administrator can override the MariaDB driver configuration without modifying the vendor file:
cat > /etc/odbc/odbcinst.d/50-mariadb.ini << 'EOF' [MariaDB] Driver = libmaodbc.so Threading = 2 EOF odbcinst-generate
The administrator file wins because the admin directory always takes precedence over the vendor directory for the same stripped name.
Notes
Comparison with other Fedora drop-in systems
Several Fedora packages use a similar dual-directory drop-in pattern: sysctl.d(5), tmpfiles.d(5), modprobe.d(5), and systemd.unit(5). Those systems use exact filename matching for overrides: /etc/sysctl.d/10-foo.conf masks /usr/lib/sysctl.d/10-foo.conf (same filename), but /etc/sysctl.d/60-foo.conf and /usr/lib/sysctl.d/10-foo.conf coexist as two separate files, with conflicting keys resolved individually by lexicographic sort order.
That model works for key-value configurations where individual settings can be overridden independently. ODBC driver registration is structurally different: each snippet declares a complete [DriverName] INI section, and merging individual keys from two [MariaDB] sections across files would be ambiguous and error-prone. The entire section is the atomic unit.
odbcinst-generate therefore uses stripped-name matching instead: files that share the same name after removing the numeric prefix compete, and only one survives (see Override Semantics). The administrator directory always wins for the same stripped name, regardless of numeric prefix. This is a deliberate deviation from the sysctl.d/tmpfiles.d model, chosen because INI section overrides must be whole-section replacements.
Numeric range convention
sysctl.d(5) documents ranges 10–40 for vendor packages and 60–90 for local administration. This system adds a third-party band (30–49) because out-of-tree ODBC drivers (COPR packages, vendor RPMs, third-party connectors) are a common use case that does not fit the distro vendor or administrator categories. See File Naming for the full range table.
Authors
Michal Schorm <mschorm@redhat.com>
Copyright
Copyright © 2026 Michal Schorm.
Licensed under the GNU General Public License, version 2 or later.
See Also
odbcinst(1), odbcinst.ini(5), odbc.ini(5), unixODBC(7), sysctl.d(5), tmpfiles.d(5)