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

Mysql linking issue with libnetsnmptrapd.so #150

Open
csmall opened this issue Jul 13, 2020 · 1 comment
Open

Mysql linking issue with libnetsnmptrapd.so #150

csmall opened this issue Jul 13, 2020 · 1 comment

Comments

@csmall
Copy link
Contributor

csmall commented Jul 13, 2020

This is around two Debian bugs. To better understand them, there are three Debian packages involved:

  • snmptrapd - Holds the snmptrapd binary
  • libsnmp35 - Holds all the shared libraries, including libnetsnmptrapd.so
  • libsnmp-dev - Holds the development library stuff, like .a libraries and header files

#953948 is asking why does the libsnmp30 (now libsnmp35) package keep depending on MySQL libraries and then stop depending on them.

#964166 is a bug report stating that libnetsnmptrapd.so uses MySQL library but is not linked to it. Looking at the source code, especially apps/Makefile.in and tracing where MYSQL_LIBS is used, you can see that snmptrapd binary is linked but the library is not.

This means that if someone wanted to link to libnetsnmptrapd they would get an error unless the binary was linked to MySQL library as well. The library should link to the other libraries it needs.

Except... it is impossible to simply link to libnetsnmptrapd as the header files are not shipped nor do net-snmp-config reference the library.

I see a few things that might need to happen:

  1. libnetsnmptrapd needs to link to libmysql. It might be that snmptrapd itself no longer needs to link to it. Alternatively, you might statically link the libnetsnmptrapd to snmptrapd and keep linking MySQL to the binary.
  2. Work out if you want third-parties to use libnetsnmptrapd and either ship the headers and update net-snmp-config or not (and let me know so I'll remove that library out of the -dev package.

You might also want to consider having libnetsnmptrapd.so conditionally using something like dlopen. This would mean that for most people they would not need or load the MySQL library but for those that do the dlopen and associated functions would make that feature work. If that is something of interest, I may be able to try to get that working myself and raise a pull request.

@bbruun
Copy link

bbruun commented May 4, 2021

I have a similar issue.

After installing Ubuntu 20.04 (Focal) and installing default dependencies utilizing snmpd for monitoring we get a lot of issues with MySQL 8 trying to be installed, even if MariaDB is installed causing problems.

Could the libmysqlclient dependency be taken out of libnetsnmptrapd.so to avoid conflicts with other systems being installed on the operating system ? Or have it depend on mysql-client or mariadb-client as a mutal depencency to avoid MySQL 8 server being installed

Example from clean Focal system where I can't install snmpd due to this dependency:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libmysqlclient21 libsnmp-base libsnmp35
Suggested packages:
  snmp-mibs-downloader snmptrapd
The following NEW packages will be installed:
  libmysqlclient21 libsnmp-base libsnmp35 snmpd
0 upgraded, 4 newly installed, 0 to remove and 47 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2.465 kB of archives.
After this operation, 11,9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libmysqlclient21:amd64.
(Reading database ... 179004 files and directories currently installed.)
Preparing to unpack .../libmysqlclient21_8.0.23-0ubuntu0.20.04.1_amd64.deb ...
Unpacking libmysqlclient21:amd64 (8.0.23-0ubuntu0.20.04.1) ...
Selecting previously unselected package libsnmp-base.
Preparing to unpack .../libsnmp-base_5.8+dfsg-2ubuntu2.3_all.deb ...
Unpacking libsnmp-base (5.8+dfsg-2ubuntu2.3) ...
Selecting previously unselected package libsnmp35:amd64.
Preparing to unpack .../libsnmp35_5.8+dfsg-2ubuntu2.3_amd64.deb ...
Unpacking libsnmp35:amd64 (5.8+dfsg-2ubuntu2.3) ...
Selecting previously unselected package snmpd.
Preparing to unpack .../snmpd_5.8+dfsg-2ubuntu2.3_amd64.deb ...
Unpacking snmpd (5.8+dfsg-2ubuntu2.3) ...
Setting up mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
update-alternatives: warning: forcing reinstallation of alternative /etc/mysql/mysql.cnf because link group my.cnf is broken
update-alternatives: warning: not replacing /etc/mysql/my.cnf with a link
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
2021-05-04T11:56:15.135364Z 0 [ERROR] [MY-010946] [Server] Failed to start mysqld daemon. Check mysqld error log.
Warning: Unable to start the server.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2021-05-04 13:56:18 CEST; 4ms ago
    Process: 17474 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 17502 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 17502 (code=exited, status=1/FAILURE)
     Status: "Server startup in progress"

May 04 13:56:18 gct-dia-srv-testcustomer systemd[1]: mysql.service: Failed with result 'exit-code'.
May 04 13:56:18 gct-dia-srv-testcustomer systemd[1]: Failed to start MySQL Community Server.
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
Setting up libmysqlclient21:amd64 (8.0.23-0ubuntu0.20.04.1) ...
Setting up libsnmp-base (5.8+dfsg-2ubuntu2.3) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-8.0; however:
  Package mysql-server-8.0 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Setting up libsnmp35:amd64 (5.8+dfsg-2ubuntu2.3) ...
Setting up snmpd (5.8+dfsg-2ubuntu2.3) ...
adduser: Warning: The home directory `/var/lib/snmp' does not belong to the user you are currently creating.
Created symlink /etc/systemd/system/multi-user.target.wants/snmpd.service → /lib/systemd/system/snmpd.service.
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for systemd (245.4-4ubuntu3.5) ...
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 mysql-server-8.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

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

2 participants