create-dmg / create-dmg

A shell script to build fancy DMGs
MIT License
2.1k stars 297 forks source link

Occasionnal `hdiutil: create failed - Resource busy` #143

Open gaetschwartz opened 2 years ago

gaetschwartz commented 2 years ago

When creating a DMG in my CI (Bitrise), the tool occasionally fails with hdiutil: create failed - Resource busy.

I'm using the latest version (1.10).

Here is my usage of the tool:

+ create-dmg --volname 'Media Library' --window-pos 200 120 --window-size 800 529 --icon-size 130 --text-size 14 --icon 'Media Library.app' 260 250 --hide-extension 'Media Library.app' --app-drop-link 540 250 --skip-jenkins 'Media Library (7c0935e).dmg' 'Media Library.app'
Creating disk image...
hdiutil: create failed - Resource busy

This looks like some kind of race condition or a timing issue, as the tool only fails occasionally.

pzhlkj6612 commented 2 years ago

Hmm, our old friend - "Resource busy (16)". Maybe we need to put all "hdiutil" calls into retry loops, like "hdiutil detach" in #139 .

gaetschwartz commented 2 years ago

That would make sense indeed. If you have an idea of where this takes place, can try to open a PR :)

grzegorzkrukowski commented 1 year ago

Any news on this problem? We are having the same issue on the newest macOS13 runners on GitHub and it's consistent - happening 100% of the time.

VitoVan commented 1 year ago

Any news on this problem? We are having the same issue on the newest macOS13 runners on GitHub and it's consistent - happening 100% of the time.

Yes, indeed, I can't find a way to bypass this now. (even with --skip-jenkins)

VitoVan commented 1 year ago

No, it seems there is more than 50% chance to success with --skip-jenkins on github actions macos-13.

grzegorzkrukowski commented 1 year ago

It's still a case, especially on macOS13-xl machines on GitHub. Here is related ticket on runners - they suspect it maybe related to XProtectBehaviorService that was introduced in macOS13

The walkaround seems to be killing the process and retrying - but it still doesn't help 100% of the time.

afvieira commented 1 year ago

Hi, we are hitting on this as well, with more frequency in the last weeks. It doesn't happen 100% of the time, but it is not helping... Is there any workaround? Are you considering applying the workaround shared by @grzegorzkrukowski mentioned above?

Thanks

aonez commented 1 year ago

@afvieira it seems neither the workaround fixes this for sure

The walkaround seems to be killing the process and retrying - but it still doesn't help 100% of the time.

Since I'm unable to replicate this issue I really can't help. But any of those that replicate and can try/test, feel free to send a pull request.

KlemenDEV commented 1 year ago

I can also confirm this happens sometimes

VitoVan commented 11 months ago

I fixed my workflow with the following two modifications:

  1. kill XProtect before calling create-dmg
  2. use sudo to run create-dmg

This comment helped:

https://github.com/actions/runner-images/issues/7522#issuecomment-1566746364


Edit 2 days later:

It didn't fix it, just gave me more luck.

The resource is still busy sometimes.

abose commented 9 months ago

Can confirm this happens consistantly on GitHub Actions Mac M1 Runners. The duild doesnt fail locally on M1 macs thought.

Details of the GitHub Actions run can be found here: https://github.com/phcode-dev/phoenix-desktop/actions/runs/7626006956/job/20771494599.

https://discord.com/channels/616186924390023171/1199341633435602984

Is there any fix planned for this? Not being able to build mac M1 DMGs sounds like a pretty big issue.

RobZuazua commented 9 months ago

I'm now seeing this on my M1 Mac every build. more info on discord: https://discord.com/channels/616186924390023171/1200314563690770515/1200314563690770515

sanjacob commented 1 month ago

I am not using this action but by running hdiutil create I still get this error sometimes in macos-12