Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

Fresh OCS 2.8 install web form MySQL Err 2002

Hi,

Mandatories informations :

- Provide OS server and agent version :     Ubuntu 20.04.1 LTS / No agent yet.

- Provide OCS agent and server version :    No agent yet / installed from OCSNG_UNIX_SERVER_2.8.tar.gz.

- Give agent logs in debug mode :           No agent yet.

Today Logs:

BEGIN - /var/log/apache2/error.log

I had to modify server IP address in Apache conf (site-available) (working at work / working at home), maybe those following lines are because of that ? I cannot say.

[Mon Dec 21 13:48:34.209726 2020] [ssl:warn] [pid 1300] AH01906: ocs.inventaire.local:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

[Mon Dec 21 13:48:34.209758 2020] [ssl:warn] [pid 1300] AH01909: ocs.inventaire.local:443:0 server certificate does NOT include an ID which matches the server name

[Mon Dec 21 13:48:34.247116 2020] [ssl:warn] [pid 1302] AH01906: ocs.inventaire.local:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

[Mon Dec 21 13:48:34.247133 2020] [ssl:warn] [pid 1302] AH01909: ocs.inventaire.local:443:0 server certificate does NOT include an ID which matches the server name

[Mon Dec 21 13:48:34.249060 2020] [mpm_prefork:notice] [pid 1302] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations

[Mon Dec 21 13:48:34.249633 2020] [core:notice] [pid 1302] AH00094: Command line: '/usr/sbin/apache2'

[Mon Dec 21 13:51:02.611122 2020] [mpm_prefork:notice] [pid 1302] AH00169: caught SIGTERM, shutting down

[Mon Dec 21 13:51:02.680303 2020] [ssl:warn] [pid 1345] AH01906: ocs.inventaire.local:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

[Mon Dec 21 13:51:02.680337 2020] [ssl:warn] [pid 1345] AH01909: ocs.inventaire.local:443:0 server certificate does NOT include an ID which matches the server name

[Mon Dec 21 13:51:02.708804 2020] [ssl:warn] [pid 1346] AH01906: ocs.inventaire.local:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

[Mon Dec 21 13:51:02.708824 2020] [ssl:warn] [pid 1346] AH01909: ocs.inventaire.local:443:0 server certificate does NOT include an ID which matches the server name

[Mon Dec 21 13:51:02.710721 2020] [mpm_prefork:notice] [pid 1346] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations

[Mon Dec 21 13:51:02.710738 2020] [core:notice] [pid 1346] AH00094: Command line: '/usr/sbin/apache2'

---

I think those following lines came after I filled (and sent) the installation web formular.

[Mon Dec 21 13:55:15.876152 2020] [php7:warn] [pid 1349] [client 192.168.1.128:60182] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 67, referer: https://192.168.1.156/ocsreports/

[Mon Dec 21 13:55:15.876207 2020] [php7:warn] [pid 1349] [client 192.168.1.128:60182] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 104, referer: https://192.168.1.156/ocsreports/

[Mon Dec 21 13:55:15.876225 2020] [php7:warn] [pid 1349] [client 192.168.1.128:60182] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 38, referer: https://192.168.1.156/ocsreports/

[Mon Dec 21 13:55:15.877796 2020] [php7:warn] [pid 1349] [client 192.168.1.128:60182] PHP Warning:  mysqli_real_connect(): this stream does not support SSL/crypto in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 177, referer: https://192.168.1.156/ocsreports/

[Mon Dec 21 13:55:15.877841 2020] [php7:warn] [pid 1349] [client 192.168.1.128:60182] PHP Warning:  mysqli_real_connect(): Cannot connect to MySQL by using SSL in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 177, referer: https://192.168.1.156/ocsreports/

[Mon Dec 21 13:55:15.877854 2020] [php7:warn] [pid 1349] [client 192.168.1.128:60182] PHP Warning:  mysqli_real_connect(): [2002]  (trying to connect via (null)) in /usr/share/ocsinventory-reports/ocsreports/require/function_commun.php on line 177, referer: https://192.168.1.156/ocsreports/

END - /var/log/apache2/error.log

---

find / -name activity.log => no activity.log ?

---

BEGIN - /var/log/mysql/error.log

2020-12-21T13:36:20.290936Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.3) starting as process 744

2020-12-21T13:36:20.341566Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2020-12-21T13:36:22.071523Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2020-12-21T13:36:22.412359Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock

2020-12-21T13:36:22.461747Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...

2020-12-21T13:36:22.469137Z 0 [System] [MY-010232] [Server] XA crash recovery finished.

2020-12-21T13:36:22.720750Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2020-12-21T13:36:22.720930Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.

2020-12-21T13:36:22.742050Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22-0ubuntu0.20.04.3'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).

END - /var/log/mysql/error.log

---

- sites-available/inventaire.conf

<VirtualHost 192.168.1.156:80>#10.63 work address

        ServerName ocs.inventaire.local

        ServerAdmin xxx

        DocumentRoot /usr/share/ocsinventory-reports

</VirtualHost>

<VirtualHost 192.168.1.156:80>#10.63

        ServerName test.inventaire.local

        ServerAdmin xxx

        DocumentRoot /var/www/test

</VirtualHost>

---

- sites-available/inventaire-ssl.conf

<VirtualHost 192.168.1.156:443>#10.63 work address

   ServerName ocs.inventaire.local

   DocumentRoot /usr/share/ocsinventory-reports

   SSLEngine on

   SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt

   SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

</VirtualHost>

<VirtualHost 192.168.1.156:80>#10.63

    ServerName ocs.inventaire.local

    Redirect / https://192.168.1.156/#10.63 work address

</VirtualHost>

---

apachectl configtest

Syntax OK

- "#10.63 work address" does not make problem.

---

- client /etc/hosts

127.0.0.1       localhost

127.0.1.1       Nils-Inspiron-7380

192.168.10.60   unifi.local

#192.168.10.63  inventaire.local

192.168.10.63   ocs.inventaire.local

192.168.10.63   test.inventaire.local

Addresse 192.168.10.63 is at work.

I did not change again that now ; at home, server address is 192.168.1.156.

I wrote in browser https://192.168.1.156/ocsreports (it works), and not https://ocs.inventaire.local/ocsreports

When OCS will be working, test.inventaire.local will be glpi.inventaire.local

---

Issue :

- Server is running under Virtual Box on local machine.

Third fresh Installed. Local (192.168.x.x), tests server purpose.

Fist one, following this how-to : https://www.infotrucs.fr/tuto-installer-glpi-et-ocsinventory-sous-debian-9/

Did not work, due to SSL problem, I forgot what exactly.

Second and Third tries, with OCS documentation.

Second one with MariaDB (and a piece of MySQL), Third one (the last one) with MySQL (without MariaDB).

At first,

[The terminal shows : "Then, point your browser to http://server//ocsreports" => I suppose, simply a mistake with those double // => server//ocsreports]

I was surprised http://server/ocsreports did not work => http://192.168.myServer.IP/ocsreports

Nothing in Apache site-available directory. I wrote an sites-available/inventaire.conf file myself and a2ensite it, and web site started.

And I manage to have it as httpS and redirect http to https, all this worked.

When I created the selfsigned certicate, I paid attention to the question :

- Common Name (e.g. server FQDN or YOUR name) []:ocs.inventaire.local

hostname = ocs.inventaire.local

Install web formular shows :

- post_max_size and upload_max_size issue => I will fix this later ...

- Var lib dir should be writable : /var/lib/ocsinventory-reports => Fixed like that, chmod o+w : drwxr-xrWx 7 root root 4096 Dec 18 10:06 ocsinventory-reports - It worked, message disapeared after page refresh.

I filled the install web formular like that :

MySQL login:     ocs

MySQL password:         xxxxx

Name of Database:     ocsweb

MySQL HostName:         localhost

MySQL Port :     3306

Enable SSL:         YES

SSL mode:     ...DONT_VERIFY...

SSL key path:     /etc/ssl/private/apache-selfsigned.key

SSL certificat path: /etc/ssl/certs/apache-selfsigned.crt

CA certificat path:     Empty - Nothing here as it is a self signed certificate.

I had read a lot, and tryed a lot empirically, but I do not have the knowledges to understand and take it further.

I found something about socks, and MySQLi and MySQLx (php.ini), but I cannot undertand what to do.

I don't know how to troubleshoot this issue.

Searching "MySQL 2002" within OCS forum did not show anything relevant.

Thank you for helping.

Feel free to ask for more, if I ommited some information to give.

Nils.

in OCS Inventory NG server for Unix by (200 points)

1 Answer

0 votes
Have you tried an non secured connection without autenication? These would help to check is it an :"server configuration" or "securing connection" or "client authentication" problem... If it will work correctly then you should enable security settings. Beside this I'm not sure but i think that FQDN should be without ".local" . This only should be written in web browser as an localisation for the server.
As I configured own mail server there it was like this:

In /etc/hosts
fqdn was:

192.168.0.100<--->admin.post.hopto.org

as an "admin.post.hopto.org" was my hostname in /etc/hostname

so the ".local" was not needed.

Hope I helped :)
by (2.9k points)
 
Powered by Question2Answer
...