Jump to content

can't mount *.dmg files after kernel update? here's a solution!


1 post in this topic

Recommended Posts

So, here's the deal. I've JUST gotten my hackintosh working 2 days ago and so far everything has been pretty smooth. I made a post earlier looking for ways to get around the problem of dmg files not being able to mount. I was told if i match the System.kext files to the kernel that the problem will no longer occur. I don't have access to those files so I had to try something else. Everything else works perfectly. I saw several posts regarding a temporary fix using the commands "sudo kextunload -c com.apple.AppleDiskImageController" and "sudo kextload -b com.apple.AppleDiskImageController". I grew tired of typing those in every time i boot so i decided to write just a 2 line script which runs those commands for me. However, how do you get past the sudo portion? It asks for a password..... Solution: This is not a strong solution, in that it may weaken your security but for those who don't care, this may do the trick. I'm still unfamiliar with most of the mac features so I may have done a few things wrong... but bear with me.

 

1. In order to get past the password hurdle, you must edit the sudoers file, via visudo. You must be logged in as root in order to access it. (To enable root, go to Applications->Utilities->NetInfo->Security->Enable Root User). To become root, type in su in the command line.

 

2. Then, as root, type in "visudo". Enter a line similar to this "user ALL=NOPASSWD: ALL" with user being your user name. I think the user has to have admin privelages. Chances are everyone reading this does. What this does is it bypasses the password portion of the sudo command. It just runs it without prompting the user.

 

3. I created a script called DMG_Fix.command. I'm not sure if the extension is supposed to be command or not, but the bash script is simple. Using vi or some other editor, copy and paste the following text into a file.

 

#!/bin/bash

echo "Unloading ADIC...."

sudo kextunload -c com.apple.AppleDiskImageControllerecho

"Loading ADIC...."

sudo kextload -b com.apple.AppleDiskImageController

 

Save, exit. Place the script into a location accessible by all users. I put mine in /users/shared.

 

4. Inside a terminal, run the command "sudo defaults write com.apple.loginwindow LoginHook /path/to/script" with /path/to/script being the path where its located. This will create an entry upon startup which will run the script everytime the machine boots up, without prompting you for anything. I'm not sure if it has to be called LoginHook, but maybe. That should do it!

 

Note - If anyone knows a way to simulate keypresses when scripting, please let me know. Without modifying the sudoers using visudo, you'd have to press enter 3 times for this script to work. A better script would be one that simulates the pressing of the enter key, however i haven't figured that out yet. You could grab the password from the /etc/shadow file in order to preserve security, but for me its not a big deal.hmm, it appears to not work with all .dmg files. I'm looking into it. I'll post once i find a better solution.

×
×
  • Create New...