PaulHowarth/Blog/2009-06-20

Saturday 20th June 2009

Local Packages

Having noticed that there was a kernel update available for CentOS 5, I tried updating one of the CentOS 5 boxes at work. Whilst there were no problems with the CentOS updates, it reported an error regarding one of the packages from my repo:

Error Downloading Packages:
  php-Smarty-2.6.25-1.rhel5.noarch: failure: php-Smarty-2.6.25-1.rhel5.noarch.rpm from city-fan.org: [Errno 256] No more mirrors to try.

This was unexpected because I updated php-Smarty to 2.6.26 yesterday. It's no surprise that 2.6.25 wasn't there but a it shouldn't have been looking for it at all. The first thing I tried was to force-update the metadata for my repo:

# yum --disablerepo=\* --enablerepo=city-fan.org clean metadata
# yum update php-Smarty
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: ftp.heanet.ie
 * base: mirror.bytemark.co.uk
 * addons: mirror.bytemark.co.uk
 * updates: mirror.bytemark.co.uk
 * extras: mirror.bytemark.co.uk
city-fan.org                                                                            | 2.3 kB     00:00     
primary.sqlite.bz2                                                                      | 186 kB     00:00     
http://download.virtensys.com/mirrors/city-fan.org/yum-repo/rhel5/i386/repodata/primary.sqlite.bz2: [Errno -3] Error performing checksum
Trying other mirror.
primary.sqlite.bz2                                                                      | 186 kB     00:00     
http://download.virtensys.com/mirrors/city-fan.org/yum-repo/rhel5/i386/repodata/primary.sqlite.bz2: [Errno -3] Error performing checksum
Trying other mirror.
Error: failure: repodata/primary.sqlite.bz2 from city-fan.org: [Errno 256] No more mirrors to try.

Then I recalled that Fedora 11 (which I've recently migrated by build system to) had a feature of stronger hashes, which includes the RPM package and repository metadata signature algorithms - I was generating repository metadata using the new algorithm (SHA256 in this case) that wasn't understood by older distributions. After some googling I found the solution I needed, a so-far undocumented --checksum option to createrepo that could be used to force the use of the old algorithm. So I changed my repo-building script generator's call to createrepo from this (it's written in awk):

printf "createrepo --update -d .\n"

to this:

if (dist ~ "^fc[1-9][0-9]$") {
        printf "createrepo --update -d .\n"
} else {
       printf "createrepo --update -d --checksum sha .\n"
}

This used the new algorithm for the Fedora 10 repos onwards (F-10's yum should be fine with that) and the old one everywhere else. I rebuild the repository and it improved things but there was still a problem:

# yum update --exclude=moin
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: ftp.heanet.ie
 * base: mirror.bytemark.co.uk
 * addons: mirror.bytemark.co.uk
 * updates: mirror.bytemark.co.uk
 * extras: mirror.bytemark.co.uk
city-fan.org                                                                        | 2.0 kB     00:00     
primary.sqlite.bz2                                                                  | 186 kB     00:00     
Excluding Packages in global exclude list
Finished
Excluding Packages from city-fan.org repository for Red Hat Enterprise Linux (and clones) 5 (i386)
Finished
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package contagged.noarch 0:0.6.5-2.rhel5 set to be updated
---> Package libgcrypt.i386 0:1.4.4-6.0.cf.rhel5 set to be updated
---> Package php-Smarty.noarch 0:2.6.26-1.rhel5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================
 Package             Arch      Version                         Repository                          Size
=======================================================================================================
Updating:
 contagged           noarch    0.6.5-2.rhel5                   city-fan.org                       183 k
 libgcrypt           i386      1.4.4-6.0.cf.rhel5              city-fan.org                       251 k
 php-Smarty          noarch    2.6.26-1.rhel5                  city-fan.org                       159 k

Transaction Summary
=======================================================================================================
Install      0 Package(s)         
Update       3 Package(s)         
Remove       0 Package(s)         

Total download size: 593 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): php-Smarty-2.6.26-1.rhel5.noarch.rpm                                             | 159 kB     00:00     
http://download.virtensys.com/mirrors/city-fan.org/yum-repo/rhel5/i386/php-Smarty-2.6.26-1.rhel5.noarch.rpm: [Errno -1] Package does not match intended download
Trying other mirror.
(2/3): contagged-0.6.5-2.rhel5.noarch.rpm                                               | 183 kB     00:00     
http://download.virtensys.com/mirrors/city-fan.org/yum-repo/rhel5/i386/contagged-0.6.5-2.rhel5.noarch.rpm: [Errno -1] Package does not match intended download
Trying other mirror.
(3/3): libgcrypt-1.4.4-6.0.cf.rhel5.i386.rpm                                            | 251 kB     00:00     
http://download.virtensys.com/mirrors/city-fan.org/yum-repo/rhel5/i386/libgcrypt-1.4.4-6.0.cf.rhel5.i386.rpm: [Errno -1] Package does not match intended download
Trying other mirror.
--------------------------------------------------------------------------------------------------------
Total                                                                          4.5 MB/s | 593 kB     00:00     


Error Downloading Packages:
  php-Smarty-2.6.26-1.rhel5.noarch: failure: php-Smarty-2.6.26-1.rhel5.noarch.rpm from city-fan.org: [Errno 256] No more mirrors to try.
  contagged-0.6.5-2.rhel5.noarch: failure: contagged-0.6.5-2.rhel5.noarch.rpm from city-fan.org: [Errno 256] No more mirrors to try.
  libgcrypt-1.4.4-6.0.cf.rhel5.i386: failure: libgcrypt-1.4.4-6.0.cf.rhel5.i386.rpm from city-fan.org: [Errno 256] No more mirrors to try.

This was due to my use of the --update option to createrepo; it was re-using the existing metadata for the packages, which had been generated using the wrong hash algorithm and hence the repository metadata was now OK but the package metadata was still broken. So I re-ran the repo build without the --update option and everything was fine after that. I've now turned the --update option back on.


Recent