[zypp-devel] RPM database is inconsistent when a running instance of zypper was interrupted
Hi , I recently encountered a problem using zypper install my package. I hope to get your help, thank you very much. Product: SUSE Linux Enterprise Server 11 SP3 (x86_64) Other Software and Versions Being Used: zypper-1.6.327-9.9 rpm-4.4.2.3-37.56.1 rpm-python-4.4.2.3-37.46.7 libzypp-9.38.8-0.7.1 Steps to reproduce: step 1. I build a custom RPM package, then build a zypper repo. custom RPM name: upg-client-1.0.0-1.x86_64 zypper repo: zypper ar file:///usr/src/packages/RPMS/ myrepo zypper refresh step 2. Write two Bash scripts for testing (contexts of these scripts shown in Additional Information), one for installing upg-client RPM and another for reproduce this problem. step 3. Run installing script, then run reproduce script. When the installing script is stopped, we can see that "rpm -qa |grep upg-client " and "rpm -q upg-client" is inconsistent. Additional: [script for installing upg-client RPM:] #!/bin/bash LOG_FILE=/home/cps/auto_run_new_2.log count=1 touch $LOG_FILE while true; do rpm -q upg-client if [ $? -ne 0 ];then echo "[`date`] upg-client-1.0.0-1.x86_64 not install, now install" >> $LOG_FILE zypper -n --gpg-auto-import-keys --no-gpg-checks in upg-client-1.0.0-1.x86_64 if [ $? -ne 0 ];then echo "[`date`] install upg-client-1.0.0-1.x86_64 failed" >> $LOG_FILE # exit 1 fi fi echo "==============sleep=================" echo "[`date`] =======sleeping 6=======" >> $LOG_FILE sleep 3 XXX=`sudo rpm -qa| grep upg-client` YYY=`sudo rpm -q upg-client` if [ x$XXX = x$YYY ];then echo "[`date`] auto:$count======ok======= " >> $LOG_FILE ((count++)) else if [ x$XXX = x ];then echo "[`date`] auto:$count======ok=======" >> $LOG_FILE ((count++)) else echo "[`date`] error" exit 1 fi fi echo ===remove======= zypper -n --gpg-auto-import-keys --no-gpg-checks remove -u upg-client-1.0.0-1.x86_64 if [ $? -ne 0 ];then echo "[`date`] uninstall upg-client-1.0.0-1.x86_64 failed" >> $LOG_FILE exit 1 fi done =============Dividing line================ [script for reproduce the problem:] #!/bin/bash while true do #find child rpm process pid=`ps aux| grep /var/cache/zypp/packages/myrepo/x86_64/upg-client-1.0.0-1.x86_64.rpm | grep '\-U' | awk '{print $2}'` if [ x$pid != x ];then kill -9 $pid echo yes else echo no fi sleep 0.5 done =============Dividing line================ [SPEC of upg-client package, we can run "dd if=/dev/zero of=./xxx bs=10M count=1" to create file "xxx"] Name:upg-client Summary:TEST Version:1.0.0 Release:1 Group:NCU License:GPL Vendor:NCU Source0: upg-client-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description upg-client %prep %setup -q -n %{name}-%{version} %install file_list=$(find .) rm -rf %{buildroot} for file in $file_list do if [ -d $file ];then install -d %{buildroot}/$file elif [ -f $file ];then install -c -m 755 $file %{buildroot}/$file fi done %post %files %dir /usr/local/bin/upg-client /usr/local/bin/upg-client/xxx %changelog * Tue Nov 17 2015 EDU - test
On Monday 02 May 2016 18:05:20 李明 wrote:
I recently encountered a problem using zypper install my package. I hope to get your help, thank you very much.
Your problem is probably not zypper specific. If you kill to the rpm process installing your package, you're always in danger of breaking the rpm database. If you're lucky only the index files are out of sync. Try: rpm --rebuilddb -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres SUSE LINUX GmbH, Development, ma@suse.com Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 74 053-0 +------------------------------------------------------------------+ SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
participants (2)
-
Michael Andres
-
李明