updating woes with apt and rpm

Matthew Smith <[email protected]> Wed, 22 Mar 2006 16:24:18 +1100
Newsgroups gmane.linux.conectiva.apt-rpm
Message-ID <[email protected]>
Hello!

I hope this is appropriate for this list, sorry if it is not. I am running out 
of ideas...

I maintain an apt repository that updates 100+ servers (running a custom RHEL 
respin). I don't have direct access to these servers, so I can't run command 
or alter them directly. The servers are updated when the people responsible 
for each machine triggers an update (then a cron job triggers apt-get 
--assume-yes dist-upgrade that night).

I have a series of updates that I'd like to roll out to these machines, but I 
am having trouble with 2 critical packages. When both these packages are 
updated (along with all the other packages in my update) the RPM database 
becomes corrupt, with the following error:

rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30978) from dbenv->close: DB_RUNRECOVERY: Fatal error, run 
database recovery

If I then do the following:
rm -f /var/lib/rpm/__db*
db_verify /var/lib/rpm/Packages
rpm --rebuilddb

the rpm errors no longer occur, and everything works fine from then on in. 
Sadly it is not feasible to run this on every machine after the update, as 
the ends users to not have the required knowedge and the task of getting 
access to every one and altering them is rather daunting.

I discovered that by installing rpm 4.2.3-24 onto my test server beforehand, 
then doing a 'dist-upgrade', everything runs through fine. If I add that 
version of rpm to my repository, then any subsequent runs of apt-get 
dist-upgrade gives me a massive list of dependency errors, and a "-f install" 
gets apt to reinstall the missing packages. In other words, the rpm database 
is still getting corrupted in some slightly different way. I assume the new 
version of rpm would only be used after the work apt-get is doing completes, 
so this is not a supprise.

So the only way that I can see to upgrade these machines is by getting a 
select few packages to install, then install the rest on a second run of apt. 
All of this needs to be done by altering the apt repository, as I cannot make 
changes to the servers directly.

I can't simply make one lot of packages available, then after a period of time 
make another lot available, as I can only inform the users that updates are 
there - I cannot force them to make the upgrade. I can be sure that many of 
the users will not update when prompted. Any solution would need to be able 
to work now and into the future.

Is there a way that I can stagger the updates to my machines? I notice that  
apt will hold back a package if a dependency is not met. Is there a way to 
set up my dependencies to solve this? alternatively, is there any other 
solution that can get around this problem?

Thanks for any help that can be given.

Cheers,

Matthew Smith