Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecStartPre and ExecStartPost properties of SystemD unit file points to wrong path #683

Open
pmisinsk opened this issue Sep 26, 2022 · 0 comments

Comments

@pmisinsk
Copy link

🗣️ 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.

👻 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

🥞 Cookbook version

cookbook version 11.0.5 - latest at time of submitting this issue (26th Sep 2022)

👩‍🍳 Chef-Infra Version

root@srv2800:~# chef-client -v
Chef Infra Client: 17.10.3

🎩 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

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

root@srv2800:~# cat /etc/apt/sources.list.d/mysql.list
deb      http://repo.mysql.com/apt/debian/ bullseye mysql-8.0

🚓 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
..
..
..

Can you have a look at this

'/usr/share/mysql/mysql-systemd-start pre'

➕ Additional context

This is my mysql_service resource defined in my custom cookbook

mysql_service 'default' do
  error_log '/var/log/mysql/error.log'
  version '8.0'
  package_name 'mysql-server'
  package_version '8.0.30-1debian11'
  bind_address '0.0.0.0'
  initial_root_password 'SuperS3cr3tPa$$W0rd'
  action [:create, :start]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant