Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 662224 - emerge fails with "Manifest verification failed" using a mirror
Summary: emerge fails with "Manifest verification failed" using a mirror
Status: CONFIRMED
Alias: None
Product: Mirrors
Classification: Unclassified
Component: Feature Request (show other bugs)
Hardware: All Linux
: High critical with 1 vote (vote)
Assignee: Mirror Admins
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-27 01:36 UTC by Anton Bolshakov
Modified: 2023-03-14 16:06 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Bolshakov 2018-07-27 01:36:22 UTC
After a recent tree signing, I'm facing an issue with "emerge --sync" command it once in while.

The error is below:
* - timestamp: 2018-07-26 23:38:35 UTC
* Verifying /usr/portage ...!!! Manifest verification failed:
Manifest mismatch for metadata/Manifest.gz
__size__: expected: 1985, have: 1983

I'm using the official mirror
sync-uri=rsync://rsync.asia.gentoo.org/gentoo-portage

The second attempt to sync after few min syncs ok usually.

So that sounds like a race of conditions during syncing a mirror with the main tree and a client who is syncing with a mirror during  that perioud.

I suggest to introduce a locking mechanism to prevent this from happening.
 
That gives a wrong impression that I'm under MITM attack and we should fix this problem.
Comment 1 Anton Bolshakov 2018-08-11 01:40:27 UTC
I'm increasing priority because it happens almost every time I sync using a mirror.
Comment 2 Anton Bolshakov 2018-08-19 00:57:38 UTC
It may be possible to fix this issue by using the new feature (hardlinks):
https://bugs.gentoo.org/660410
Comment 3 delete me 2018-09-07 08:25:49 UTC
I ran into the same problem before enabling the hardlinks configuration setting.

The count is typically off by two. I compared the output of `ls` in both /usr/portage and /usr/portage/.tmp-unverified-download-quarantine after it happened, and it's tripping up over /usr/portage having two more directories: distfiles and packages.
Comment 4 Anton Bolshakov 2018-10-31 00:15:42 UTC
This bug has been resolved or I don't face it any more at least. So the bug #660410 might have been a solution.

Closing.
Comment 5 Fabio Rossi 2018-10-31 00:17:55 UTC
I have just faced for other mirrors so reopening again
Comment 6 Anton Bolshakov 2020-05-16 01:09:23 UTC
ok, still happening once in awhile

sent 98.33K bytes  received 16.24M bytes  117.14K bytes/sec
total size is 208.29M  speedup is 12.75
 * Manifest timestamp: 2020-05-16 00:08:25 UTC
 * Valid OpenPGP signature found:
 * - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
 * - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
 * - timestamp: 2020-05-16 00:08:25 UTC
 * Verifying /usr/portage/.tmp-unverified-download-quarantine ...!!! Manifest verification failed:
Manifest mismatch for metadata/Manifest.gz
  __size__: expected: 2828, have: 2824


Any progress on this bug?
Comment 7 John Bowler 2020-09-19 06:12:58 UTC
It started happening for me about 7 days ago.  I anacron an emerge --sync very night, they started failing.  The actual reason is not in any of the logs but if I run emerge --sync --quiet=n or emaint sync --repo=gentoo I see that there is a random (apparently) failure in the size or checksum of something in the temporary tree.

This is an rsync --sync and it has become, apparently, permanent.  I note another complaint "fixed" the problem with web-rsync, which implies a permanently corrupted file in the tree, but it looks like a race to me.

I did check (via dmesg) for issues with file integrity; none reported, but it is a RAID SSD file system on Linux 5.8.9 so the obvious suspicion is that it is a Linux bug.  Alas I've deleted my 5.7 builds so this will take a while to check.
Comment 8 John Bowler 2020-09-20 17:08:56 UTC
Replying to my own comment...  The problem "disappeared" overnight; when I checked after my normal 3am --sync it had worked correctly.  It may somehow be network speed related; the previous nights there had been substantial other download activity at 3am, however I also saw consistent failures during the day and running an "emaint sync -A" now works just fine.

Could it be that there are temporary inconsistencies on the gentoo repo itself, and all its clones?
Comment 9 Alec Warner (RETIRED) archtester gentoo-dev Security 2020-09-20 21:30:12 UTC
(In reply to John Bowler from comment #8)
> Replying to my own comment...  The problem "disappeared" overnight; when I
> checked after my normal 3am --sync it had worked correctly.  It may somehow
> be network speed related; the previous nights there had been substantial
> other download activity at 3am, however I also saw consistent failures
> during the day and running an "emaint sync -A" now works just fine.
> 
> Could it be that there are temporary inconsistencies on the gentoo repo
> itself, and all its clones?

If you are using rsync, there is no guarantee you get an atomic copy of the repo; so races definitely exist.

We are looking to replace rsync entirely with something else that hopefully avoids this problem; I'm not aware of any plans to 'fix' rsync.

-A
Comment 10 Alvaro Soto 2021-09-22 23:03:50 UTC
Hello Alec,
what do you recommend we use in the meantime?

Cheers.
Comment 11 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-10 22:48:54 UTC
Git is a good alternative that doesn't have any risk of these kinds of inconsistencies.
Comment 12 Stijn Tintel 2023-02-02 01:32:21 UTC
What about adding an option like --retry-sync N to portage to let it retry sync N times if this error occurs? I'm doing nightly emerge @world on a few hosts in CI and this often causes a failure.
Comment 13 John L. Poole 2023-02-21 19:25:37 UTC
I've been having a problem rsyncing my Dom0 to a VM I use as a mirror.  I have had not problems using rsync with other machines and VM, yet I continued to be be plagued with the following error message:

    ...
    xfce-extra/xfce4-panel-profiles/Manifest
    xfce-extra/xfce4-panel-profiles/xfce4-panel-profiles-1.0.13.ebuild

    Number of files: 145,292 (reg: 118,233, dir: 27,059)
    Number of created files: 1,959 (reg: 1,903, dir: 56)
    Number of deleted files: 2,026 (reg: 1,980, dir: 46)
    Number of regular files transferred: 22,396
    Total file size: 186.67M bytes
    Total transferred file size: 56.21M bytes
    Literal data: 56.21M bytes
    Matched data: 0 bytes
    File list size: 2.18M
    File list generation time: 0.001 seconds
    File list transfer time: 0.000 seconds
    Total bytes sent: 455.48K
    Total bytes received: 32.41M

    sent 455.48K bytes  received 32.41M bytes  305.70K bytes/sec
    total size is 186.67M  speedup is 5.68
     * Manifest timestamp: 2023-02-21 00:39:46 UTC
     * Valid OpenPGP signature found:
     * - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
     * - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
     * - timestamp: 2023-02-21 00:39:46 UTC
     * Verifying /var/db/repos/gentoo/.tmp-unverified-download-quarantine ...!!! Manifest verification failed:
    Manifest mismatch for gentoo-20230220.tar.xz.gpgsig
      __exists__: expected: False, have: True

     * IMPORTANT: 2 news items need reading for repository 'gentoo'.
     * Use eselect news read to view new items.


    Action: sync for repo: gentoo, returned code = 1


    snucDom0 /etc/portage # 

There is a suggestion above to switch to git.  Unfortunately, I am unable to find documentation on how to set up a local mirror using git.  The current Gentoo Wiki is rsync-specific: https://wiki.gentoo.org/wiki/Local_Mirror.  I have no druthers about whether I use git or rsync, but I do have many machines that currently use rsync successfully, but for this one: snucDom0.  So if someone can suggest an instruction page on how to set up a git-based mirror, I be please to try such and reconfigure my Gentoo landscape.  Otherwise, I'd like to troubleshoot and fix the current problem with rsync and wonder what I can provide that might give a clue as to what is causing the problem.
Comment 14 John L. Poole 2023-02-22 03:24:35 UTC
(In reply to John L. Poole from comment #13)
> I've been having a problem rsyncing my Dom0 to a VM I use as a mirror.  I
> have had not problems using rsync with other machines and VM, yet I
> continued to be be plagued with the following error message:
> 
>     ...
>     xfce-extra/xfce4-panel-profiles/Manifest
>     xfce-extra/xfce4-panel-profiles/xfce4-panel-profiles-1.0.13.ebuild
> 
>     Number of files: 145,292 (reg: 118,233, dir: 27,059)
>     Number of created files: 1,959 (reg: 1,903, dir: 56)
>     Number of deleted files: 2,026 (reg: 1,980, dir: 46)
>     Number of regular files transferred: 22,396
>     Total file size: 186.67M bytes
>     Total transferred file size: 56.21M bytes
>     Literal data: 56.21M bytes
>     Matched data: 0 bytes
>     File list size: 2.18M
>     File list generation time: 0.001 seconds
>     File list transfer time: 0.000 seconds
>     Total bytes sent: 455.48K
>     Total bytes received: 32.41M
> 
>     sent 455.48K bytes  received 32.41M bytes  305.70K bytes/sec
>     total size is 186.67M  speedup is 5.68
>      * Manifest timestamp: 2023-02-21 00:39:46 UTC
>      * Valid OpenPGP signature found:
>      * - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
>      * - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
>      * - timestamp: 2023-02-21 00:39:46 UTC
>      * Verifying /var/db/repos/gentoo/.tmp-unverified-download-quarantine
> ...!!! Manifest verification failed:
>     Manifest mismatch for gentoo-20230220.tar.xz.gpgsig
>       __exists__: expected: False, have: True
> 
>      * IMPORTANT: 2 news items need reading for repository 'gentoo'.
>      * Use eselect news read to view new items.
> 
> 
>     Action: sync for repo: gentoo, returned code = 1
> 
> 
>     snucDom0 /etc/portage # 
> 
> There is a suggestion above to switch to git.  Unfortunately, I am unable to
> find documentation on how to set up a local mirror using git.  The current
> Gentoo Wiki is rsync-specific: https://wiki.gentoo.org/wiki/Local_Mirror.  I
> have no druthers about whether I use git or rsync, but I do have many
> machines that currently use rsync successfully, but for this one: snucDom0. 
> So if someone can suggest an instruction page on how to set up a git-based
> mirror, I be please to try such and reconfigure my Gentoo landscape. 
> Otherwise, I'd like to troubleshoot and fix the current problem with rsync
> and wonder what I can provide that might give a clue as to what is causing
> the problem.

I just got the rsync to work.  Simply rem'ing statements was not enough, I tried
using the opposite, e.g "0" when "1", and "no" when "yes".  This worked for me:

from my /etc/portage/repos.d/gentoo.conf:

    #
    # 2/7/23 jlpoole rem'd out four "verifys" below since eix-sync
    # failed.
    #
    #sync-rsync-verify-jobs = 1
    #
    # 2/21/23 jlpoole: setting to "0"  caused the sync to work in conjunction with sync-rsync-verify-metamanifest = yes
    #
    sync-rsync-verify-jobs = 0
    #sync-rsync-verify-metamanifest = yes
    #
    # 2/21/23 jlpoole: setting to "no" caused synd to work in conjunction with sync-rsync-verify-jobs=0 above.
    #
    sync-rsync-verify-metamanifest = no
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-04 00:54:21 UTC
That's not really a fix.
Comment 16 Dennis Nezic 2023-03-04 13:16:28 UTC
Can't we kinda simulate atomic rsync repos by having a policy of only updating them every hour-ish? Ie. giving us clients about an hour window to do the sync? Maybe have a global policy to update on the hour, or have some way of clients to know when the repo was last updated, to schedule the local emerge --sync's better?