Ad Widget

Collapse

Ubuntu 18.04 Zabbix 5.0.5 to 5.4 Upgrade Database Failed error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dylanchr3500
    Junior Member
    • May 2021
    • 5

    #1

    Ubuntu 18.04 Zabbix 5.0.5 to 5.4 Upgrade Database Failed error

    Good day All,

    Hoping i can get some assistance. I have followed the guide to upgrade Zabbix 5.0.5 to Zabbix 5.4 and I am receiving the following error in the zabbix log when trying to upgrade the database on service start:

    5476:20210519:074610.624 Unsupported DB! MariaDB version is 50505 which is smaller than minimum of 100037
    5476:20210519:074610.625 current database version (mandatory/optional): 05030069/05030069
    5476:20210519:074610.625 required mandatory version: 05040000
    5476:20210519:074610.625 starting automatic database upgrade
    5476:20210519:074610.626 [Z3005] query failed: [1832] Cannot change column 'scriptid': used in a foreign key constraint 'c_opcommand_2' [alter table opcommand modify `scriptid` bigint unsigned not null]
    5476:20210519:074610.626 database upgrade failed

    I am currently on Ubuntu 18.04 and no packages need to be updated or upgraded. Hopefully someone here can point me in the right direction to fix.
  • Dylanchr3500
    Junior Member
    • May 2021
    • 5

    #2
    I have now done the release upgrade to 20.04 and reinstalled latest MariaDB and packages on 20.04 and i am still getting the same log entries of failed database upgrade.

    Comment

    • BlakeD
      Junior Member
      • May 2021
      • 3

      #3
      Same boat.

      OS: Ubunta 18.04
      Zabbix: 5.0.4 upgrading to 5.4

      Went through the upgrade process documented here (https://www.zabbix.com/documentation.../debian_ubuntu)
      After upgrade completed, I received the following error after restarting the service:
      Database error
      • The Zabbix database version does not match current requirements. Your database version: 5030069. Required version: 5040000. Please contact your system administrator.
      Examining the zabbix_server.log, I find the following:
      Code:
      7989:20210519:100009.216 Zabbix Server stopped. Zabbix 5.0.4 (revision 69c0ad3686).
      19641:20210519:100503.547 Starting Zabbix Server. Zabbix 5.4.0 (revision 5059e20a75).
      19641:20210519:100503.547 ****** Enabled features ******
      19641:20210519:100503.547 SNMP monitoring: YES
      19641:20210519:100503.547 IPMI monitoring: YES
      19641:20210519:100503.547 Web monitoring: YES
      19641:20210519:100503.547 VMware monitoring: YES
      19641:20210519:100503.547 SMTP authentication: YES
      19641:20210519:100503.547 ODBC: YES
      19641:20210519:100503.547 SSH support: YES
      19641:20210519:100503.547 IPv6 support: YES
      19641:20210519:100503.547 TLS support: YES
      19641:20210519:100503.547 ******************************
      19641:20210519:100503.547 using configuration file: /etc/zabbix/zabbix_server.conf
      19641:20210519:100503.583 Unsupported DB! MariaDB version is 50505 which is smaller than minimum of 100037
      19641:20210519:100503.593 current database version (mandatory/optional): 05000000/05000002
      19641:20210519:100503.593 required mandatory version: 05040000
      19641:20210519:100503.593 starting automatic database upgrade
      19641:20210519:100503.963 completed 0% of database upgrade
      19641:20210519:100504.234 completed 1% of database upgrade
      ...
      19641:20210519:100524.483 completed 51% of database upgrade
      19641:20210519:100524.495 [Z3005] query failed: [1832] Cannot change column 'scriptid': used in a foreign key constraint 'c_opcommand_2' [alter table opcommand modify `scriptid` bigint unsigned not null]
      19641:20210519:100524.495 database upgrade failed

      Comment

      • markfree
        Senior Member
        • Apr 2019
        • 868

        #4
        Zabbix Documentation 5.4, states that there were changes in software requirements.

        Software Supported versions Recommended version Comments
        MariaDB 10.0.37-10.5.X 10.5.X InnoDB engine is required. We recommend using the MariaDB Connector/C library for building server/proxy.
        Therefore, MariaDB needs to be "10.0.37 -10.5.X".

        Also, MySQL "error.log" might give you a better error message.
        Code:
        less /var/log/mysql/error.log
        Upgrading MariaDB might be as simple as installing the latest version if it is available.
        First backup everything that is important to you.
        Then, head to MariaDB KB and check your related procedure.
        Code:
        # apt-get install mariadb-server-10.5
        # mysql_upgrade
        After upgrading, check if you need to update your tables row format.
        Last edited by markfree; 20-05-2021, 17:38.

        Comment

        • Dylanchr3500
          Junior Member
          • May 2021
          • 5

          #5
          Hi Mark,

          Thank you for the feedback. I am already on MariaDB 10.1 which should be sufficient, I have reverted the system back to 5.0.5. I will however attempt to upgrade the MariaDB to 10.5 before the zabbix upgrade and see if this makes any difference. I will report back the results.

          Comment

          • BlueBull
            Junior Member
            • Sep 2020
            • 25

            #6
            There is more discussion about this problem in the below thread, including some more information not mentioned in this thread and also a possible solution. Though perhaps wait to try it if you only have a production environment, I'll try out that possible solution on Tuesday and feed back the results

            Thread link

            Comment

            • cybermcm
              Junior Member
              • Jan 2019
              • 13

              #7
              maybe a possible solution here: https://www.zabbix.com/forum/zabbix-...174#post425174
              It still has to be confirmed that it is safe to edit the database this way

              Comment

              • BlueBull
                Junior Member
                • Sep 2020
                • 25

                #8
                I have sent in a bug report, found here: https://support.zabbix.com/browse/ZBX-19435

                Comment

                • Dylanchr3500
                  Junior Member
                  • May 2021
                  • 5

                  #9
                  Thanks All, I have executed the Alter Table statements as mentioned in the other Thread and this has resolved the issue for me as well. Thank you all for the assistance.

                  Comment


                  • BlueBull
                    BlueBull commented
                    Editing a comment
                    Thank you for coming forward and providing feedback. Glad the solution worked for you
                • bwarren
                  Junior Member
                  • May 2021
                  • 2

                  #10
                  I had the same issues from upgrading from 5.2 to 5.4

                  Zabbix was able to process the database upgrade and run successfully after I ran the 3 alter statements.

                  But this is still showing up in /var/log/zabbix/zabbix_server.log:

                  Code:
                  5803:20210528:122736.541 Unsupported DB! MariaDB version is 50505 which is smaller than minimum of 100037
                  5803:20210528:122736.541 current database version (mandatory/optional): 05040000/05040000
                  Despite running MariaDB 10.1.48:

                  Code:
                  MariaDB [(none)]> select version();
                  +----------------------------------+
                  | version() |
                  +----------------------------------+
                  | 10.1.48-MariaDB-0ubuntu0.18.04.1 |
                  +----------------------------------+

                  Comment

                  • Markku
                    Senior Member
                    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                    • Sep 2018
                    • 1781

                    #11
                    Originally posted by bwarren

                    But this is still showing up in /var/log/zabbix/zabbix_server.log:

                    Code:
                    5803:20210528:122736.541 Unsupported DB! MariaDB version is 50505 which is smaller than minimum of 100037
                    5803:20210528:122736.541 current database version (mandatory/optional): 05040000/05040000


                    Markku

                    Comment

                    • vai
                      Junior Member
                      • Jan 2020
                      • 12

                      #12
                      Hi,

                      Can someone please assist me in addressing the issue? Zabbix server version is 5.4.3


                      6526:20210729:120623.833 current database version (mandatory/optional): 05010043/05010043
                      6526:20210729:120623.833 required mandatory version: 05040000
                      6526:20210729:120623.833 starting automatic database upgrade
                      6526:20210729:120623.873 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbixdb`.`widget_field`, CONSTRAINT `c_widget_field_5` FOREIGN KEY (`value_graphid`) REFERENCES `graphs` (`graphid`) ON DELETE CASCADE) [insert into widget_field (widget_fieldid,widgetid,type,name,value_int,value _str,value_itemid,value_graphid) values (3587,990,6,'graphid',0,'',null,469)]
                      6526:20210729:120623.877 database upgrade failed

                      Comment

                      • cyber
                        Senior Member
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • Dec 2006
                        • 4807

                        #13
                        It says, unsupported DB version....
                        If your 18.04 says everything is up to date, it means, needed DB version for your Zabbix upgrade is not available for it... You need to upgrade the platform also.

                        Comment

                        Working...