Header Shadow Image


Metadata file does not match checksum

Getting this?  

repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz from anaconda: [Errno 256] No more mirrors to try.
file:///run/install/repo/repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz: [Errno -1] Metadata file does not match checksum

First, get access to the Anaconda Installer.  Once there check log files under /tmp/:

[anaconda root@localhost tmp]# grep -Ei primary syslog
09:26:10,759 INFO kernel:kvm-clock: cpu 0, msr 1:3ff85001, primary cpu clock
09:26:12,371 INFO kernel:fbcon: cirrusdrmfb (fb0) is primary device
15:09:14,593 NOTICE kernel:type=1400 audit(1585494554.591:241): avc:  denied  { add_name } for  pid=3276 comm="cp" name="4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz" scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=dir permissive=1
15:09:14,593 NOTICE kernel:type=1400 audit(1585494554.591:242): avc:  denied  { create } for  pid=3276 comm="cp" name="4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz" scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=1
15:09:14,593 NOTICE kernel:type=1400 audit(1585494554.591:243): avc:  denied  { write open } for  pid=3276 comm="cp" path="/root/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz" dev="dm-0" ino=42 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=1
15:09:22,413 NOTICE kernel:type=1400 audit(1585494562.410:244): avc:  denied  { read } for  pid=3285 comm="gzip" name="4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz" dev="dm-0" ino=42 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=1
15:09:22,461 NOTICE kernel:type=1400 audit(1585494562.459:245): avc:  denied  { setattr } for  pid=3285 comm="gzip" name="4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml" dev="dm-0" ino=43 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=1
15:09:22,461 NOTICE kernel:type=1400 audit(1585494562.459:246): avc:  denied  { remove_name } for  pid=3285 comm="gzip" name="4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz" dev="dm-0" ino=42 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=dir permissive=1
15:09:22,461 NOTICE kernel:type=1400 audit(1585494562.459:247): avc:  denied  { unlink } for  pid=3285 comm="gzip" name="4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz" dev="dm-0" ino=42 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=1
15:27:53,152 NOTICE kernel:type=1400 audit(1585495673.150:277): avc:  denied  { ioctl } for  pid=4289 comm="grep" path="/root/primary-audit.log" dev="dm-0" ino=42 ioctlcmd=5401 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=1
[anaconda root@localhost tmp]#

[anaconda root@localhost tmp]# grep -Ei primary packaging.log
09:27:14,924 ERR packaging: failed to grab repo metadata for anaconda: failure: repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz from anaconda: [Errno 256] No more mirrors to try.
file:///run/install/repo/repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz: [Errno -1] Metadata file does not match checksum
09:27:15,506 ERR packaging: failed to grab repo metadata for anaconda: failure: repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz from anaconda: [Errno 256] No more mirrors to try.

Compate sizes:

[anaconda root@localhost ~]# ls -altri
47 -rw-r–r–.  1 root root 429230 Mar 29 17:58 4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
[anaconda root@localhost ~]# gunzip 4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
[anaconda root@localhost ~]# ls -altri

48 -rw-r–r–.  1 root root 2945797 Mar 29 17:58 4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml

[anaconda root@localhost ~]# vi /run/install/repo/repodata/repomd.xml
[anaconda root@localhost ~]# grep primary -B2 -A3 /run/install/repo/repodata/repomd.xml
<data type="primary">
  <checksum type="sha256">4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1</checksum>
  <open-checksum type="sha256">e5ed6464a921cfe6db58eca8b5564e70b7d5724b866c9fad680c95965eda2341</open-checksum>
  <location href="repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz"/>
  <timestamp>1585457193</timestamp>
  <size>410730</size>
  <open-size>2945797</open-size>
</data>
[anaconda root@localhost ~]#

Looking carefully, the source code shows this:

        try: # get the local checksum
            l_csum = self._checksum(r_ctype, file, datasize=size)
        except Errors.RepoError, e:
            if check_can_fail:
                return None
            raise URLGrabError(-3, 'Error performing checksum: %s' % e)

        if l_csum == r_csum:
            _xattr_set_chksum(file, r_ctype, l_csum)
            if not openchecksum:
                self._preload_to_cashe(r_ctype, r_csum, file)
            return 1
        else:
            if check_can_fail:
                return None
            raise URLGrabError(-1, 'Metadata file does not match checksum')

Looking locally:

[anaconda root@localhost ~]# find / -iname yumRepo.py
/usr/lib/python2.7/site-packages/yum/yumRepo.py
[anaconda root@localhost ~]#

Let's modify this slightly:

        if l_csum == r_csum:
            _xattr_set_chksum(file, r_ctype, l_csum)
            return 1
        else:
                print("Attempted checksum:  l_csum: %s, r_csum: %s, file: %s, datasize=size: %s" % (l_csum, r_csum, file, size))            if check_can_fail:
                return None
            raise URLGrabError(-1, 'Metadata file does not match checksum')

But this did not work.  Next we try to adjust the size in repomd.xml:

[root@sever01 repodata]# ls -atlri
total 3304
 67130987 -rw-rw-r–. 1 root root 910003 Sep  9  2019 521f322f05f9802f2438d8bb7d97558c64ff3ff74c03322d77787ade9152d8bb-c7-x86_64-comps.xml
    79233 -rw-rw-r–. 1 root root 171695 Sep  9  2019 4af1fba0c1d6175b7e3c862b4bddfef93fffb84c37f7d5f18cfbff08abc47f8a-c7-x86_64-comps.xml.gz
 67134796 -rw-rw-r–. 1 root root    811 Sep 11  2019 repomd.xml.asc
 67134797 -r–r–r–. 1 root root   3412 Dec  1 17:11 TRANS.TBL
    21064 -rw-r–r–. 1 root root   3663 Mar 29 00:43 d4de4d1e2d2597c177bb095da8f1ad794d69f76e8ac7ab1ba6340fdd0969e936-c7-minimal-x86_64-comps.xml.gz
135155128 -rw-r–r–. 1 root root  15455 Mar 29 00:43 83b61f9495b5f728989499479e928e09851199a8846ea37ce008a3eb79ad84a0-c7-minimal-x86_64-comps.xml
    21066 -rw-r–r–. 1 root root 429230 Mar 29 00:46 4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
    21065 -rw-r–r–. 1 root root 244133 Mar 29 00:46 31a43d10c461e24e38bf5b913127e3386c3cc7f4fdf9130a3646a4fe319e74c2-filelists.xml.gz
    79232 -rw-r–r–. 1 root root 193760 Mar 29 00:46 a0ae4eae7b31c4091baf338f8aa8418ee74121fd2efde95b515ebb013b91ce75-other.xml.gz
    21068 -rw-r–r–. 1 root root 211644 Mar 29 00:46 c9d5c4e8a9aa5694175c9ac23f3efbf3b9a287d1410e8e900308a8b5fc824b49-other.sqlite.bz2
    21069 -rw-r–r–. 1 root root 312783 Mar 29 00:46 0c8178b32de875b56b849ac2580327fc4ca6f2f188a625015f044ae855f5c44f-filelists.sqlite.bz2
    21073 -rw-r–r–. 1 root root 852171 Mar 29 00:46 5618793c064f378b1fc579ba29877bb29918a3ff9d6c523792ca632254764549-primary.sqlite.bz2
    21067 -rw-r–r–. 1 root root   2998 Mar 29 00:46 repomd.xml
    21063 drwxr-xr-x. 2 root root   4096 Mar 29 11:05 .
136726251 drwxr-xr-x. 8 root root   4096 Mar 29 14:35 ..
[root@server01 repodata]#
[root@server01 repodata]#
[root@server01 repodata]# vi repomd.xml

Checking further still, we notice that a good copy of the zip's has the matching checksumin the file name:

[root@athena01 athena0-images]# sha256sum repodata-backup/ac3a24e2e118c3a3f04d3a3b008c7d8859ee4d39327a542dcf6f46a17604e957-primary.xml.gz
ac3a24e2e118c3a3f04d3a3b008c7d8859ee4d39327a542dcf6f46a17604e957  repodata-backup/ac3a24e2e118c3a3f04d3a3b008c7d8859ee4d39327a542dcf6f46a17604e957-primary.xml.gz
[root@athena01 athena0-images]#

Whereas the new files don't match:

[root@athena01 athena0-images]# sha256sum /athena0-images/working/repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
abae07a6c9d005d69ebb2b661cbb3b10ca905e439d096bf9ce10827b42d2bcfc  /athena0-images/working/repodata/4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
[root@athena01 athena0-images]#

This was due to zipping and unzipping the files to check if they contain the right RPM packages.  The correct steps to crearerepo and combine with the earlier repodata/ files is:

[root@athena01 working]# createrepo Packages/
Spawning worker 0 with 76 pkgs
Spawning worker 1 with 76 pkgs
Spawning worker 2 with 76 pkgs
Spawning worker 3 with 76 pkgs
Spawning worker 4 with 76 pkgs
Spawning worker 5 with 76 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@athena01 working]# pwd
/athena0-images/working
[root@athena01 working]# cd Packages/
[root@athena01 Packages]# cp -ip repodata/* ../repodata/
cp: overwrite â../repodata/0c8178b32de875b56b849ac2580327fc4ca6f2f188a625015f044ae855f5c44f-filelists.sqlite.bz2â? y
.
.
[root@athena01 Packages]#
[root@athena01 Packages]# rm -rf repodata/
[root@athena01 Packages]# cd ../repodata/

[root@athena01 repodata]# sha256sum 4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1  4712268f3e1cd9ec4303a41b290a9932d1ad22a7d21c60311296a0447cea75a1-primary.xml.gz
[root@athena01 repodata]#

And this moved us past this message to the next, unrelated, error.  🙂

Regards,


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License