Skip to content

DMG creation fails on macOS Big Sur 11.0.1 on M1 hardware (aarch64) #184

@AstroPixelProcessor

Description

@AstroPixelProcessor

I'm submitting a…

  • [ X ] bug report

Short description of the issue/suggestion:

DMG creation is not possible on aarch64 hardware. It fails on the line

execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", "HFS+", "-format", "UDRW", tempDmgFile);

in GenerateDMG.java.

I have confirmed that this does work on x86_64 hardware Big Sur 11.0.1, so it seems it is really specific to the aarch64 version of hdiutil.

The error message is :

[INFO] Executing command: /bin/sh -c cd '/Users/mabula/IdeaProjects/astropixelprocessor-jdk17/.' && 'hdiutil' create -srcfolder /Users/mabula/IdeaProjects/astropixelprocessor-jdk17/target/astropixelprocessor -volname astropixelprocessor-1.1.0 -ov -fs HFS+ -format UDRW /Users/mabula/IdeaProjects/astropixelprocessor-jdk17/target/assets/astropixelprocessor_1.1.0.dmg
[INFO] could not access /Volumes/astropixelprocessor-1.1.0/astropixelprocessor.app/Contents/PlugIns/jre/Contents/Home/.BC.T_xQRv4X - Operation not permitted
[ERROR] hdiutil: create failed - Operation not permitted
[ERROR] DMG image generation failed due to: Command execution failed: hdiutil create -srcfolder /Users/mabula/IdeaProjects/astropixelprocessor-jdk17/target/astropixelprocessor -volname astropixelprocessor-1.1.0 -ov -fs HFS+ -format UDRW /Users/mabula/IdeaProjects/astropixelprocessor-jdk17/target/assets/astropixelprocessor_1.1.0.dmg
[ERROR]
org.codehaus.plexus.util.cli.CommandLineException: Command execution failed: hdiutil create -srcfolder /Users/mabula/IdeaProjects/astropixelprocessor-jdk17/target/astropixelprocessor -volname astropixelprocessor-1.1.0 -ov -fs HFS+ -format UDRW /Users/mabula/IdeaProjects/astropixelprocessor-jdk17/target/assets/astropixelprocessor_1.1.0.dmg
at io.github.fvarrui.javapackager.utils.CommandUtils.execute (CommandUtils.java:19)
at io.github.fvarrui.javapackager.utils.CommandUtils.execute (CommandUtils.java:29)
at io.github.fvarrui.javapackager.packagers.GenerateDmg.doApply (GenerateDmg.java:88)
at io.github.fvarrui.javapackager.packagers.GenerateDmg.doApply (GenerateDmg.java:22)

What is the expected behavior?

DMG should be created

What is the current behavior?

DMG creation fails

Suggestion with tested solution:

Do a check on the hardware architecture and if aarch64/arm then build the DMG with the newer APFS filesystem.

execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", "APFS", "-format", "UDRW", tempDmgFile);

The bless command fails then, but you can simply disable the bless command, since the DMG is properly created with APFS filesystem in that case.

// no longer needed
//Logger.info("Blessing ...");
//execute("bless", "--folder", mountFolder, "--openfolder", mountFolder);

Google searches seem to indicate that hdiutil on aarch64 actually is broken for HFS+ somehow... or perhaps Apple is forcing us to no longer use it since APFS is better ? I have no clue at the moment what is happening, I only know that hdiutil with HFS+ is a problem right now on aarch64, many problems are encountered with google search on this.)

Please tell us about your environment:

  • JavaPackager version current 1.6.6-devel branch:
  • OS version Big Sur 11.0.1:
  • JDK version openJDK 17:
  • Build tool:
    • [ X ] Maven
    • Gradle

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedIssue fixed and release pending

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions