Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get of rid of the VirtualPrefix #222

Merged
merged 24 commits into from
Jan 5, 2017

Conversation

bugaevc
Copy link
Member

@bugaevc bugaevc commented Jan 5, 2017

This is my work on building the new layout of the "Darling container" (see #197).

  • Deprecate the old 'darling' script and always build the new executable.
    • One notable maybe-missing thing is OpenSSL certificates -- please look into this.
  • Get rid of Darling's chroot-emulation-in-syscall-emulation (known as VirtualPrefix). Instead, we mount $DPREFIX directly onto / inside the container.
    • Mount a new procfs (for our PID namespace) onto /proc inside.
    • This means that native executables (accessible through /Volumes/SystemRoot/...) see the new layout, too. You can use e.g. /Volumes/SystemRoot/bin/ps.
    • The complicated part here is loading shared libraries.
      • Set up /etc/ld.so.conf.d and run ldconfig at installation time.
      • Pass LD_LIBRARY_PATH for /usr/local/lib/darling.
      • Symlink /lib -> /Volumes/SystemRoot/lib and lib64 -> /Volumes/SystemRoot/lib64.
        • This is because most ELFs have /lib64/ld-linux-x86-64.so.2 (or 32bit version) hard-coded as their interpreter.
  • Create most of the prefix filesystem layout inside /usr/local/libexec/darling at installation time.
  • On /Volumes (see New /Volumes design #220):
    • Move /system-root to /Volumes/SystemRoot.
    • Turn off user namespaces for now -- they were not really useful anyway.
    • hdiutil works if launched like DPREFIX=/ PATH=/Volumes/SystemRoot/bin /usr/bin/hdiutil. It should be fairly easy to make it support the new layout.
  • Misc changes that are better described by their commit messages and diffs.

Please do review and test!

@bugaevc bugaevc requested a review from LubosD January 5, 2017 14:33
@LubosD
Copy link
Member

LubosD commented Jan 5, 2017

There is one little problem (but it can be solved after I review the changes and merge the code) - in some cases, a little bit of VirtualPrefix code (or simply new code) are still needed:

HFS+ is case insensitive and apps depend on this. I've seen software explicitly checking whether the filesystem where it's installed is case sensitive (usually HFSX on macOS) and then refusing to run.

So we will need to have a special resolution algorithm, which on the other hand only needs to be triggered in case the given system call returns -LINUX_ENOENT.

@bugaevc
Copy link
Member Author

bugaevc commented Jan 5, 2017

@LubosD good catch!

OTOH, I've heard that iOS version of HFS+ is case-sensitive, and so is APFS, so this may be less relevant in the future.

@LubosD
Copy link
Member

LubosD commented Jan 5, 2017

One more question before I merge (and I may be a little confused, possibly): where do we chroot?

@bugaevc
Copy link
Member Author

bugaevc commented Jan 5, 2017

One more question before I merge (and I may be a little confused, possibly): where do we chroot?

We don't actually use chroot(), instead, we pivot_root right after mounting overlayfs onto the prefix.

@LubosD
Copy link
Member

LubosD commented Jan 5, 2017

Clever! Never actually though about using this outside of initrd.

@LubosD LubosD merged commit 0b95b74 into darlinghq:master Jan 5, 2017
@bugaevc bugaevc added the Container The emulation container is configured incorrectly label Jan 8, 2017
@bugaevc bugaevc mentioned this pull request Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Container The emulation container is configured incorrectly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants