Fog server refused connection
-
@FlareImp The empty “Database Install | Update” page means FOG cannot reach its database. It is not a pending schema update. When the database is down, FOG cannot read the schema version, so it sends every page to the schema updater. Your agent log shows the same thing: the HTTP 503 “schema_update_pending” lines are from that window. The installer only appears to fix it, because it restarts the database service.
So the question is why MariaDB stops each day. The next time the page goes empty, do not re-run the installer. Run these on the FOG server first and post the output:
sudo systemctl status mariadb apache2 sudo journalctl -u mariadb --since yesterday --no-pager | tail -n 80 sudo dmesg -T | grep -iE 'out of memory|oom' df -h grep -h mariadb /var/log/apt/history.log /var/log/unattended-upgrades/unattended-upgrades.logCommon causes are the kernel killing MariaDB for lack of memory, a full disk, or an automatic package update that stops the service. To bring the server back without the installer:
sudo systemctl start mariadbThe “refused the connection” lines in your agent log mean Apache was down at those times as well, so include its status too.
The empty page itself is a bug: it should have said that the database is unreachable and shown the error. The agent log should also have said so, instead of “schema update”. The fix for both is https://github.com/FOGProject/fogproject/pull/2408. It reaches dev-branch when that merges, and stable with the next release.
-
@Tom-Elliott said in Fog server refused connection:
sudo journalctl -u mariadb
administrator@tv-fog-main:~$ sudo systemctl status mariadb apache2 ● mariadb.service - MariaDB 11.8.6 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled) Active: active (running) since Thu 2026-12-03 09:36:52 EST; 21h ago Invocation: 35ded6251ac14f5ba92ed8be8cedaf1d Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 3764 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 163 (limit: 39738) Memory: 841M (peak: 841.4M) CPU: 5h 29min 17.144s CGroup: /system.slice/mariadb.service └─3764 /usr/sbin/mariadbd Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:34:36 tv-fog-main mariadbd[3764]: 2026-12-04 7:34:36 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) ● apache2.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled) Active: active (running) since Thu 2026-12-03 09:37:45 EST; 21h ago Invocation: ed968b4dbcb148688e26bc7b870306a3 Docs: https://httpd.apache.org/docs/2.4/ Process: 50261 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Main PID: 4964 (apache2) Status: "Total requests: 690788; Idle/Busy workers 100/0;Requests/sec: 8.74; Bytes served/sec: 246KB/sec" Tasks: 11 (limit: 6021) Memory: 164.5M (peak: 213.2M) CPU: 2h 27min 33.565s CGroup: /system.slice/apache2.service ├─ 4964 /usr/sbin/apache2 -k start -DFOREGROUND ├─50269 /usr/sbin/apache2 -k start -DFOREGROUND ├─50271 /usr/sbin/apache2 -k start -DFOREGROUND ├─50273 /usr/sbin/apache2 -k start -DFOREGROUND ├─50279 /usr/sbin/apache2 -k start -DFOREGROUND ├─50312 /usr/sbin/apache2 -k start -DFOREGROUND ├─61401 /usr/sbin/apache2 -k start -DFOREGROUND ├─63832 /usr/sbin/apache2 -k start -DFOREGROUND ├─64671 /usr/sbin/apache2 -k start -DFOREGROUND ├─64948 /usr/sbin/apache2 -k start -DFOREGROUND └─66450 /usr/sbin/apache2 -k start -DFOREGROUND Dec 03 09:37:45 tv-fog-main systemd[1]: Starting apache2.service - The Apache HTTP Server... Dec 03 09:37:45 tv-fog-main systemd[1]: Started apache2.service - The Apache HTTP Server. Dec 04 00:13:32 tv-fog-main systemd[1]: Reloading apache2.service - The Apache HTTP Server... Dec 04 00:13:32 tv-fog-main systemd[1]: Reloaded apache2.service - The Apache HTTP Server.sudo dmesg -T | grep -iE ‘out of memory|oom’
Nothing was returnedadministrator@tv-fog-main:~$ grep -h mariadb /var/log/apt/history.log /var/log/unattended-upgrades/unattended-upgrades.log Commandline: apt-get -yq install --only-upgrade -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold apache2 attr bc build-essential cpp curl efitools g++ gawk gcc gcc-aarch64-linux-gnu genisoimage git gzip htmldoc isolinux jq lftp libapache2-mod-php libc6 libcurl4t64 liblzma-dev m4 mariadb-client mariadb-client-compat mariadb-server mariadb-server-compat net-tools nfs-kernel-server openssh-server php php-bcmath php-cli php-curl php-fpm php-gd php-json php-ldap php-mbstring php-mysql php-sqlite3 php-ssh2 php-zip sbsigntool sudo tar tftpd-hpa tftp-hpa unzip vsftpd wget zlib1g Commandline: apt-get -yq install --only-upgrade -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold apache2 attr bc build-essential cpp curl efitools g++ gawk gcc gcc-aarch64-linux-gnu genisoimage git gzip htmldoc isolinux jq lftp libapache2-mod-php libc6 libcurl4t64 liblzma-dev m4 mariadb-client mariadb-client-compat mariadb-server mariadb-server-compat net-tools nfs-kernel-server openssh-server php php-bcmath php-cli php-curl php-fpm php-gd php-json php-ldap php-mbstring php-mysql php-sqlite3 php-ssh2 php-zip sbsigntool sudo tar tftpd-hpa tftp-hpa unzip vsftpd wget zlib1gadministrator@tv-fog-main:~$ sudo journalctl -u mariadb --since yesterday --no-pager | tail -n 80 Dec 04 07:37:32 tv-fog-main mariadbd[3764]: 2026-12-04 7:37:32 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:37:32 tv-fog-main mariadbd[3764]: 2026-12-04 7:37:32 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:37:32 tv-fog-main mariadbd[3764]: 2026-12-04 7:37:32 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:37:32 tv-fog-main mariadbd[3764]: 2026-12-04 7:37:32 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:37:32 tv-fog-main mariadbd[3764]: 2026-12-04 7:37:32 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) Dec 04 07:37:32 tv-fog-main mariadbd[3764]: 2026-12-04 7:37:32 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) -
@FlareImp Thank you, that output changes the picture. MariaDB is not stopping. It has run for 21 hours. It is full: every connection slot is in use, so it refuses new ones (“Too many connections”). FOG then cannot read the schema version, and sends every page to the schema updater. The installer only appears to fix it, because it restarts MariaDB, which drops every connection.
So the question is now what holds all those connections. The next time the page goes empty, run these on the FOG server before you restart anything, and post the output:
sudo mysql -e "SHOW VARIABLES LIKE 'max_connections'; SHOW GLOBAL STATUS LIKE 'Max_used_connections';" sudo mysql -e "SELECT user, SUBSTRING_INDEX(host, ':', 1) AS from_host, command, COUNT(*) AS conns, MAX(time) AS longest_s FROM information_schema.processlist GROUP BY 1, 2, 3 ORDER BY conns DESC;" sudo mysql -e "SELECT id, user, command, time, state, LEFT(info, 150) AS query FROM information_schema.processlist WHERE command <> 'Sleep' ORDER BY time DESC LIMIT 20;" ps -eo pid,etimes,args --sort=-etimes | grep -E '[p]hp' | head -40sudo mysqlstill gets in when the server is full, because MariaDB keeps one spare slot for root.To bring the server back without the installer:
sudo systemctl restart mariadbAbout how many hosts run the FOG agent against this server?
The fix I mentioned in my first reply is now on dev-branch. With it, the schema page shows the database error, here “Too many connections”, instead of an empty page. The agent log says “cannot reach its database” instead of “schema update”. It reaches stable with the next release.
-
Restarting mariadb did not fix the webui issue so I had to rerun the installer.sh again. after going back into the logs, this is what I was seeing if it helps.
Dec 04 07:45:11 tv-fog-main systemd[1]: mariadb.service: Consumed 21.152s CPU time over 2min 38.196s wall clock time, 227.3M memory peak. Dec 04 07:45:11 tv-fog-main systemd[1]: Starting mariadb.service - MariaDB 11.8.6 database server... Dec 04 07:45:11 tv-fog-main (mariadbd)[2982]: mariadb.service: Referenced but unset environment variable evaluates to an empty string: MYSQLD_OPTS, _WSREP_NEW_CLUSTER Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] Starting MariaDB 11.8.6-MariaDB-5ubuntu0.1 from Ubuntu source revision 9bfea48ce1214cc4470f6f6f8a4e30352cef84e7 server_uid Flsf7J2EQTs67j8LeqynYbCgQ70= as process 2982 Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Compressed tables use zlib 1.3.1 Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Number of transaction pools: 1 Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Using AVX512 instructions Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Using io_uring Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: innodb_buffer_pool_size_max=128m, innodb_buffer_pool_size=128m Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Initialized memory pressure event listener Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Completed initialization of buffer pool Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes) Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: End of log at LSN=22049089801 Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Opened 3 undo tablespaces Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active. Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: log sequence number 22049089801; transaction id 64164331 Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] Plugin 'FEEDBACK' is disabled. Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] Plugin 'wsrep-provider' is disabled. Dec 04 07:45:11 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:11 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool Dec 04 07:45:12 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:12 0 [Note] InnoDB: Buffer pool(s) load completed at 261204 7:45:12 Dec 04 07:45:12 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:12 0 [Note] Server socket created on IP: '0.0.0.0', port: '3306'. Dec 04 07:45:12 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:12 0 [Note] Server socket created on IP: '::', port: '3306'. Dec 04 07:45:12 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:12 0 [Note] mariadbd: Event Scheduler: Loaded 0 events Dec 04 07:45:12 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:12 0 [Note] /usr/sbin/mariadbd: ready for connections. Dec 04 07:45:12 tv-fog-main mariadbd[2982]: Version: '11.8.6-MariaDB-5ubuntu0.1 from Ubuntu' socket: '/run/mysqld/mysqld.sock' port: 3306 -- Please help get to 10k stars at https://github.com/MariaDB/Server Dec 04 07:45:12 tv-fog-main systemd[1]: Started mariadb.service - MariaDB 11.8.6 database server. Dec 04 07:45:12 tv-fog-main /etc/mysql/debian-start[2999]: Upgrading MariaDB tables if necessary. Dec 04 07:45:12 tv-fog-main /etc/mysql/debian-start[3014]: Checking for insecure root accounts. Dec 04 07:45:12 tv-fog-main /etc/mysql/debian-start[3018]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables Dec 04 07:45:13 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:13 39 [Warning] IP address '10.221.9.52' could not be resolved: Name or service not known Dec 04 07:45:20 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:20 49 [Warning] IP address '10.223.9.50' could not be resolved: Name or service not known Dec 04 07:45:22 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:22 50 [Warning] IP address '10.225.9.50' could not be resolved: Name or service not known Dec 04 07:45:34 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:34 51 [Warning] IP address '10.228.9.50' could not be resolved: Name or service not known Dec 04 07:45:35 tv-fog-main mariadbd[2982]: 2026-12-04 7:45:35 52 [Warning] IP address '10.221.9.50' could not be resolved: Name or service not known Dec 04 07:46:47 tv-fog-main mariadbd[2982]: 2026-12-04 7:46:47 1698 [Warning] IP address '10.220.9.50' could not be resolved: Name or service not known Dec 04 07:46:48 tv-fog-main mariadbd[2982]: 2026-12-04 7:46:48 1704 [Warning] IP address '10.222.9.50' could not be resolved: Name or service not known Dec 04 07:46:49 tv-fog-main mariadbd[2982]: 2026-12-04 7:46:49 1712 [Warning] IP address '10.229.9.50' could not be resolved: Name or service not known -
@Tom-Elliott I also noticed that when the main fog server is crashing out, all the Fog services on my remote master storage nodes also stop. Not sure if that is relavent.
-
@FlareImp Thanks, that log helps. It also explains why the restart did not help. Within 90 seconds of the restart, MariaDB had taken about 1,650 new connections (the connection number went from 52 to 1698). So the slots fill again almost at once. Something is still sending a flood of connections, or connections are getting stuck, as soon as MariaDB is back.
So you do not have to wait for the next failure. Collect the output from my last reply while the page is empty, or within a few minutes after a restart, and post it. The two
information_schema.processlistqueries are the important ones. They show who holds the connections and which queries are stuck.The addresses in that log (10.220.9.50 through 10.229.9.50, and 10.221.9.52) connect straight to MariaDB. Are those your FOG storage nodes? How many storage nodes do you have, and what FOG version are they on?
-
@FlareImp Thanks, that log helps. It also explains why restarting MariaDB did not help. Within 90 seconds of the restart, MariaDB had taken about 1,650 new connections (the connection number went from 52 to 1698). So the slots fill again almost at once. Something keeps sending connections, or keeps connections stuck, as soon as MariaDB is back.
The installer restarts more than MariaDB: it also restarts Apache, PHP-FPM, and the FOG services. One of those is most likely what brings the server back. Next time the page goes empty, please do this instead of the installer:
- Run the commands from my last reply first, and post the output. The two
information_schema.processlistqueries are the important ones. They show who holds the connections and which queries are stuck. - Restart only the FOG services, then wait two minutes and check the web UI:
sudo systemctl restart 'FOG*.service'- If the page is still empty, restart only the web side, then wait two minutes and check again:
sudo systemctl restart apache2 'php*-fpm.service'- Tell us which step brought it back.
You also said this was working before. Do you know about when it started? Did anything change around then, such as a FOG update, the new FOG agent being rolled out to more machines, or new storage nodes? This shows the dates of package updates on the server:
grep -E '^Start-Date|^Commandline' /var/log/apt/history.log | tail -n 40Last, the addresses in your log (10.220.9.50 through 10.229.9.50, and 10.221.9.52) connect straight to MariaDB. Are those your FOG storage nodes? How many storage nodes do you have, and what FOG version are they on?
- Run the commands from my last reply first, and post the output. The two
-
@Tom-Elliott There are 7 Master Storage Nodes and 2 slave nodes under each master.
-
@FlareImp Thank you, that was the missing piece, and it is a FOG bug.
Every FOG server runs 11 FOG services, and that includes every storage node. Each service keeps 2 connections to the main server’s database open all the time, even while it sleeps between runs. That is 22 connections per server. With your main server, 7 master storage nodes and their 14 other storage nodes, that is 22 servers, or about 480 connections. MariaDB allows 151 by default. Once it is full, the web UI and the agents cannot connect, and you get the empty schema page. This is also why restarting MariaDB alone did not help: every node reconnects within seconds. It is also why the node services stopped: they could not get a connection either.
I am fixing FOG so that a service holds a connection only while it is working. I will post here when the fix is on dev-branch.
Until then, raise the limit on the main FOG server. This creates a small config file and restarts MariaDB:
printf '[mysqld]\nmax_connections = 600\n' | sudo tee /etc/mysql/mariadb.conf.d/90-fog-connections.cnf sudo systemctl restart mariadb sudo mysql -e "SHOW VARIABLES LIKE 'max_connections'"The last command should show 600. Then, on each storage node where the FOG services stopped, start them again:
sudo systemctl restart 'FOG*.service' -
@Tom-Elliott Awesome work Tom! I have applied your fix. I am not sure when it broke exactly because I have been doing a lot of dev-branch upgrades since we were trying to fix other bugs. I did move my main fog server and all the storage nodes over to fog 1.6.1 a few days ago so everything was matching.
-
@FlareImp The fix is https://github.com/FOGProject/fogproject/pull/2431. With it, a FOG service holds a database connection only while it is working, and lets it go while it sleeps. On my test server, each service went from 2 connections held all the time to none between runs.
It reaches dev-branch when that pull request merges, and stable with the next release. To get it, update the main server and every storage node, because the storage nodes’ services are the ones filling the main server’s database. Keep the
max_connections = 600setting until all of them are updated. -
@Tom-Elliott I have upgraded my Master Fog Server and all my nodes to dev-branch 1.6.1.776. I am defiantly seeing a drop in bandwidth usage. Monday morning will tell.