Skip to content

In 2.5.1 garbage-collection stops when running into failed to garbage collect: failed to mark: invalid checksum digest format #1960

Closed

Description

@lauriholmas

I guess this is more of a question than a bug, since I assume the issue lies with my environment, but:
Trying to run garbage-collection, it stops with:
failed to garbage collect: failed to mark: invalid checksum digest format

Then switched to --dry-run to see where it happens, but can't spot anything wrong at the last blob that was marked. Is the offending blob or whatever it is the previous one listed or the next one that hasn't been logged yet. Any ideas on how to fix it? Should I just delete the manifest or blob and leave the repo in a broken state somehow ?

Activity

  1. RichardScothern commented on Sep 14, 2016

    @RichardScothern

    hi @lauriholmas

    What is the last line printed in your dry run? My best guess is that there is a manifest which is not being parsed correctly. The 'marking manifest x' message should indicate which it is.

  2. lauriholmas commented on Sep 15, 2016

    @lauriholmas
    Author

    Hello @RichardScothern
    here is the last section of the dry-run logs:
    reponame: marking manifest sha256:437c175248b6014b7a257783333e8a3e44aa7b3a1838af02747c18ddb5d3a2dd
    reponame: marking blob sha256:63cf8e9782dd9ff96aade2076b5cd510eb131f6c24987af8b7191b8bb8a47d52
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:31f838803b2beddabfbdf7fa62c4773ca611c78c3157dbccc6331e19f2289130
    reponame: marking blob sha256:400b2f4fbd6a3edc11da4d16c5994668b6c3e5b510331f396b561858811959a5
    reponame: marking blob sha256:dc1037d25537c058a775a28f0ff793383fce3c1873dba055c26a0b0e02fabeea
    reponame: marking blob sha256:6b5a47d7a243d0cb2cdff8975f8536cc27c41ad64a9ed488d23290ca5b3c8f83
    reponame: marking blob sha256:cd36502cd3983e7551ff652394a1e6fcf4d9f7eccb803d1d32f51428f69049fd
    reponame: marking blob sha256:1608c4eb107409f36213375f081a1da8ba5ecaf20c66c7bc1280588b76c1f119
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:ecc87077c2f1492a5c7f20393d2b1e142b2e2b895de972ee19a646135d13b1c4
    reponame: marking blob sha256:c2763f167c24ca04a74d2d4ff09387d7829984572de3f3263e7e2e02403f8a5b
    reponame: marking blob sha256:ff987196669e52bba39baf261d89325bc846c1e5c66df6c4f9a4f0324582acb0
    reponame: marking blob sha256:5ad546d9f7f57c34742659bcab4b8daef9d43fd915da73a614a8f32a88523252
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:022c49e390bcfb640b81bf50b7916f9ccf695c4313990b7fac0e2dbc0ebc61f1
    reponame: marking blob sha256:1487f06a9565df4ea85b993aca6cc8ddefe1d449f24523edca776c44f095def3
    reponame: marking blob sha256:ae6ce98ebd3173a28cdfffc4a28d87a60a1ca965511415f8c68fb92f6597de46
    reponame: marking blob sha256:f225f12ed645a098d8e0a27d3344cb413aee65023d08e0ad44aef7f28d14e3c9
    reponame: marking blob sha256:eeba15564580cbf840109e13f5c1195eb108551fda470e804bb533310740cefa
    reponame: marking blob sha256:56a14680f093bfdec694bd13555ec8efd2430b64a4df0ee8f915e8d87d8f5552
    reponame: marking blob sha256:61a37f5d7fb8a00c89b02a49eb67edfa4174a2639301cb890dd3e2ff92e5ecae
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:16dc1f96e3a1bb628be2e00518fec2bb97bd5933859de592a00e2eb7774b6ecf
    failed to garbage collect: failed to mark: invalid checksum digest format

    So does this imply the last blob is somehow broken? What would be the least damaging way to fix it? ( I assume that removal of things is the only way to fix these ) Remove the manifest with the offending party?

  3. RichardScothern commented on Sep 15, 2016

    @RichardScothern

    What do the manifests for reponame look like? Are there any non-standard digests in the layers sections?

  4. lauriholmas commented on Sep 16, 2016

    @lauriholmas
    Author

    Hello, went digging in, there is an empty link file under
    reponame/_manifests/revisions/sha256/437c175248b6014b7a257783333e8a3e44aa7b3a1838af02747c18ddb5d3a2dd/signatures/sha256/285fcc9d2080173304921fc55fd52793a9cf643575ae3372be0c51fae6ffac0a/link
    ( that manifest being the last manifest to be mentioned in the log )
    Looked at a couple others and they had content in them.

  5. RichardScothern commented on Sep 16, 2016

    @RichardScothern

    A missing signature isn't ideal, but if you're running 2.5.0 or later it should not interfere with GC.

    If you increase the log level to debug does anything else show up?

  6. lauriholmas commented on Sep 30, 2016

    @lauriholmas
    Author

    Hmm, I will try to rerun GC with debug logs on once I get back to work after paternal leave. ( Just explaining the delay in replies, I'm sure you are not holding your breath waiting anyway =) )

  7. johnbazan commented on Oct 20, 2016

    @johnbazan

    I'm having exactly the same issue, even using docker registry 2.5.1

    Is it safe to remove those empty links (and it's folders) and run the garbage collector again?

    I'm moving them to a backup folder just in case, and running dry-run.
    I've found 5 by now.

    Sorry to bother you guys, but I need a response asap, hehe.

  8. gcrova commented on Dec 7, 2016

    @gcrova

    Hi,
    Did your find a solution for this problem ? I'm encountering the same issue with registry 2.5.1.
    Thanks

  9. lauriholmas commented on Dec 7, 2016

    @lauriholmas
    Author

    I ended up rebuilding the registry I am maintaining and haven't bumped into this one with the new one yet. I was using an S3 implementation via s3fs,( filesystem storagedriver) I went with the assumption that it was an issue in that. What storage method are you running on?

  10. gcrova commented on Dec 7, 2016

    @gcrova

    The storage we are using is a nfs mount to a nas server. Do you think it might be the problem ?

  11. johnbazan commented on Dec 7, 2016

    @johnbazan

    I've removed the empty links and the gc eventually ran. Didn't find the answer to this yet. I increased the storage size of my registry and never run the gc again.

  12. gcrova commented on Dec 8, 2016

    @gcrova

    Hi,
    That's finally what I did too. I identified & removed all empty links files and the garbage collect process looks complete.
    Problem is that garbage collect looks not removing all useless data ... Is there a way to force it to remove all useless data ?
    Thanks

  13. gogeof commented on Jul 19, 2018

    @gogeof

    the same in v2.6.2

  14. kcd83 commented on Aug 22, 2018

    @kcd83

    I was able to delete other images by shelving the problem one and putting it back.

    mv data/registry/docker/registry/v2/repositories/some-app data/some-app
    
    docker run -it --name gc --rm -v /opt/registry/data/registry:/var/lib/registry -v /opt/registry/conf/registry/config.yml:/etc/docker/registry/config.yml registry:2.6.2 garbage-collect /etc/docker/registry/config.yml
    

    Unreferenced blobs seem to be deleted from the internal database, people below report them as deleted, so moving back does not work

    mv data/some-app data/registry/docker/registry/v2/repositories/some-app
    

    Doesn't resolve the actual issue

  15. mehyedes commented on Oct 31, 2018

    @mehyedes

    @kcd83 Thanks, that saved our day!

    I am still wondering, what's the actual reason for this issue..

  16. depfsh commented on Dec 23, 2018

    @depfsh

    Hello @RichardScothern
    here is the last section of the dry-run logs:
    reponame: marking manifest sha256:437c175248b6014b7a257783333e8a3e44aa7b3a1838af02747c18ddb5d3a2dd
    reponame: marking blob sha256:63cf8e9782dd9ff96aade2076b5cd510eb131f6c24987af8b7191b8bb8a47d52
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:31f838803b2beddabfbdf7fa62c4773ca611c78c3157dbccc6331e19f2289130
    reponame: marking blob sha256:400b2f4fbd6a3edc11da4d16c5994668b6c3e5b510331f396b561858811959a5
    reponame: marking blob sha256:dc1037d25537c058a775a28f0ff793383fce3c1873dba055c26a0b0e02fabeea
    reponame: marking blob sha256:6b5a47d7a243d0cb2cdff8975f8536cc27c41ad64a9ed488d23290ca5b3c8f83
    reponame: marking blob sha256:cd36502cd3983e7551ff652394a1e6fcf4d9f7eccb803d1d32f51428f69049fd
    reponame: marking blob sha256:1608c4eb107409f36213375f081a1da8ba5ecaf20c66c7bc1280588b76c1f119
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:ecc87077c2f1492a5c7f20393d2b1e142b2e2b895de972ee19a646135d13b1c4
    reponame: marking blob sha256:c2763f167c24ca04a74d2d4ff09387d7829984572de3f3263e7e2e02403f8a5b
    reponame: marking blob sha256:ff987196669e52bba39baf261d89325bc846c1e5c66df6c4f9a4f0324582acb0
    reponame: marking blob sha256:5ad546d9f7f57c34742659bcab4b8daef9d43fd915da73a614a8f32a88523252
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:022c49e390bcfb640b81bf50b7916f9ccf695c4313990b7fac0e2dbc0ebc61f1
    reponame: marking blob sha256:1487f06a9565df4ea85b993aca6cc8ddefe1d449f24523edca776c44f095def3
    reponame: marking blob sha256:ae6ce98ebd3173a28cdfffc4a28d87a60a1ca965511415f8c68fb92f6597de46
    reponame: marking blob sha256:f225f12ed645a098d8e0a27d3344cb413aee65023d08e0ad44aef7f28d14e3c9
    reponame: marking blob sha256:eeba15564580cbf840109e13f5c1195eb108551fda470e804bb533310740cefa
    reponame: marking blob sha256:56a14680f093bfdec694bd13555ec8efd2430b64a4df0ee8f915e8d87d8f5552
    reponame: marking blob sha256:61a37f5d7fb8a00c89b02a49eb67edfa4174a2639301cb890dd3e2ff92e5ecae
    reponame: marking blob sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    reponame: marking blob sha256:16dc1f96e3a1bb628be2e00518fec2bb97bd5933859de592a00e2eb7774b6ecf
    failed to garbage collect: failed to mark: invalid checksum digest format

    So does this imply the last blob is somehow broken? What would be the least damaging way to fix it? ( I assume that removal of things is the only way to fix these ) Remove the manifest with the offending party?

    thanks 👍 I also deleted the folder ,then retry the GC, it works

  17. ganeshpore commented on Aug 27, 2019

    @ganeshpore

    docker run -it --name gc --rm -v /opt/registry/data/registry:/var/lib/registry -v /opt/registry/conf/registry/config.yml:/etc/docker/registry/config.yml registry:2.6.2 garbage-collect /etc/docker/registry/config.yml

    [root@dharbor registry]# docker run -it --name gc --rm -v /opt/registry/data/registry:/var/lib/registry -v /opt/registry/conf/registry:/etc/docker/registry/config.yml registry:2.6.2 garbage-collect /etc/docker/registry/config.yml
    docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:424: container init caused "rootfs_linux.go:58: mounting \"/opt/registry/conf/registry\" to rootfs \"/var/lib/docker/overlay2/9ea840a3bac96908d677cb9ef0cf4d963ad04c34583f8b5d147fd4b4a861dd33/merged\" at \"/var/lib/docker/overlay2/9ea840a3bac96908d677cb9ef0cf4d963ad04c34583f8b5d147fd4b4a861dd33/merged/etc/docker/registry/config.yml\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
    ERRO[0000] error waiting for container: context canceled

  18. ganeshpore commented on Nov 27, 2020

    @ganeshpore
  19. Lakshmipathi commented on Feb 6, 2021

    @Lakshmipathi

    @kcd83,

    Please add "disclaimer" it won't work for everyone. I thought its simple "mv" trick, lets save disk-space. It resulted in data loss - images gone :( May be it worked in 2018, but not in 2021.

  20. joaodrp commented on Feb 6, 2021

    @joaodrp
    Collaborator

    This issue is due to an empty or corrupted (does not contain a valid digest) tag link file (/docker/registry/v2/repositories/<name>/_manifests/tags/<tag>/current/link).

    While the root cause is yet unknown, I think it's safe to log a warn message and skip to the next tag instead of stoping GC. By doing so, the underlying manifest and blobs would be deleted, but only if they are not referenced elsewhere.

    These tags are broken and can't be fixed unless they're pushed to the registry once again, so deleting them during GC is also a valid option.

  21. kcd83 commented on Feb 7, 2021

    @kcd83

    @Lakshmipathi when you moved "some-app" back did you lose every image for that app?

  22. joaodrp commented on Feb 7, 2021

    @joaodrp
    Collaborator

    @Lakshmipathi when you moved "some-app" back did you lose every image for that app?

    If you remove a repository folder from the registry and run GC, any blobs that are only needed for the images within that repository will be deleted. So, once you move the repository folder back, you still have the tags there but the underlying blobs are gone and you can’t pull those images.

  23. Lakshmipathi commented on Feb 7, 2021

    @Lakshmipathi

    @KCD82 What @joaodrp mention is correct. I has 25 docker images, moved 1-image and reverted back after GC run. 24 images are fine but 1 image (which was "mv") pull always results in image not found since blobs are deleted.

  24. naveenkumar-muniraj-agilysys commented on Oct 22, 2023

    @naveenkumar-muniraj-agilysys

    Nobody mentioned how to find the link with the 0 size. Use the following command to locate a link file with a size of 0 and remove it, retrying the garbage collection function.

    find . -iname link -size 0

    docker run -v /data/:/var/lib/registry registry:2 bin/registry garbage-collect /etc/docker/registry/config.yml

  25. MMI commented on Mar 21, 2024

    @MMI

    Nobody mentioned how to find the link with the 0 size. Use the following command to locate a link file with a size of 0 and remove it, retrying the garbage collection function.

    find . -iname link -size 0

    docker run -v /data/:/var/lib/registry registry:2 bin/registry garbage-collect /etc/docker/registry/config.yml

    (Search brought me here.) Thanks for this. I simply removed this empty link and then garbage collection worked. IOW:

    rm $(find /path/to/registry_data -iname link -size 0)
    
  26. shuaichang commented on Jun 25, 2024

    @shuaichang

    Does this bug still exist today? We also see empty link files. However, we did not do any GC operation

  27. Code42Cate commented on Jan 31, 2025

    @Code42Cate

    Does this bug still exist today? We also see empty link files. However, we did not do any GC operation

    Just had it today. Still exists on registry:3.0.0-beta.1

  28. abhinavsingh commented on Jun 4, 2025

    @abhinavsingh

    Got bit by this today, unsure how to get out of it now.

    find /var/lib/registry -iname link -size 0 --- Gives me nothing

  29. ningmingxiao commented on Jan 30, 2026

    @ningmingxiao
    Contributor

    this pr may fix #4774
    I guess it happended on unexpected poweroff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions