Apparmor causes failure when mysql.sock.lock configured to live in non-standard directory (e.g. under /opt)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mysql-8.0 (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
Ubuntu release -20.04
issue -
I am using XAMPP server for mysql programs with php, but mysql is not connecting, instead it giving me error as:
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
ProblemType: Package
DistroRelease: Ubuntu 20.04
Package: mysql-server-8.0 8.0.25-
ProcVersionSign
Uname: Linux 5.8.0-53-generic x86_64
ApportVersion: 2.20.11-
AptOrdering:
mysql-
mysql-
mysql-
NULL: ConfigurePending
Architecture: amd64
CasperMD5CheckR
Date: Sat May 15 17:34:34 2021
ErrorMessage: installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2020-08-14 (274 days ago)
InstallationMedia: Ubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
Logs.var.
MySQLConf.
MySQLConf.
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
ProcCmdline: BOOT_IMAGE=
Python3Details: /usr/bin/python3.8, Python 3.8.5, python3-minimal, 3.8.2-0ubuntu2
PythonDetails: N/A
RelatedPackageV
dpkg 1.19.7ubuntu3
apt 2.0.2ubuntu0.2
SourcePackage: mysql-8.0
Title: package mysql-server-8.0 8.0.25-
UpgradeStatus: No upgrade log present (probably fresh install)
modified.
mtime.conffile.
tags: | removed: need-duplicate-check |
summary: |
- package mysql-server-8.0 8.0.25-0ubuntu0.20.04.1 failed to - install/upgrade: installed mysql-server-8.0 package post-installation - script subprocess returned error exit status 1 + Apparmor causes failure when mysql.sock.lock configured to live in non- + standard directory (e.g. under /opt) |
Hi Akanksha,
in your logs I see
mysqld is running as pid 9221
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
Which implies it failed to start/restart on an upgrae,.
When looking for errors I found:
2021-05- 16T07:06: 41.654237Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 16T07:06: 41.657827Z 0 [ERROR] [MY-010273] [Server] Could not create unix socket lock file /opt/lampp/ var/mysql/ mysql.sock. lock. 16T07:06: 41.658385Z 0 [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
2021-05-
2021-05-
Which shows us what failed and made me suspicious as this is an uncommon path that was used.
With that in mind I found
[ 1737.039283] audit: type=1400 audit(162108021 3.808:139) : apparmor="DENIED" operation="mknod" profile= "/usr/sbin/ mysqld" name="/ opt/lampp/ var/mysql/ mysql.sock. lock" pid=10896 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=126 ouid=126
And now things made sense, if you configure "too far away" from the default config you have to modify the apparmor profile as well to allow that.
By default apparmor tries to isolate the mysqld process to protect your system and in this case the new path that you have configured is blocked by that isolation.
If you have changed that (either allowed the path or configured it to a common one that is allowed by default) the upgrade will likely work again.