I'm trying to create chroot environment with Mac OS X 10.6 on Mac OS X 10.8.4. I've created disk image, installed Mac OS X 10.6.3 and combo update to 10.6.8 on it. When I run chroot /path/to/mounted/image /bin/echo test inside virtual machine running 10.6.8 (that I used to run the installer) it works fine, but if I do the same in host OS (10.8.4) it receives SIGBUS and crashes.

Here's the crash report:

Process:         echo [29464]
Path:            /Volumes/VOLUME/bin/echo
Identifier:      echo
Version:         170
Code Type:       X86-64 (Native)
Parent Process:  zsh [27539]
User ID:         0

Date/Time:       2013-09-01 21:00:40.910 +0100
OS Version:      Mac OS X 10.8.4 (12E55)
Report Version:  10

Crashed Thread:  0

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fffffe00600

VM Regions Near 0x7fffffe00600:
    Submap                 00007fffc0000000-00007fffffe00000          r--/rwx process-only submap
--> Submap                 00007fffffe00000-00007fffffe01000          r--/r-- process-only submap
    shared memory          00007fffffe00000-00007fffffe01000 [    4K] r--/r-- SM=SHM  

Application Specific Information:
dyld: launch, running initializers

Thread 0 Crashed:
0   ???                             0x00007fffffe00600 0 + 140737486259712
1   libSystem.B.dylib               0x000000010cb3f10d mach_init_doit + 81
2   libSystem.B.dylib               0x000000010cb3f076 libSystem_initializer + 19
3   dyld                            0x00007fff6c748378 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 236
4   dyld                            0x00007fff6c748762 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 46
5   dyld                            0x00007fff6c74506e ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 380
6   dyld                            0x00007fff6c744fc4 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 210
7   dyld                            0x00007fff6c744eba ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 54
8   dyld                            0x00007fff6c736fc0 dyld::initializeMainExecutable() + 207
9   dyld                            0x00007fff6c73ab04 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 3060
10  dyld                            0x00007fff6c736397 dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 761
11  dyld                            0x00007fff6c73605e _dyld_start + 54

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007fffffe00600  rbx: 0x0000000000000000  rcx: 0x000000010cb3ed6e  rdx: 0x00007fff530cab00
  rdi: 0x000000010cd18cc0  rsi: 0x0000000000001908  rbp: 0x00007fff530ca270  rsp: 0x00007fff530ca268
   r8: 0x00007fff6c76a1a8   r9: 0x0000000000000001  r10: 0x000000010cd42a28  r11: 0x000000010cb3f000
  r12: 0x0000000000000d07  r13: 0x0000000000000001  r14: 0x00007fff6c771b38  r15: 0x0000000000000000
  rip: 0x00007fffffe00600  rfl: 0x0000000000010202  cr2: 0x00007fffffe00600
Logical CPU: 2

Binary Images:
       0x10cb35000 -        0x10cb35ff7  echo (170) <A9BC6D8D-19CF-3DF3-8EB4-9677BA9F265D> /bin/echo
       0x10cb3e000 -        0x10ccfffef  libSystem.B.dylib (125.2.11) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
       0x10cd93000 -        0x10cd97ff7  libmathCommon.A.dylib (315) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
    0x7fff6c735000 -     0x7fff6c76993f  dyld (210.2.3) <A40597AA-5529-3337-8C09-D8A014EB1578> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 41894
    thread_create: 1
    thread_set_state: 2793

VM Region Summary:
ReadOnly portion of Libraries: Total=2568K resident=2396K(93%) swapped_out_or_unallocated=172K(7%)
Writable regions: Total=8508K written=24K(0%) resident=68K(1%) swapped_out=0K(0%) unallocated=8440K(99%)

REGION TYPE                      VIRTUAL
===========                      =======
STACK GUARD                        56.0M
Stack                              8192K
__DATA                              384K
__LINKEDIT                          532K
__TEXT                             2036K
shared memory                        12K
===========                      =======
TOTAL                              66.9M

At the same time /path/to/mounted/image/bin/echo test works fine.

What did I miss? How to make it all work correctly?

UPDATE: I'm giving up on it. Apparently, chroot on Mac OS X is completely broken. Even after I got some binaries running inside chroot (by installing same OS version in chroot as I have on host), domain names lookups fail and it seems that even if I could fix it somehow, most probably there will be other problems.

  • libSystem.B.dylib on 10.8 has trouble loading the commmand. Could you run these commands file /Volumes/VOLUME/bin/echo, otool -h -L /Volumes/VOLUME/bin/echo and uname -a on both OS X 10.6.8 and OS X 10.8.4 and add the output to your question?
    – jaume
    Commented Sep 2, 2013 at 7:19
  • Even within a chroot'ed environment the kernel image is still the one of the host system (10.8.4 in your case). So any 10.6 binaries/libraries calling the kernel may run into issues. I don't think you can simulate virtualization by using chroot.
    – nohillside
    Commented Sep 2, 2013 at 20:12
  • Binaries from 10.6 (well, at least /bin/echo) run fine on 10.8 without chroot. I don't want simulate virtualization, I want isolated build environment.
    – gelraen
    Commented Sep 2, 2013 at 21:30


You must log in to answer this question.

Browse other questions tagged .