You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BUG] mysql_user.present won't work on Debian12 with MariaDB 11.10 OOTB as installation of salt-pip's mysqlclient fails due to missing dependencies
#67747
Open
4 of 9 tasks
mamalos opened this issue
Feb 18, 2025
· 0 comments
Description
I have a Debian12 with salt installed by following this guide (but I also tried with bootstrap and it failed too) and MariaDB 10.11 installed using the following repo (in salt state language):
when I tried to use the mysql_present module like so:
add mysql test user:
mysql_user.present:
- name: test
- host: localhost
it failed with:
# salt 'test2' state.apply states.mysql.test
test2:
----------
ID: add mysql test user
Function: mysql_user.present
Name: test
Result: False
Comment: State 'mysql_user.present' was not found in SLS 'states.mysql.test'
Reason: 'mysql_user' __virtual__ returned False: mysql module could not be loaded
Changes:
After a lot of debugging/googling, I realised that salt minion pip's mysqlclient was missing. I tried to install it manually and got (removed most output to save space):
# salt-pip install mysqlclient
Collecting mysqlclient
...
File "/tmp/pip-build-env-8g8j3ryq/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in run_setup
exec(code, locals())
File "<string>", line 156, in <module>
File "<string>", line 49, in get_config_posix
File "<string>", line 28, in find_package_name
Exception: Can not find valid pkg-config name.
Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip is available: 23.3.2 -> 25.0.1
[notice] To update, run: /opt/saltstack/salt/bin/python3.10 -m pip install --upgrade pip
root@test2:~#
After a lot of googling about potential missing dependencies, I had to first install the following:
libmariadb-dev
build-essential
pkg-config
and then everything worked as expected.
Setup
I've included everything in the description section, what I want to add (without affecting the result) is that the master is running on SmartOS and is running 3006.7nb1.
as explained, both MariaDB and Salt on the minion are installed NOT with the default system's packages
The minion is running on a Debian12 image within a Bhyve VM on a SmartOS host (image_uuid: 3089fa2a-ee6e-44e5-aeb2-2cb985f9eb61 , version: 20250123).
Please be as specific as possible and give set-up details.
on-prem machine
VM (Virtualbox, KVM, etc. please specify)
VM running on a cloud service, please be explicit and add details
container (Kubernetes, Docker, containerd, etc. please specify)
or a combination, please be explicit
jails if it is FreeBSD
classic packaging
onedir packaging
used bootstrap to install
Steps to Reproduce the behavior
Everything is explained in the Description section. To summarise, install MariaDB 10.11 on the minion:
Install salt on the minion (following [salt's guide](https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/linux-deb.html)):
Then, configure your minion to communicate with the master and add the following state to the master:
add mysql test user:
mysql_user.present:
- name: test
- host: localhost
and then send that state to the minion, to see this:
# salt 'test2' state.apply states.mysql.test
test2:
----------
ID: add mysql test user
Function: mysql_user.present
Name: test
Result: False
Comment: State 'mysql_user.present' was not found in SLS 'states.mysql.test'
Reason: 'mysql_user' __virtual__ returned False: mysql module could not be loaded
Changes:
Summary for test2
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 0.000 ms
ERROR: Minions returned with non-zero exit code
[root@salt-master /var/salt/file-roots/states/mysql]#
Expected behavior
Ideally I would have expected the mysql_user state to have worked OOTB, but I understand that there's a dependency on MySQL, so I would have expected salt-docs to explain how/what to install as a dependency on some known distros. The docs are mentioning MySQLdb python module, I'm not even sure if I evntually installed that dependency for it to work. And as IIUC salt uses its own python env, some reference to some guide on installing dependencies with salt-pip would help too.
If it was for a less known service, I wouldn't have bothered writing this issue, but this is for MariaDB on a Debian system, so I think people expect this configuration to run smoothly.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report AFTER having installed mysqlclient
salt --versions-report
root@test2:~# salt-minion --versions-report
Salt Version:
Salt: 3006.9
Dependency Versions:
cffi: 1.17.1
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.1.0
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.2
pycparser: 2.22
pycrypto: 3.21.0
pycryptodome: 3.21.0
pygit2: Not Installed
python-gnupg: Not Installed
PyYAML: 6.0.2
PyZMQ: 26.2.0
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.5
Description
I have a Debian12 with salt installed by following this guide (but I also tried with bootstrap and it failed too) and MariaDB 10.11 installed using the following repo (in salt state language):
when I tried to use the
mysql_present
module like so:it failed with:
After a lot of debugging/googling, I realised that salt minion pip's
mysqlclient
was missing. I tried to install it manually and got (removed most output to save space):After a lot of googling about potential missing dependencies, I had to first install the following:
and then everything worked as expected.
Setup
3006.7nb1
.Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
Everything is explained in the Description section. To summarise, install MariaDB 10.11 on the minion:
Install salt on the minion (following
[salt's guide](https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/linux-deb.html)
):Pin: version 3006.*
Pin-Priority: 1001' | sudo tee /etc/apt/preferences.d/salt-pin-1001
Then, configure your minion to communicate with the master and add the following state to the master:
and then send that state to the minion, to see this:
Expected behavior
Ideally I would have expected the
mysql_user
state to have worked OOTB, but I understand that there's a dependency on MySQL, so I would have expected salt-docs to explain how/what to install as a dependency on some known distros. The docs are mentioningMySQLdb
python module, I'm not even sure if I evntually installed that dependency for it to work. And as IIUC salt uses its own python env, some reference to some guide on installing dependencies withsalt-pip
would help too.If it was for a less known service, I wouldn't have bothered writing this issue, but this is for MariaDB on a Debian system, so I think people expect this configuration to run smoothly.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
AFTER having installed mysqlclient
salt --versions-report root@test2:~# salt-minion --versions-report Salt Version: Salt: 3006.9
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Python Version:
Python: 3.10.14 (main, Jun 26 2024, 11:44:37) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: 18.6.1
cryptography: 42.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.17.0
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian 12 bookworm
locale: utf-8
machine: x86_64
release: 6.1.0-30-amd64
system: Linux
version: Debian GNU/Linux 12 bookworm
and on the SmartOS server:
salt-master --versions-report
Salt Version:
Salt: 3006.7
Python Version:
Python: 3.10.16 (main, Dec 25 2024, 03:50:59) [GCC 13.3.0]
Dependency Versions:
cffi: 1.17.1
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.1.0
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.2
pycparser: 2.22
pycrypto: 3.21.0
pycryptodome: 3.21.0
pygit2: Not Installed
python-gnupg: Not Installed
PyYAML: 6.0.2
PyZMQ: 26.2.0
relenv: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.5
System Versions:
dist: pkgsrc 5.11
locale: utf-8
machine: i86pc
release: 5.11
system: SunOS
version: release: 2024Q 5.11
PASTE HERE
The text was updated successfully, but these errors were encountered: