Remote MySQL Server

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
mike49099
Posts: 2
Joined: Wed Sep 27, 2023 12:02 am

Remote MySQL Server

Post 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
dougmccrary
Posts: 1351
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Remote MySQL Server

Post 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
User avatar
iconnor
Posts: 3286
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Remote MySQL Server

Post by iconnor »

Which zm package are you using? Ours shouldn't do that. What distro?
mike49099
Posts: 2
Joined: Wed Sep 27, 2023 12:02 am

Re: Remote MySQL Server

Post by mike49099 »

I am using Ubuntu's Jammy repository. The installation using 'sudo apt install zoneminder'.
User avatar
iconnor
Posts: 3286
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Remote MySQL Server

Post by iconnor »

Okay. Add my ppa and use our packages instead.

sudo add-apt-repository ppa:iconnor/zoneminder-1.36
robvdl
Posts: 8
Joined: Thu Mar 16, 2023 7:19 pm

Re: Remote MySQL Server

Post 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.
robvdl
Posts: 8
Joined: Thu Mar 16, 2023 7:19 pm

Re: Remote MySQL Server

Post 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.
robvdl
Posts: 8
Joined: Thu Mar 16, 2023 7:19 pm

Re: Remote MySQL Server

Post 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.
robvdl
Posts: 8
Joined: Thu Mar 16, 2023 7:19 pm

Re: Remote MySQL Server

Post 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.
robvdl
Posts: 8
Joined: Thu Mar 16, 2023 7:19 pm

Re: Remote MySQL Server

Post 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
robvdl
Posts: 8
Joined: Thu Mar 16, 2023 7:19 pm

Re: Remote MySQL Server

Post 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.
User avatar
iconnor
Posts: 3286
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Remote MySQL Server

Post 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.
Post Reply