Forum: CFEngine Help Subject: Re: Thread died in Berkeley DB library Author: msvob...@linkedin.com Link to topic: https://cfengine.com/forum/read.php?3,26071,27583#msg-27583
Hey Roman Sorry nobody responded to you on this. Here is my solution. I hit the same exact problem. I perform two RPM health checks. If rpmdb_verify fails against /var/lib/rpm/Packages, or I can't query the cfengine-community rpm successfully, I rebuild the rpm databases. classes: linux:: "rpm_databases_healthy" expression => returnszero("/usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages > /dev/null 2>&1", "useshell"); linux:: "rpm_second_health_check" expression => returnszero("/bin/rpm -q cfengine-community > /dev/null 2>&1", "useshell"); files: linux.(!rpm_databases_healthy|!rpm_second_health_check):: "/var/lib/rpm/" handle => "clean_corrupted_rpm_database_files", delete => tidy, depth_search => recurse("1"), file_select => clean_corrupted_rpm_databases, classes => if_repaired("rpm_databases_removed"); commands: linux.rpm_databases_removed.(!rpm_databases_healthy|!rpm_second_health_check):: "/bin/rpm --rebuilddb"; reports: linux.(!rpm_databases_healthy|!rpm_second_health_check):: "cf3: The RPM databases on $(sys.host) were found to be corrupt. Removing /var/lib/rpm/__db.00[1-4] and rebuilding the RPM databases."; ############################################################################################# body file_select clean_corrupted_rpm_databases { leaf_name => { "__db\.00.+" }; file_result => "leaf_name"; } Here it is in action all its glory. # /var/cfengine/bin/cf-agent -I -K -b yum_install_linux_packages >> Using command line specified bundlesequence -> Deleted file /var/lib/rpm/__db.004 -> Deleted file /var/lib/rpm/__db.003 -> Deleted file /var/lib/rpm/__db.002 -> Deleted file /var/lib/rpm/__db.001 -> Executing '/bin/rpm --rebuilddb' ...(timeout=-678,owner=-1,group=-1) -> Completed execution of /bin/rpm --rebuilddb R: cf3: The RPM databases on ech3-32570-mps02.prod were found to be corrupt. Removing /var/lib/rpm/__db.00[1-4] and rebuilding the RPM databases. Cheers Mike _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine