Fehler bei Opsi Installation

Antworten
boehmichen
Beiträge: 2
Registriert: 28 Sep 2020, 17:12
Kontaktdaten:

Fehler bei Opsi Installation

Beitrag von boehmichen »

Hallo,

ich bin dabei einen OPSI-Server auf Centos 7 zu installieren. Das hat in der Vergangenheit eigentlich ganz gut geklappt. Nur diesmal erhalten ich die folgende Fehlermeldung nach dem ich " opsi-setup --configure-mysql " ausführen wollte:

[2] [Sep 28 17:14:15] Traceback: (Logger.py|798)
[2] [Sep 28 17:14:15] File "/usr/bin/opsi-setup", line 1163, in <module>
main()
(Logger.py|798)
[2] [Sep 28 17:14:15] File "/usr/bin/opsi-setup", line 1121, in main
configureMySQLBackend(unattended)
(Logger.py|798)
[2] [Sep 28 17:14:15] File "/usr/bin/opsi-setup", line 352, in configureMySQLBackend
errorFunction=errorFunction
(Logger.py|798)
[2] [Sep 28 17:14:15] File "/usr/lib/python2.7/site-packages/OPSI/Util/Task/ConfigureBackend/MySQL.py", line 123, in configureMySQLBackend
raise exc
(Logger.py|798)
[2] [Sep 28 17:14:15] ==>>> (1293, 'Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause') (opsi-setup|1167)

ERROR: (1293, 'Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause')
#################
Das habe ich davor gemacht:
12 yum -y install mariadb-server samba
13 systemctl start smb.service
14 systemctl start nmb.service
15 systemctl start mariadb.service
16 systemctl enable smb.service
17 systemctl enable nmb.service
18 systemctl enable mariadb.service
19 mysql_secure_installation
20 vi /etc/my.cnf ( sql_mode=NO_ENGINE_SUBSTITUTION eingetragen)
21 service mariadb restart
22 c d /etc/yum.repos.d/
23 yum -y install wget mlocate net-tools yum-utils sysstat
24 wget https://download.opensuse.org/repositor ... table.repo
25 yum makecache
27 yum install -y opsi-server
28 yum install -y opsi-configed
29 yum install -y opsi-windows-support

Hab' ich was falsch gemacht oder ist da ein Fehler in der Tabellen-Definition der OPSI-Datenbank?

Ich wäre für einen Fingerzeig sehr dankbar ;-)
Beste Grüße
Matthias
Benutzeravatar
m.radtke
uib-Team
Beiträge: 1528
Registriert: 10 Jun 2015, 12:19

Re: Fehler bei Opsi Installation

Beitrag von m.radtke »

Hi

das Problem ist wohl mit den letzten MySQL Updates hinzugekommen.
Kannst versuchen den mysql Struct mode auszuschalten und schauen ob das hilft

Code: Alles auswählen

MySQL-Server verwendet seit Version 5.7 den vorher optionalen strict mode nun standardmäßig.
Dies führt zu einem Fehlschlag des Befehls opsi-setup --configure-mysql.
Dementsprechend sollte vor dem Befehlsaufruf die Datei /etc/mysql/mysql.conf.d/mysqld.cnf editiert werden.
In der [mysqld] Sektion muss nun folgende Zeile eingefügt werden:
sql_mode=NO_ENGINE_SUBSTITUTION

Danach muss der Dienst mysql neu gestartet werden: systemctl restart mysql.service
Gruß
Mathias
Kein Support per DM!
_________________________
opsi support - http://www.uib.de/
For productive opsi installations we recommend support contracts.
boehmichen
Beiträge: 2
Registriert: 28 Sep 2020, 17:12
Kontaktdaten:

Re: Fehler bei Opsi Installation

Beitrag von boehmichen »

Hallo Matthias,

danke für den Tipp. Die SQL-Substitution hatte ich schon drin in der my.cnf. Daran lag es m.E nicht.

Ich konnte das Problem dadurch "lösen", dass ich in den Tabellen-Definitionen unter /usr/lib/python2.7/site-packages/OPSI/Backend in den Dateien SQL.py und MySQL.py den zweiten Eintrag mit dem Inhalt "... default CURRENT_TIMESTAMP" für die Tabelle "HOST" und "SOFTWARE_CONFIG" durch "DEFAULT 0" ersetzt habe. Laut mysql-DOku ersetzt mysql das intern dann mit "0000-00-00 00:00:00"

Bsp. wie HOST danach aussieht:
...
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`lastSeen` TIMESTAMP DEFAULT 0 ,
...

Damit ging die Installation von OPSI dann . Ich hoffe ich habe damit nichts wesentliches in der DB-Konfig zerschossen.
Ich habe zur Sicherheit die Tabellen-Definition einmal mit einer anderen funktionierenden OPSI-Installation verglichen, die ich vor ca 3 Monaten gemacht habe und dort sieht die Tabelle nach der Installation genauso aus:
MariaDB [opsi]> describe HOST;
+---------------------+--------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------------------+-------+
| hostId | varchar(255) | NO | PRI | NULL | |
| type | varchar(30) | YES | MUL | NULL | |
| description | varchar(100) | YES | | NULL | |
| notes | varchar(500) | YES | | NULL | |
| hardwareAddress | varchar(17) | YES | | NULL | |
| ipAddress | varchar(15) | YES | | NULL | |
| inventoryNumber | varchar(64) | YES | | NULL | |
| created | timestamp | NO | | CURRENT_TIMESTAMP | |
| lastSeen | timestamp | NO | | 0000-00-00 00:00:00 | |
....

Beste Grüße
Matthias
beste Grüße
Matthias
https://www.biteno.com
stephenw
Beiträge: 4
Registriert: 16 Dez 2020, 16:22

Re: Fehler bei Opsi Installation

Beitrag von stephenw »

Hi

Very sorry to post here, but it is the only post that comes up with the error I am getting.

Is there any you could let me know exactly what I need to change in the files, sorry I can not figure out what needs to be changed
in the SQL.py and MySQL.py scripts, this is the error I am getting which seems to be the same as yours?

opsi-setup --configure-mysql
[2] [Dec 16 15:41:49] Traceback: (Logger.py|798)
[2] [Dec 16 15:41:49] File "/bin/opsi-setup", line 1163, in <module>
main()
(Logger.py|798)
[2] [Dec 16 15:41:49] File "/bin/opsi-setup", line 1121, in main
configureMySQLBackend(unattended)
(Logger.py|798)
[2] [Dec 16 15:41:49] File "/bin/opsi-setup", line 352, in configureMySQLBackend
errorFunction=errorFunction
(Logger.py|798)
[2] [Dec 16 15:41:49] File "/usr/lib/python2.7/site-packages/OPSI/Util/Task/ConfigureBackend/MySQL.py", line 123, in configureMySQLBackend
raise exc
(Logger.py|798)
[2] [Dec 16 15:41:49] ==>>> (1293, 'Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause') (opsi-setup|1167)

ERROR: (1293, 'Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause')
Benutzeravatar
ThomasT
uib-Team
Beiträge: 538
Registriert: 26 Jun 2013, 12:26

Re: Fehler bei Opsi Installation

Beitrag von ThomasT »

Hello Stephen,

make sure your SQL-DB is actually running in SQL-Mode "NO_ENGINE_SUBSTITUTION", you can find out with the following:
Log into your DB

Code: Alles auswählen

mysql -u root -p
There you can execute

Code: Alles auswählen

SHOW VARIABLES LIKE 'sql_mode';
The Output has to be like:

Code: Alles auswählen

+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| sql_mode      | NO_ENGINE_SUBSTITUTION |
+---------------+------------------------+
1 row in set (0.01 sec)
Kein Support per DM!
_________________________
opsi support - https://www.uib.de/
For productive opsi installations we recommend support contracts.
stephenw
Beiträge: 4
Registriert: 16 Dez 2020, 16:22

Re: Fehler bei Opsi Installation

Beitrag von stephenw »

Hi

Thanks, yes it is running "NO_ENGINE_SUBSTITUTION",

Code: Alles auswählen

MariaDB [(none)]> SHOW VARIABLES LIKE 'sql_mode';
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| sql_mode      | NO_ENGINE_SUBSTITUTION |
+---------------+------------------------+
1 row in set (0.01 sec)

MariaDB [(none)]>
stephenw
Beiträge: 4
Registriert: 16 Dez 2020, 16:22

Re: Fehler bei Opsi Installation

Beitrag von stephenw »

Hi All

Still getting the same error, any one got any ideas?
stephenw
Beiträge: 4
Registriert: 16 Dez 2020, 16:22

Re: Fehler bei Opsi Installation

Beitrag von stephenw »

Hi

I have fixed the error.

Edit the following files

Code: Alles auswählen

/usr/lib/python2.7/site-packages/OPSI/Backend/SQL.py
/usr/lib/python2.7/site-packages/OPSI/Backend/MySQL.py

Search for

Code: Alles auswählen

table = u'''CREATE TABLE `HOST` (
and

Code: Alles auswählen

table = u'''CREATE TABLE `SOFTWARE_CONFIG` (
Replace:

Code: Alles auswählen

TIMESTAMP DEFAULT CURRENT_TIMESTAMP
with

Code: Alles auswählen

TIMESTAMP DEFAULT 0
Benutzeravatar
ueluekmen
uib-Team
Beiträge: 1939
Registriert: 28 Mai 2008, 10:53

Re: Fehler bei Opsi Installation

Beitrag von ueluekmen »

Moin,

wir hatten das Problem mit Centos7 jetzt ein paar mal. Vielleicht hilft es auch dem ein oder anderen, man sollte MariaDB aus den offiziellen MariaDB Repos installieren, so ist es auch dokumentiert:

https://download.uib.de/opsi4.1/documen ... entos-rhel

Sollte das Problem auch mit einem aktuellen MariaDB auf einem Centos7 weiterhin bestehen, bitte noch mal melden.

Den Code manuell zu patchen ist nicht ratsam. ;)

Hilft das?
opsi support - uib gmbh
For productive opsi installations we recommend support contracts.
http://www.uib.de
AlexB
Beiträge: 80
Registriert: 07 Mär 2017, 17:41

Re: Fehler bei Opsi Installation

Beitrag von AlexB »

ueluekmen hat geschrieben:Moin,

wir hatten das Problem mit Centos7 jetzt ein paar mal. Vielleicht hilft es auch dem ein oder anderen, man sollte MariaDB aus den offiziellen MariaDB Repos installieren, so ist es auch dokumentiert:

https://download.uib.de/opsi4.1/documen ... entos-rhel
Hatte ein ähnliches Problem. Konnte damit nicht behoben werden.
In der Doku sollte aber noch der der GPG Key in der Repo auf:

file:///etc/pki/rpm-gpg/RPM-GPG-KEY-MariaDB

angepasst werden.

EDIT:

FEHLER GEFUNDEN

Nach dem Upgrade von der CentOS 7 Repo Version von MariaDB auf die Version ausm Maria Repo.

UNBEDINGT mysql_upgrade AUSFÜHREN!!

Danach geht auch das init-current-config über opsi-setup!
Antworten