Score:1

Mysql failed with symlink log folder

in flag

I'm trying to move /var/log to a /home/shared/var/log using a symlink, the problem is that mysql crashes.

Here is the process:

service rsyslog stop

mv /var/log/ /home/shared/var

ln -s /home/shared/var/log /var/log

service rsyslog stop

mysql - status

 mysql.service - MySQL Community Server
 Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
 Active: failed (Result: exit-code) since Mon 2022-10-24 10:10:51 UTC; 1h 24min ago
 Process: 1167 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)

 Process: 1180 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
 Main PID: 1180 (code=exited, status=1/FAILURE)
 Status: "Server shutdown complete"
 Error: 9 (Bad file descriptor)
 CPU: 154ms

Some logs from syslog

 Oct 24 09:49:45 alfa kernel: [  861.500725] audit: type=1400 audit(1666604985.104:34): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/mysqld" pid=89994 comm="apparmor_parser"
 Oct 24 10:10:45 alfa kernel: [    8.026192] audit: type=1400 audit(1666606245.678:39): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:45 alfa kernel: [    8.026341] audit: type=1400 audit(1666606245.678:40): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:45 alfa kernel: [    8.026463] audit: type=1400 audit(1666606245.678:41): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:45 alfa kernel: [    8.026515] audit: type=1400 audit(1666606245.678:42): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:45 alfa kernel: [    8.026561] audit: type=1400 audit(1666606245.678:43): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:45 alfa kernel: [    8.026604] audit: type=1400 audit(1666606245.678:44): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:45 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
 Oct 24 10:10:45 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
 Oct 24 10:10:46 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 1.
 Oct 24 10:10:47 alfa kernel: [    9.533830] audit: type=1400 audit(1666606247.186:45): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=965 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:47 alfa kernel: [    9.541263] audit: type=1400 audit(1666606247.194:46): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=965 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:47 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
 Oct 24 10:10:47 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
 Oct 24 10:10:47 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 2.
 Oct 24 10:10:48 alfa kernel: [   10.915630] audit: type=1400 audit(1666606248.566:51): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:48 alfa kernel: [   10.934619] audit: type=1400 audit(1666606248.586:52): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:48 alfa kernel: [   10.934797] audit: type=1400 audit(1666606248.586:53): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:48 alfa kernel: [   10.934879] audit: type=1400 audit(1666606248.586:54): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:48 alfa kernel: [   10.934922] audit: type=1400 audit(1666606248.586:55): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:48 alfa kernel: [   10.934962] audit: type=1400 audit(1666606248.586:56): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:48 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
 Oct 24 10:10:48 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
 Oct 24 10:10:49 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 3.
 Oct 24 10:10:49 alfa kernel: [   12.223305] audit: type=1400 audit(1666606249.874:57): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:49 alfa kernel: [   12.237295] audit: type=1400 audit(1666606249.890:58): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:49 alfa kernel: [   12.237467] audit: type=1400 audit(1666606249.890:59): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:49 alfa kernel: [   12.237537] audit: type=1400 audit(1666606249.890:60): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
 Oct 24 10:10:49 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
 Oct 24 10:10:49 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
 Oct 24 10:10:50 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 4.
 Oct 24 10:10:51 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
 Oct 24 10:10:51 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
 Oct 24 10:10:51 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
 Oct 24 10:10:51 alfa systemd[1]: mysql.service: Start request repeated too quickly.
 Oct 24 10:10:51 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.g
in flag
What are the permissions on that directory? MySQL demands that its logging directory be have its owner and group set as `mysql:adm`. The permissions will also need to be set as `750`. I've not used symlinked directories for logging but, if MySQL continues to refuse to use the directory, you may need to edit the appropriate `my.cnf` file to specify the full path where the logs are to be written.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.