[debian-mysql] Bug#1071699: mariadb-server: Moved mariadb socket, debian-start reports error connecting to old socket
Eric Towers
fuzzyeric at gmail.com
Thu May 23 23:46:15 BST 2024
Package: mariadb-server
Version: 1:10.11.6-0+deb12u1
Severity: normal
X-Debbugs-Cc: fuzzyeric at gmail.com
Dear Maintainer,
First, thanks for your hard work maintaining the MariaDB (server)
package. You're awesome.
After moving /var/lib/mysql/ to /mnt/tera/mariadb/ ,
modifying /etc/mysql/mariadb.conf.d/50-server.conf
from: datadir = /var/lib/mysql
to: datadir = /mnt/tera/mariadb ,
modifying /etc/mariadb.cnf
uncomment: port = 3306
from: socket = /run/mysqld/mysqld.sock
to: socket = /mnt/tera/mariadb/mysqld.sock ,
and modifying /etc/mariadb.conf.d/50-client.cnf
add to [client] section:
port = 3306
socket = /mnt/tera/mariadb/mysqld.conf ,
starting mariadb (as root)
systemctl start mariadb
yields a successfully running mariadb
tested by: mysqladmin -u root status
returns: Uptime: 1644 Threads: 1 Questions: 4 Slow queries: 0 Opens: 17 Open tables: 10 Queries per second avg: 0.002
but debian start returns an error (there may be a smarter way to extract
the debian-start messages, but I know this one works)
journalctl -b | grep debian-start
returns for this start:
[...] /etc/mysql/debian-start[141397]: Upgrading MySQL tables if necessary.
[...] /etc/mysql/debian-start[141408]: Checking for insecure root accounts.
[...] debian-start[141411]: ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
Checking /etc/mysql/debian-start and
/usr/share/mysql/debian-start.inc.sh, I don't see a hardcoded socket
path, so I don't know where this socket path is coming from.
I did not expect an error from debian-start. I expect that debian-start
indicates if it is attaching to the server via the socket or via
localhost/127.0.0.1 (and the port). In fact, if both are configured, I
imagine it would check reachability through both mechanisms and report
results for both. I also expect it will use the configured mechanisms,
not defaults.
Correct(?) solution: debian-start uses the configured mechanisms to probe
the mariadb server and reports success/fail of each. Errors are only
generated if the configured access mechanisms fail.
Passable workaround: systemd's maraidb startup script creates a link
from /run/mysqld/mysqld.sock to wherever that socket actually is when
it starts up.
My hack-ish workaround: I have linked the wrong location to the configured
location.
ln -s /mnt/tera/mariadb/mysqld.sock /run/mysqld/mysqld.sock
chown -h mysql:mysql /run/mysqld/mysqld.sock
I don't have a clear understanding of the lifetime of the /run/*
(sub-)filesystem, so I don't know how long this hack will prevent the
error message.
Again, thanks for your hard work!
-- System Information:
Debian Release: 12.5
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-21-amd64 (SMP w/6 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages mariadb-server depends on:
ii adduser 3.134
ii debconf [debconf-2.0] 1.5.82
ii galera-4 26.4.13-1
ii gawk 1:5.2.1-2
ii iproute2 6.1.0-3
ii libc6 2.36-9+deb12u7
ii libdbi-perl 1.643-4
ii libpam0g 1.5.2-6+deb12u1
ii libssl3 3.0.11-1~deb12u2
ii libstdc++6 12.2.0-14
ii lsof 4.95.0-1
ii mariadb-client 1:10.11.6-0+deb12u1
ii mariadb-common 1:10.11.6-0+deb12u1
ii mariadb-server-core 1:10.11.6-0+deb12u1
ii passwd 1:4.13+dfsg1-1+b1
ii perl 5.36.0-7+deb12u1
ii procps 2:4.0.2-3
ii psmisc 23.6-1
ii rsync 3.2.7-1
ii socat 1.7.4.4-2
ii zlib1g 1:1.2.13.dfsg-1
Versions of packages mariadb-server recommends:
ii libhtml-template-perl 2.97-2
ii mariadb-plugin-provider-bzip2 1:10.11.6-0+deb12u1
ii mariadb-plugin-provider-lz4 1:10.11.6-0+deb12u1
ii mariadb-plugin-provider-lzma 1:10.11.6-0+deb12u1
ii mariadb-plugin-provider-lzo 1:10.11.6-0+deb12u1
ii mariadb-plugin-provider-snappy 1:10.11.6-0+deb12u1
ii pv 1.6.20-1
Versions of packages mariadb-server suggests:
ii bsd-mailx [mailx] 8.1.2-0.20220412cvs-1
pn mariadb-test <none>
pn netcat-openbsd <none>
-- Configuration Files:
/etc/mysql/mariadb.conf.d/50-server.cnf changed:
[server]
[mysqld]
pid-file = /run/mysqld/mysqld.pid
basedir = /usr
datadir = /mnt/tera/mariadb
bind-address = 127.0.0.1
expire_logs_days = 10
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
[embedded]
[mariadb]
[mariadb-10.11]
-- debconf information:
mariadb-server/old_data_directory_saved:
mariadb-server/nis_warning:
mariadb-server/postrm_remove_databases: false
More information about the pkg-mysql-maint
mailing list