SMT: How to re-create a corrupted MariaDB database.

This document (000020876) is provided subject to the disclaimer at the end of this document.

Environment

Subscription Management Tool
SUSE Linux Enterprise Server 12 GA
SUSE Linux Enterprise Server 12 SP1
SUSE Linux Enterprise Server 12 SP2
SUSE Linux Enterprise Server 12 SP3
SUSE Linux Enterprise Server 12 SP4
SUSE Linux Enterprise Server 12 SP5

Situation

The MariaDB database of a running SMT server is corrupted and must be re-created.

Resolution

In order to re-create a corrupted database, open a root session on the SMT server and follow these steps:

1- Stop SMT and MariaDB services with:

# systemctl stop apache2.service

# systemctl stop mysql.service

# systemctl stop smt.service



2- Double-check that services are stopped:

# systemctl status apache2.service

# systemctl status mysql.service

# systemctl status smt.service



3- Once all services are stopped, create a backup copy of the SMT configuration file:

# cp -p /etc/smt.conf /etc/smt.conf.bck


4- Then proceed with the uninstallation of MariaDB:

# zypper remove mariadb mariadb-client mariadb-errormessages libmysqlclient18 perl-DBD-mysql


5- Once the packages are removed, then clean-up manually all the database files:

NOTE: deleting files in /var/lib/mysql/ will destroy all MariaDB databases and data.

# rm -rf /var/lib/mysql/*


6- Reinstall MariaDB with:

# zypper install mariadb mariadb-client mariadb-errormessages libmysqlclient18 perl-DBD-mysql smt


7- Start the MariaDB service:

# systemctl start mysql.service

# systemctl status mysql.service



8- Set the root password for MariaDB with:

# /usr/bin/mysqladmin -u root password 'NEW-PASS-HERE'


9- Create SMT database, follow the instructions on screen, set a password for the "root" user, then create the user "smt" and assign it the same password used for the "root" user.:

# /usr/lib/SMT/bin/smt-db setup


10- Initialize the SMT database with:

# /usr/lib/SMT/bin/smt-db migrate
      
# /usr/bin/smt-schema-upgrade



11- Restore the SMT configuration file from the backup copy, and assign the proper permissions to the SMT related files:

# cp -p /etc/smt.conf.bck /etc/smt.conf

# /usr/lib/SMT/bin/changeSMTUserPermissions.sh -y --user smt



12- Restart MariaDB and start SMT services:

# systemctl start smt.service

# systemctl start apache2.service

# systemctl restart mysql.service



13- Once the SMT is up and running, run the reset and the sync operations:

# smt-register --debug --verboselevel 127 --reseterror

# smt-sync --debug --verboselevel 127 --logfile /tmp/smt-sync-d3.txt


 

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020876
  • Creation Date: 29-Nov-2022
  • Modified Date:29-Nov-2022
    • Subscription Management Tool
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center