You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

dmg file: The disk image couldn't be opened

When I updated from macOS Ventura to Sonoma, the update was not completed due to a memory problem and did not allow me to log in to the account. That's why I had to erase my disk and reinstalled it. Before erasing, I added the User partition to the external disk as per the instructions. After installation, the User file backed up in Ventura could not be opened on the external disk. Then I updated. It didn't open in Sonoma either. It always gives the attached error. I also tried it in safe mode and it did not open. I reinstalled the system and it still did not work. I tried a few commands I saw on the internet and none of them worked. Can anyone help?



MacBook Air (2018 – 2020)

Posted on Oct 17, 2024 2:44 PM

Reply
5 replies

Oct 18, 2024 8:57 AM in response to mukmuk02

mukmuk02 wrote:

Before erasing, I added the User partition to the external disk as per the instructions.

Exactly how did you do this? What instructions? What partition exactly since there is no "User" partition, there is a user folder? Apple does not officially support such a configuration of relocating the home user folder....It has been prone to problems especially for the last few years.


After installation, the User file backed up in Ventura could not be opened on the external disk.

What User file? You mentioned a User partition before, but now a User file.


Then I updated.

Updated what? The file, the partition, the OS?


I tried a few commands I saw on the internet and none of them worked. Can anyone help?

Exactly what commands have you used? Would any of them have altered the setup? If so, then it may be impossible to fix it.

Oct 18, 2024 9:50 AM in response to HWTech

There may have been some word confusion because of the language barrier. I am translating it. I mean 'User' folder. I put my user folder on the external disk and deleted my system. I did this not on my own, with an Apple employee. So I'm not talking about something I made up.

I updated OS Sonoma, as I wrote before. I have used 'xattr -cr' and 'hdiutil attach -noverify -mount suppressed <path-to-dmg-file>' commands. I saw them on web. I tried but nothing happened. @HWTech


Oct 18, 2024 6:54 PM in response to mukmuk02

So an Apple employee at the Apple Store used Disk Utility to create a DMG archive file of your old home user folder? I'm just piecing this together from all your different references since we are still missing some details .


Did you or the Apple employee try to open the resulting DMG file prior to erasing the computer?


What file system is on the external drive where the DMG archive file of your old home user folder is located?



mukmuk02 wrote:

I have used .... 'hdiutil attach -noverify -mount suppressed <path-to-dmg-file>' commands. I saw them on web. I tried but nothing happened.

Try the following commands and post the results. I've added a "verbose" option so more information is shown which may provide clues.


Use this command to check if any Disk Images are present (use it after every attempt to attach the DMG):

diskutil  list  |  grep 'disk image'  -A5


Try the basic attach with "verbose" so we can see what information may be provided:

hdiutil  attach  <path-to-DMG-file>   -verbose  -verify


Afterwards, don't forget to run the "diskutil" command to make sure that the disk image was not opened even if errors are shown.


Check the integrity of the DMG archive:

hdiutil  attach  <path-to-DMG-file>   -verbose


Try with all safety checks disabled:

hdiutil  attach  <path-to-DMG-file>   -verbose  -noautofsck  -ignorebadchecksums


Same as previous command, but add the "nomount" option just in case there is a problem with mounting:

hdiutil  attach  <path-to-DMG-file>   -verbose  -noautofsck  -ignorebadchecksums  -nomount



If any of these commands shows that the "disk image" is present when running the "diskutil" command

diskutil  list  |  grep 'disk image'  -A5


, then you do have access to the contents of the DMG file. If the Finder or command line is unable to see anything, then you may need to try using a data recovery app to see if it can access the data on the "attached" DMG.

Oct 21, 2024 7:54 AM in response to HWTech

We had a conversation over the phone and he told me to take the documents that we could save with an external disk. And his redirection was through the 'User' folder. So ‘used Disk Utility to create a DMG archive file of your old home user folder’ that’s true. 


So, we couldn’t try to open it because I don’t have another MacBook to try. I can try to open it, when I erased my computer and reinstall it. The disk did not accept the external disk at first. We did reinstall and exfat with his guidance. And we placed the folder in external disk.


With this: 

Use this command to check if any Disk Images are present (use it after every attempt to attach the DMG):

diskutil list | grep 'disk image' -A5

 

Can you explain it clearly please? Should I put anything on the ‘disk image’ part or list part? And should I use all these commands consecutively or separately?

Thank you. @HWTech

Oct 21, 2024 9:40 AM in response to mukmuk02

mukmuk02 wrote:

With this: 
Use this command to check if any Disk Images are present (use it after every attempt to attach the DMG):
diskutil list | grep 'disk image' -A5
 
Can you explain it clearly please? Should I put anything on the ‘disk image’ part or list part? And should I use all these commands consecutively or separately?

Use that command exactly as is. The "grep" part just filters the list of drives so it will only show items related to a disk image (aka DMG). The " -A5" part just allows displaying the five lines after finding the "disk image" text so we can hopefully see everything related to the DMG/disk image.



If you use just "diskutil list", then you will get a list of all connected drives & volumes and their virtual volumes which makes troubleshooting very difficult. I'm just trying to narrow down the output to what is relevant to your attempt to access the DMG contents. Go ahead & try the command like this so you can compare the results when adding the "  | grep 'disk image' -A5" part (if you don't have any DMG or .sparsebundle files opened, then you won't get any results with the added "grep" part. Please do not post the results of the more basic command though):

diskutil  list



dmg file: The disk image couldn't be opened

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.