Comments (13)
The command being run in this case is /usr/bin/hdiutil detach /dev/disk17
:
macinbox/lib/macinbox/virtual_disk.rb
Line 73 in b0bb3ee
You could try changing the max_attempts in that function, or making the sleep longer, as a workaround. The reason why the function does multiple attempts is that it seems to take a while for APFS volumes to "quiesce" after having lots of data written to them. On my machine, 60 seconds is always long enough, but on a different machine, under different load, it could conceivably take longer.
from macinbox.
I worry that doing a detach!
immediately after the install would result in a corrupted filesystem. For some reason the device usually stays busy for about 20 seconds after the install completes.
from macinbox.
I've pushed up 4888511 which replaces hditutil detach
with diskutil eject
. Hopefully that helps!
from macinbox.
I've also pushed up 5f78830 which adds a --verbose
flag which prints out the commands that are run, but unlike --debug
doesn't leave behind the temporary directories.
from macinbox.
Yeah, that's the around the part where I'm digging into : why is the resource still busy, or what (if anything) is still going on ... had to take a break, but couple hours later and trying manually:
$ sudo /usr/bin/hdiutil detach /dev/disk17
Password:
"disk17" unmounted.
hdiutil: couldn't eject "disk17" - Resource busy
So back to digging in "what the what" is causing the hang, pretty sure this is something on my system, but would still be handy if, in a situation like this, macinbox
would spit out the command that failed (rather than having to dig through code to find it).
from macinbox.
That's surprising that the disk would still be busy after a few hours. The lsof
tool might reveal if something is holding a file open on the disk. From the logs you posted, you'd be looking for something open under the scratch_mountpoint directory, e.g. :
sudo lsof | grep scratch_mountpoint
from macinbox.
Surprisingly :
# rm -rf /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.ii08lvPL/scratch_mountpoint
rm: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.ii08lvPL/scratch_mountpoint: Resource busy
Hence
# lsof | grep scratch_mountpoint
mds 80 root 20r DIR 1,41 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.vUrgBZxP/scratch_mountpoint
mds 80 root 23r DIR 1,17 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.ii08lvPL/scratch_mountpoint
mds 80 root 30r DIR 1,17 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.ii08lvPL/scratch_mountpoint
mds 80 root 36r DIR 1,17 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.ii08lvPL/scratch_mountpoint
mds 80 root 38r DIR 1,29 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.3778RisT/scratch_mountpoint
mds 80 root 39r DIR 1,29 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.3778RisT/scratch_mountpoint
mds 80 root 42r DIR 1,29 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.3778RisT/scratch_mountpoint
mds 80 root 43r DIR 1,41 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.vUrgBZxP/scratch_mountpoint
mds 80 root 48r DIR 1,41 64 2 /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.vUrgBZxP/scratch_mountpoint
And this is even with having /private/var/folders
in the "Privacy" tab in System Preferences > Spotlight.
No idea why mds
is deciding to start searching it.
Can do eject
even though detach
errors out ... wondering of drawbacks to bypassing detach
and going straight to eject
.
from macinbox.
Thanks, @Brantone. The man page for hdiutil
says:
eject is a synonym for detach. In common operation, detach is very similar to diskutil(8)'s eject.
Which eject
did you use? I'm willing to test out changing away from hdiutil detach
if there's something else that works better for you and equally as well for me.
from macinbox.
Currently still debating if eject
is best option.
Also wondering detach
was preferred in the first place? Ex: why not just use the detach!
method all the time since it has detach -quiet -force
and doesn't care for exit status?
macinbox/lib/macinbox/virtual_disk.rb
Line 89 in b0bb3ee
from macinbox.
Later on tonight I can submit a PR the experiment I tested and can go from there.
I did get it to successfully create a Vagrant box, but it still failed on clean up:
• Installing box...
+ Copying box to /Users/USER/.vagrant.d/boxes...
- Installed box: macos-10.14.3-1 (vmware_fusion, 10.14.3)
• Cleaning up...
• WARNING: Temporary files were not removed. Run this command to remove them:
• sudo rm -rf /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_box_from_vmdk.TrSqD5ZE \
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_vmdk_from_image.zXmCd4WQ \
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/create_image_from_installer.8F6RO5qG \
/var/folders/nx/q112c5wx7vn_0bmv9vdhgp7hqpw449/T/macinbox_user_temp.oJ4rjFRv \
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/macinbox_root_temp.MU3FAEJd
Doing lsof
showed all the files in those subdirs are still open, so something is holding onto them. If no one else has run into it, will just chalk it up to something unique in my dev environment.
from macinbox.
My own experiments with eject
seem successful, the first diskutil eject
after the install fails, but then the second attempt after waiting 15 seconds succeeds. I'm working on getting that merged, hopefully it helps with your situation.
The temporary files are intentionally not removed when you pass the --debug
option, but all of the mounted disk images are supposed to be properly unmounted when the script ends. Does the rm -rf
command not work for you even after the box is installed correctly?
from macinbox.
Fwiw, this was the minor tweak I made just to get the ball rolling again:
master...Brantone:master
Still no idea why those folders are open / in use, thus the rm -rf
fails with error as expected. The box still does get created, so not as concerned about it.
$ pwd
/Users/USER/.vagrant.d/boxes/macos-10.14.3-1/10.14.3/vmware_fusion
HOST:vmware_fusion USER$ ls
Vagrantfile macinbox-Snapshot1.vmsn macinbox.vmsd macinbox.vmxf
macinbox-000001.vmdk macinbox.vmdk macinbox.vmx metadata.json
from macinbox.
Tagged and released: https://github.com/bacongravy/macinbox/tree/v3.3.0
from macinbox.
Related Issues (20)
- VMware Tools not installed properly in Catalina box HOT 10
- The link to the Catalina installer said that it didn't exist in the App Store. HOT 1
- Virtualbox 6.1.3 fails to boot Catalina 10.15.2 HOT 14
- 'invalid byte sequence in US-ASCII' HOT 5
- Box created with Parallels Desktop 15.1.2 fails to boot HOT 2
- ENOENT errors when creating files HOT 9
- Catalina 10.15.4 issue - machine fails to boot with startup error HOT 2
- Software installed with user-script isn't available after boot HOT 5
- /vagrant doesn't exist, read-only? HOT 7
- Allow to specify VRAM amount HOT 2
- Allow to set box version HOT 4
- the vm(format .pvm) created using macinbox boot more slowly than created using parallels HOT 2
- Any way to get sound working in VirtualBox VM? HOT 2
- virtualbox: Mojave box does not boot on 2020 Macbook HOT 6
- Name VHD/VDMK files based on name of box HOT 2
- Compatibility with Big Sur HOT 13
- Catalina installer download: Update not found
- Catalina: /usr/sbin/diskutil failed with non-zero exit code: 1 HOT 3
- Install Xcode HOT 1
- Shrinking the virtual disk
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from macinbox.