Compare commits

..
Author SHA1 Message Date
Alexandre db21860d29 Merge pull request #2693 from alexbelgium/claude/fix-issue-2688-qMcA7
fix: force IPv4 host resolution for MariaDB addon connections (#2688)
2026-05-10 07:34:16 +03:00
AlexandreandCopilot Autofix powered by AI c160bd46b7 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-10 07:17:06 +03:00
Claude f19d668d07 fix: force IPv4 host resolution for MariaDB addon connections (#2688)
On HAOS >=17.3 the Supervisor Docker network gained IPv6, so
core-mariadb resolves to an IPv6 address first. The official MariaDB
addon only grants its service user from the IPv4 supervisor subnet, so
connections from IPv6 fail with "Access denied".

Resolve the hostname to its IPv4 address before connecting in every
addon that consumes bashio::services 'mysql' 'host': photoprism,
monica, fireflyiii, seafile, zoneminder. Fall back to the raw hostname
if resolution fails so IPv4-only setups keep working unchanged.
2026-05-10 04:01:52 +00:00
10 changed files with 61 additions and 60 deletions

No files matched your search

+1 -2
View File
@@ -1,7 +1,6 @@
## 6.6.2-1 (2026-05-10) ## 6.6.2-1 (2026-05-10)
- Fix MariaDB connection on HAOS >=17.3 by forcing IPv4 host resolution (#2688)
- Fix: Force IPv4 for MariaDB connections to resolve access denied errors after HAOS 17.3 (IPv6 networking change)
## 6.6.2 (2026-05-02) ## 6.6.2 (2026-05-02)
- Update to latest version from firefly-iii/firefly-iii (changelog : https://github.com/firefly-iii/firefly-iii/releases) - Update to latest version from firefly-iii/firefly-iii (changelog : https://github.com/firefly-iii/firefly-iii/releases)
+10 -7
View File
@@ -86,17 +86,20 @@ case $(bashio::config 'DB_CONNECTION') in
"Please ensure it is installed and started" "Please ensure it is installed and started"
fi fi
# Resolve MariaDB hostname to IPv4: on HAOS >=17.3 the Supervisor network
# gained IPv6, but the MariaDB addon only grants its user from the IPv4
# subnet (issue #2688). Fall back to the raw hostname if resolution fails.
mariadb_host_raw="$(bashio::services "mysql" "host")"
mariadb_host_ipv4="$(getent ahostsv4 "$mariadb_host_raw" 2> /dev/null | awk '{print $1; exit}')"
DB_HOST="${mariadb_host_ipv4:-$mariadb_host_raw}"
if [ "$DB_HOST" != "$mariadb_host_raw" ]; then
bashio::log.info "Resolved ${mariadb_host_raw} -> ${DB_HOST} (forcing IPv4)"
fi
# Use values # Use values
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=$(bashio::services "mysql" "host")
DB_PORT=$(bashio::services "mysql" "port") DB_PORT=$(bashio::services "mysql" "port")
# Force IPv4 to avoid access denied errors when the container network uses IPv6 (HAOS 17.3+)
if DB_HOST_V4=$(getent ahostsv4 "$DB_HOST" 2>/dev/null | awk 'NR==1{print $1}') && [ -n "$DB_HOST_V4" ]; then
bashio::log.info "Resolved MariaDB host to IPv4: $DB_HOST_V4"
DB_HOST="$DB_HOST_V4"
fi
# Always fetch service discovery credentials for bootstrap operations (CREATE DATABASE) # Always fetch service discovery credentials for bootstrap operations (CREATE DATABASE)
BOOTSTRAP_USERNAME=$(bashio::services "mysql" "username") BOOTSTRAP_USERNAME=$(bashio::services "mysql" "username")
BOOTSTRAP_PASSWORD=$(bashio::services "mysql" "password") BOOTSTRAP_PASSWORD=$(bashio::services "mysql" "password")
+1 -1
View File
@@ -1,5 +1,5 @@
## 5.0.0b5-3 (2026-05-10) ## 5.0.0b5-3 (2026-05-10)
- Fix: Force IPv4 for MariaDB connections to resolve access denied errors after HAOS 17.3 (IPv6 networking change) - Fix MariaDB connection on HAOS >=17.3 by forcing IPv4 host resolution (#2688)
## 5.0.0b5-2 (26-02-2026) ## 5.0.0b5-2 (26-02-2026)
- Minor bugs fixed - Minor bugs fixed
+11 -8
View File
@@ -45,15 +45,18 @@ case "$database" in
bashio::exit.nok "Please ensure it is installed and started" bashio::exit.nok "Please ensure it is installed and started"
fi fi
# Use values # Resolve MariaDB hostname to IPv4: on HAOS >=17.3 the Supervisor network
DB_HOST=$(bashio::services "mysql" "host") # gained IPv6, but the MariaDB addon only grants its user from the IPv4
# Force IPv4 to avoid access denied errors when the container network uses IPv6 (HAOS 17.3+) # subnet (issue #2688). Fall back to the raw hostname if resolution fails.
if DB_HOST_V4=$(getent ahostsv4 "$DB_HOST" 2>/dev/null | awk 'NR==1{print $1}') && [ -n "$DB_HOST_V4" ]; then mariadb_host_raw="$(bashio::services "mysql" "host")"
bashio::log.info "Resolved MariaDB host to IPv4: $DB_HOST_V4" mariadb_host_ipv4="$(getent ahostsv4 "$mariadb_host_raw" 2> /dev/null | awk '{print $1; exit}')"
DB_HOST="$DB_HOST_V4" DB_HOST="${mariadb_host_ipv4:-$mariadb_host_raw}"
if [ "$DB_HOST" != "$mariadb_host_raw" ]; then
bashio::log.info "Resolved ${mariadb_host_raw} -> ${DB_HOST} (forcing IPv4)"
fi fi
bashio::log.blue "DB_HOST=$DB_HOST"
sed -i "1a export DB_HOST=$DB_HOST" /usr/local/bin/entrypoint.sh # Use values
bashio::log.blue "DB_HOST=$DB_HOST" && sed -i "1a export DB_HOST=$DB_HOST" /usr/local/bin/entrypoint.sh
DB_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "DB_PORT=$DB_PORT" && sed -i "1a export DB_PORT=$DB_PORT" /usr/local/bin/entrypoint.sh DB_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "DB_PORT=$DB_PORT" && sed -i "1a export DB_PORT=$DB_PORT" /usr/local/bin/entrypoint.sh
DB_DATABASE=monica && bashio::log.blue "DB_DATABASE=$DB_DATABASE" && sed -i "1a export DB_DATABASE=$DB_DATABASE" /usr/local/bin/entrypoint.sh DB_DATABASE=monica && bashio::log.blue "DB_DATABASE=$DB_DATABASE" && sed -i "1a export DB_DATABASE=$DB_DATABASE" /usr/local/bin/entrypoint.sh
DB_USERNAME=$(bashio::services "mysql" "username") && bashio::log.blue "DB_USERNAME=$DB_USERNAME" && sed -i "1a export DB_USERNAME=$DB_USERNAME" /usr/local/bin/entrypoint.sh DB_USERNAME=$(bashio::services "mysql" "username") && bashio::log.blue "DB_USERNAME=$DB_USERNAME" && sed -i "1a export DB_USERNAME=$DB_USERNAME" /usr/local/bin/entrypoint.sh
+1 -2
View File
@@ -1,7 +1,6 @@
## ubuntu-2026-03-05-1 (2026-05-10) ## ubuntu-2026-03-05-1 (2026-05-10)
- Fix MariaDB connection on HAOS >=17.3 by forcing IPv4 host resolution (#2688)
- Fix: Force IPv4 for MariaDB connections to resolve access denied errors after HAOS 17.3 (IPv6 networking change)
## ubuntu-2026-03-05 (2026-03-05) ## ubuntu-2026-03-05 (2026-03-05)
- Update to latest version from photoprism/photoprism - Update to latest version from photoprism/photoprism
+14 -23
View File
@@ -28,29 +28,20 @@ case $(bashio::config 'DB_TYPE') in
# Install mysqlclient # Install mysqlclient
pip install pymysql &> /dev/null || true pip install pymysql &> /dev/null || true
# Resolve MariaDB hostname to IPv4: on HAOS >=17.3 the Supervisor network
# gained IPv6, but the MariaDB addon only grants its user from the IPv4
# subnet (issue #2688). Fall back to the raw hostname if resolution fails.
mariadb_host_raw="$(bashio::services 'mysql' 'host')"
mariadb_host_ipv4="$(getent ahostsv4 "$mariadb_host_raw" 2> /dev/null | awk '{print $1; exit}')"
mariadb_host="${mariadb_host_ipv4:-$mariadb_host_raw}"
if [ "$mariadb_host" != "$mariadb_host_raw" ]; then
bashio::log.info "Resolved ${mariadb_host_raw} -> ${mariadb_host} (forcing IPv4)"
fi
mariadb_port="$(bashio::services 'mysql' 'port')"
# Use values # Use values
PHOTOPRISM_DATABASE_DRIVER="mysql" PHOTOPRISM_DATABASE_DRIVER="mysql"
MYSQL_HOST="$(bashio::services 'mysql' 'host')" PHOTOPRISM_DATABASE_SERVER="${mariadb_host}:${mariadb_port}"
MYSQL_PORT="$(bashio::services 'mysql' 'port')"
# Force IPv4 to avoid access denied errors when the container network uses IPv6 (HAOS 17.3+)
MYSQL_HOST_V4=""
if command -v getent >/dev/null 2>&1; then
MYSQL_HOST_V4="$(getent ahostsv4 "$MYSQL_HOST" 2>/dev/null | awk 'NR==1{print $1}')"
elif command -v nslookup >/dev/null 2>&1; then
MYSQL_HOST_V4="$(nslookup "$MYSQL_HOST" 2>/dev/null | awk '/^Address [0-9]+: / { print $3; exit } /^Address: / && $2 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ { print $2; exit }')"
else
bashio::log.warning "Unable to resolve MariaDB host to IPv4: neither getent nor nslookup is available"
fi
if [ -n "$MYSQL_HOST_V4" ]; then
bashio::log.info "Resolved MariaDB host to IPv4: $MYSQL_HOST_V4"
MYSQL_HOST="$MYSQL_HOST_V4"
else
bashio::log.warning "Unable to resolve MariaDB host '$MYSQL_HOST' to IPv4; continuing with hostname"
fi
PHOTOPRISM_DATABASE_SERVER="${MYSQL_HOST}:${MYSQL_PORT}"
PHOTOPRISM_DATABASE_NAME="photoprism" PHOTOPRISM_DATABASE_NAME="photoprism"
PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')" PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')"
PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')" PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')"
@@ -78,9 +69,9 @@ case $(bashio::config 'DB_TYPE') in
bashio::log.warning "Uninstalling the MariaDB addon will remove any data" bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
# Create database # Create database
mysql --skip-ssl --host="$MYSQL_HOST" --port="$MYSQL_PORT" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"CREATE DATABASE IF NOT EXISTS $PHOTOPRISM_DATABASE_NAME;" mysql --skip-ssl --host="${mariadb_host}" --port="${mariadb_port}" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"CREATE DATABASE IF NOT EXISTS $PHOTOPRISM_DATABASE_NAME;"
# Force character set # Force character set
mysql --skip-ssl --host="$MYSQL_HOST" --port="$MYSQL_PORT" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"ALTER DATABASE $PHOTOPRISM_DATABASE_NAME CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;" || true mysql --skip-ssl --host="${mariadb_host}" --port="${mariadb_port}" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"ALTER DATABASE $PHOTOPRISM_DATABASE_NAME CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;" || true
;; ;;
esac esac
+1 -2
View File
@@ -1,7 +1,6 @@
## 12.0.18-3 (2026-05-10) ## 12.0.18-3 (2026-05-10)
- Fix MariaDB connection on HAOS >=17.3 by forcing IPv4 host resolution (#2688)
- Fix: Force IPv4 for MariaDB connections to resolve access denied errors after HAOS 17.3 (IPv6 networking change)
## 12.0.18-2 (2026-02-22) ## 12.0.18-2 (2026-02-22)
- Fix download URLs containing incorrect `/seafhttp` prefix on first run by re-applying URL configuration after upstream init scripts complete. - Fix download URLs containing incorrect `/seafhttp` prefix on first run by re-applying URL configuration after upstream init scripts complete.
+11 -7
View File
@@ -206,14 +206,18 @@ case "${DATABASE_SELECTION}" in
"Please ensure it is installed and started" "Please ensure it is installed and started"
fi fi
# Use values # Resolve MariaDB hostname to IPv4: on HAOS >=17.3 the Supervisor network
MYSQL_HOST="$(bashio::services 'mysql' 'host')" # gained IPv6, but the MariaDB addon only grants its user from the IPv4
# Force IPv4 to avoid access denied errors when the container network uses IPv6 (HAOS 17.3+) # subnet (issue #2688). Fall back to the raw hostname if resolution fails.
if MYSQL_HOST_V4=$(getent ahostsv4 "$MYSQL_HOST" 2>/dev/null | awk 'NR==1{print $1}') && [ -n "$MYSQL_HOST_V4" ]; then mariadb_host_raw="$(bashio::services 'mysql' 'host')"
bashio::log.info "Resolved MariaDB host to IPv4: $MYSQL_HOST_V4" mariadb_host_ipv4="$(getent ahostsv4 "$mariadb_host_raw" 2> /dev/null | awk '{print $1; exit}')"
MYSQL_HOST="$MYSQL_HOST_V4" MYSQL_HOST_RESOLVED="${mariadb_host_ipv4:-$mariadb_host_raw}"
if [ "$MYSQL_HOST_RESOLVED" != "$mariadb_host_raw" ]; then
bashio::log.info "Resolved ${mariadb_host_raw} -> ${MYSQL_HOST_RESOLVED} (forcing IPv4)"
fi fi
export MYSQL_HOST && sed -i "1a export MYSQL_HOST=$MYSQL_HOST" /home/seafile/*.sh
# Use values
export MYSQL_HOST="$MYSQL_HOST_RESOLVED" && sed -i "1a export MYSQL_HOST=${MYSQL_HOST_RESOLVED}" /home/seafile/*.sh
export MYSQL_PORT="$(bashio::services 'mysql' 'port')" && sed -i "1a export MYSQL_PORT=$(bashio::services 'mysql' 'port')" /home/seafile/*.sh export MYSQL_PORT="$(bashio::services 'mysql' 'port')" && sed -i "1a export MYSQL_PORT=$(bashio::services 'mysql' 'port')" /home/seafile/*.sh
export MYSQL_USER="$(bashio::services "mysql" "username")" && sed -i "1a export MYSQL_USER=$(bashio::services 'mysql' 'username')" /home/seafile/*.sh export MYSQL_USER="$(bashio::services "mysql" "username")" && sed -i "1a export MYSQL_USER=$(bashio::services 'mysql' 'username')" /home/seafile/*.sh
export MYSQL_USER_PASSWD="$(bashio::services "mysql" "password")" && sed -i "1a export MYSQL_USER_PASSWD=$(bashio::services 'mysql' 'password')" /home/seafile/*.sh export MYSQL_USER_PASSWD="$(bashio::services "mysql" "password")" && sed -i "1a export MYSQL_USER_PASSWD=$(bashio::services 'mysql' 'password')" /home/seafile/*.sh
+1 -2
View File
@@ -1,7 +1,6 @@
## 1.38.1-1 (2026-05-10) ## 1.38.1-1 (2026-05-10)
- Fix MariaDB connection on HAOS >=17.3 by forcing IPv4 host resolution (#2688)
- Fix: Force IPv4 for MariaDB connections to resolve access denied errors after HAOS 17.3 (IPv6 networking change)
## 1.38.1 (2026-02-21) ## 1.38.1 (2026-02-21)
- Update to latest version from zoneminder-containers/zoneminder-base (changelog : https://github.com/zoneminder-containers/zoneminder-base/releases) - Update to latest version from zoneminder-containers/zoneminder-base (changelog : https://github.com/zoneminder-containers/zoneminder-base/releases)
+10 -6
View File
@@ -31,13 +31,17 @@ case "$(bashio::config "DB_CONNECTION")" in
DB_CONNECTION="mysql" DB_CONNECTION="mysql"
remoteDB="1" remoteDB="1"
ZM_DB_HOST="$(bashio::services "mysql" "host")"
ZM_DB_PORT="$(bashio::services "mysql" "port")" # Resolve MariaDB hostname to IPv4: on HAOS >=17.3 the Supervisor network
# Force IPv4 to avoid access denied errors when the container network uses IPv6 (HAOS 17.3+) # gained IPv6, but the MariaDB addon only grants its user from the IPv4
if ZM_DB_HOST_V4=$(getent ahostsv4 "$ZM_DB_HOST" 2>/dev/null | awk 'NR==1{print $1}') && [ -n "$ZM_DB_HOST_V4" ]; then # subnet (issue #2688). Fall back to the raw hostname if resolution fails.
bashio::log.info "Resolved MariaDB host to IPv4: $ZM_DB_HOST_V4" mariadb_host_raw="$(bashio::services "mysql" "host")"
ZM_DB_HOST="$ZM_DB_HOST_V4" mariadb_host_ipv4="$({ getent ahostsv4 "$mariadb_host_raw" 2> /dev/null || true; } | awk '{print $1; exit}')"
ZM_DB_HOST="${mariadb_host_ipv4:-$mariadb_host_raw}"
if [ "$ZM_DB_HOST" != "$mariadb_host_raw" ]; then
bashio::log.info "Resolved ${mariadb_host_raw} -> ${ZM_DB_HOST} (forcing IPv4)"
fi fi
ZM_DB_PORT="$(bashio::services "mysql" "port")"
ZM_DB_NAME="zm" ZM_DB_NAME="zm"
ZM_DB_USER="$(bashio::services "mysql" "username")" ZM_DB_USER="$(bashio::services "mysql" "username")"
ZM_DB_PASS="$(bashio::services "mysql" "password")" ZM_DB_PASS="$(bashio::services "mysql" "password")"