Page 1 of 1

Remote MySQL Server

Posted: Wed Sep 27, 2023 12:31 am
by mike49099
I hope that this is the correct forum and that I have not overlooked an existing entry.
I have a rack with 4 servers. One does web service, one does MySQL service, the third is set up for, or will be, ZoneMinder.
When installing via apt, the package insists on installing mysql in spite of the fact that there is already a server elsewhere.
Removing this additional MySQL instance after a full install is fairly onerous and it wants to remove the ZoneMinder package as well. I haven't found a mechanism where I can install only ZoneMinder and point it to the existing database.
What am I missing?
Thanks in advance, mike

Re: Remote MySQL Server

Posted: Wed Sep 27, 2023 6:20 am
by dougmccrary
Not sure you need to actually remove the mysql zm wants, but maybe this helps a bit?

viewtopic.php?t=26017
or this?
https://zoneminder.readthedocs.io/en/st ... erver.html

Re: Remote MySQL Server

Posted: Wed Sep 27, 2023 12:32 pm
by iconnor
Which zm package are you using? Ours shouldn't do that. What distro?

Re: Remote MySQL Server

Posted: Wed Sep 27, 2023 1:05 pm
by mike49099
I am using Ubuntu's Jammy repository. The installation using 'sudo apt install zoneminder'.

Re: Remote MySQL Server

Posted: Wed Sep 27, 2023 2:56 pm
by iconnor
Okay. Add my ppa and use our packages instead.

sudo add-apt-repository ppa:iconnor/zoneminder-1.36

Re: Remote MySQL Server

Posted: Mon Jan 27, 2025 8:55 pm
by robvdl
I'm running into this too and it is slightly annoying.

I already have a mariadb instance and don't really want to run mysql on the same host at all.

So I figure the easiest way to deal with this is to just let it install mysql then disable the service from auto starting. It will just be the package installed only but not started, not too big of a deal.

Re: Remote MySQL Server

Posted: Mon Jan 27, 2025 9:01 pm
by robvdl
iconnor wrote: Wed Sep 27, 2023 12:32 pm Which zm package are you using? Ours shouldn't do that. What distro?
Ubuntu 24.04 LTS, add the ppa, install "zoneminder" and mysql is running.

It does do that.

Re: Remote MySQL Server

Posted: Mon Jan 27, 2025 9:28 pm
by robvdl
I had a compare with the zoneminder package in the Ubuntu 24.04 official repository and it has "Depends default-mysql-client | virtual-mysql-client" which only triggers it to install mariadb-client but not the server. It only has "Recommends default-msysql-server | virtual-mysql-server" which would be the better way to go.

Is there any way the PPA version can be changed to match that? I really don't think it should be installing mysql-server but it does unfortunately.

edit: actually the PPA version does have that, so this doesn't add up. I am going to try to uninstall mysql-server and see what it says.

Re: Remote MySQL Server

Posted: Mon Jan 27, 2025 9:36 pm
by robvdl
* mysql-server is not installed
* mariadb-server is not installed

Yet I see processes in htop "/usr/sbin/mysqld", this is weird. This is a clean LXC container in Proxmox.

Why does it say mysql-server and mariadb-server are not installed yet they appear to be running????

"sudo systemctl status mysql.service" says mysql server is running, yet the mysql-server and mariadb-server packages are not installed.

something fishy is going on here.

Re: Remote MySQL Server

Posted: Mon Jan 27, 2025 9:44 pm
by robvdl
OK, sorry for so many replies but it seems default-mysql-server was installed and I don't know how that happens if it is a "Recommends".

I can uninstall it though:

Code: Select all

$ sudo apt remove mysql-server-8.0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libaio1t64 libcgi-fast-perl libcgi-pm-perl libevent-core-2.1-7t64 libevent-pthreads-2.1-7t64 libhtml-template-perl libmecab2 libprotobuf-lite32t64 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-server-core-8.0
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  default-mysql-server mysql-server-8.0
0 upgraded, 0 newly installed, 2 to remove and 17 not upgraded.
After this operation, 1,588 kB disk space will be freed.
I installed the zoneminder package from the PPA with an Ansible playbook, so perhaps Ansible is installing the Recommends section automatically, I'll investigate that next.

Code: Select all

- name: add zoneminder PPA repository
  become: yes
  ansible.builtin.apt_repository:
    repo: ppa:iconnor/zoneminder-1.36

- name: install zoneminder
  become: yes
  apt:
    pkg:
      - zoneminder
    update_cache: no
    state: latest
And my zoneminder package version:

Code: Select all

$ dpkg -s zoneminder

Version: 1.36.35-noble1
I then looked up the Ansible docs and it says that by default it will use the operating systems default for --no-install-recommends:

Code: Select all

install_recommends - Corresponds to the --no-install-recommends option for apt. true installs recommended packages. false does not install recommended packages. By default, Ansible will use the same defaults as the operating system. Suggested packages are never installed.
Which is super insteresting because it is coming from the OS defaults. I can explicitly set it to False in my Ansible playbook off course, but no idea why the OS is defaulting to install the "recommends".

I have now changed it adding "install_recommends: false" and mysql-server is no longer installing.

Code: Select all

- name: install zoneminder
  become: yes
  apt:
    pkg:
      - zoneminder
    update_cache: no
    install_recommends: false
    state: latest

Re: Remote MySQL Server

Posted: Tue Jan 28, 2025 8:16 pm
by robvdl
I did notice something else though, not sure if it is an issue. But in the systemd unit is specifically says "after mysql.service" which I am not sure is going to be an issue if mariadb is running on another host:

Code: Select all

After=network.target mysql.service
I'm inclined to take the mysql bit out, but it'll likely get put back at some point with an apt update.

I enabled the zoneminder service and it seemed to start after a VM reboot, so it seems to be OK with the mysql.service bit in there, even though there is no mysql.service on this host.

Re: Remote MySQL Server

Posted: Tue Jan 28, 2025 11:40 pm
by iconnor
You can do a systemd override to remove any mysql stuff. Then an update won't remove it.

Also... our default .service file has all the mysql stuff commented out... for this reason.
Typically you want BindsTo-=mysql so that if mysql gets stopped zoneminder will too.