Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.
:ghost: Non-existing path for ExecStartPre and ExecStartPost properties of SystemD unit file
During bootstrapping of Debian 11 node with this cookbook mysql service fails to start due to wrong path for ExecStartPre and ExecStartPost properties of SystemD unit file.
root@srv2800:~# journalctl -xe
[Brief Description](mysql.service: Failed at step EXEC spawning /usr/share/mysql/mysql-systemd-start: No such file or directory)
Subject: Process /usr/share/mysql/mysql-systemd-start could not be executed
Defined-By: systemd
root@srv2800:~# systemctl cat mysql
# /etc/systemd/system/mysql.service
[Unit]
Description=mysql_service[mysql-default]
After=syslog.target
After=network.target
[Service]
Type=simple
User=mysql
Group=mysql
PermissionsStartOnly=true
ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
ExecStart=/usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr
ExecStartPost=/usr/share/mysql/mysql-systemd-start
TimeoutSec=300
Restart=on-failure
RuntimeDirectory=mysqld
RuntimeDirectoryMode=755
[Install]
WantedBy=multi-user.target
root@srv2800:~# ls -la /usr/share/mysql/mysql-systemd-start
ls: cannot access '/usr/share/mysql/mysql-systemd-start': No such file or directory
:pancakes: Cookbook version
cookbook version 11.0.5 - latest at time of submitting this issue (26th Sep 2022)
:woman_cook: Chef-Infra Version
root@srv2800:~# chef-client -v
Chef Infra Client: 17.10.3
:tophat: Platform details
Platform detail:
root@srv2800:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
root@srv2800:~# cat /etc/apt/sources.list.d/mysql.list
deb http://repo.mysql.com/apt/debian/ bullseye mysql-8.0
:police_car: Expected behavior
It seems APT packages for mysql v8 installs SystemD unit files into path /usr/share/mysql-8.0/ and not into path /usr/share/mysql.
root@srv2800:~# ls -ald /usr/share/mysql-8.0/
drwxr-xr-x 28 root root 4096 Sep 26 12:20 /usr/share/mysql-8.0/
root@srv2800:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
The same behaviour I can confirm on Debian 10 (buster) where are unit files under /usr/share/mysql-8.0 and NOT under /usr/share/mysql:
root@srv242:~# ps -p 1
PID TTY TIME CMD
1 ? 03:52:36 systemd
root@srv242:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
root@srv242:~# dpkg -l | egrep -i mysql
ii mysql-client 8.0.20-1debian10 amd64 MySQL Client meta package depending on latest version
ii mysql-common 8.0.20-1debian10 amd64 Common files shared between packages
ii mysql-community-client 8.0.20-1debian10 amd64 MySQL Client
ii mysql-community-client-core 8.0.20-1debian10 amd64 MySQL Client Core Binaries
ii mysql-community-server 8.0.20-1debian10 amd64 MySQL Server
ii mysql-community-server-core 8.0.20-1debian10 amd64 MySQL Server Core Binaires
ii mysql-server 8.0.20-1debian10 amd64 MySQL Server meta package depending on latest version
root@srv242:~# dpkg -L mysql-community-client | egrep "/usr/share/mysql"
/usr/share/mysql-8.0
/usr/share/mysql-8.0/charsets
/usr/share/mysql-8.0/charsets/Index.xml
/usr/share/mysql-8.0/charsets/README
/usr/share/mysql-8.0/charsets/armscii8.xml
/usr/share/mysql-8.0/charsets/ascii.xml
/usr/share/mysql-8.0/charsets/cp1250.xml
/usr/share/mysql-8.0/charsets/cp1251.xml
..
..
..
:speaking_head: Foreword
Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.
:ghost: Non-existing path for ExecStartPre and ExecStartPost properties of SystemD unit file
During bootstrapping of Debian 11 node with this cookbook mysql service fails to start due to wrong path for ExecStartPre and ExecStartPost properties of SystemD unit file.
:pancakes: Cookbook version
cookbook version 11.0.5 - latest at time of submitting this issue (26th Sep 2022)
:woman_cook: Chef-Infra Version
:tophat: Platform details
Platform detail:
I am using recommended mysql APT repo from official mysql docs https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-repo-manual-setup
:police_car: Expected behavior
It seems APT packages for mysql v8 installs SystemD unit files into path /usr/share/mysql-8.0/ and not into path /usr/share/mysql.
The same behaviour I can confirm on Debian 10 (buster) where are unit files under /usr/share/mysql-8.0 and NOT under /usr/share/mysql:
Can you have a look at this https://github.com/sous-chefs/mysql/blob/c1b785f5e9aeb860fbef9448cc86a784987621a4/libraries/helpers.rb#L295
:heavy_plus_sign: Additional context
This is my mysql_service resource defined in my custom cookbook