darlinghq / darling

Darwin/macOS emulation layer for Linux
http://www.darlinghq.org
GNU General Public License v3.0
11.34k stars 437 forks source link

Overlayfs not available on older kernels #226

Closed ahyattdev closed 7 years ago

ahyattdev commented 7 years ago
andrewhyatt@debian-vm:~$ darling shell
Cannot mount overlay: No such device
Cannot spawn a child process: Cannot allocate memory

Tried on a fresh install in a VM.

ahyattdev commented 7 years ago
execve("/usr/local/bin/darling", ["darling"], [/* 16 vars */]) = 0
brk(0)                                  = 0x2188000
fcntl(0, F_GETFD)                       = 0
fcntl(1, F_GETFD)                       = 0
fcntl(2, F_GETFD)                       = 0
access("/etc/suid-debug", F_OK)         = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0958129000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/usr/local/lib//darling/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib//darling/tls/x86_64", 0x7ffcc63c1c30) = -1 ENOENT (No such file or directory)
open("/usr/local/lib//darling/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib//darling/tls", 0x7ffcc63c1c30) = -1 ENOENT (No such file or directory)
open("/usr/local/lib//darling/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib//darling/x86_64", 0x7ffcc63c1c30) = -1 ENOENT (No such file or directory)
open("/usr/local/lib//darling/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib//darling", {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=96263, ...}) = 0
mmap(NULL, 96263, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0958111000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1738176, ...}) = 0
mmap(NULL, 3844640, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f0957b60000
mprotect(0x7f0957d01000, 2097152, PROT_NONE) = 0
mmap(0x7f0957f01000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a1000) = 0x7f0957f01000
mmap(0x7f0957f07000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f0957f07000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0958110000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f095810f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f095810e000
arch_prctl(ARCH_SET_FS, 0x7f095810f700) = 0
mprotect(0x7f0957f01000, 16384, PROT_READ) = 0
mprotect(0x7f095812b000, 4096, PROT_READ) = 0
munmap(0x7f0958111000, 96263)           = 0
write(2, "This is Darling, translation lay"..., 56This is Darling, translation layer for macOS software.

) = 56
write(2, "Copyright (C) 2012-2016 Lubos Do"..., 39Copyright (C) 2012-2016 Lubos Dolezel

) = 39
write(2, "Usage:\n", 7Usage:
)                 = 7
write(2, "\tdarling program-path [arguments"..., 37 darling program-path [arguments...]
) = 37
write(2, "\tdarling shell [arguments...]\n", 30 darling shell [arguments...]
) = 30
write(2, "\n", 1
)                       = 1
write(2, "Environment variables:\nDPREFIX -"..., 98Environment variables:
DPREFIX - specifies the location of Darling prefix, defaults to ~/.darling
) = 98
exit_group(1)                           = ?
+++ exited with 1 +++
bugaevc commented 7 years ago

Cannot mount overlay: No such device

Overlayfs is available since Linux kernel 3.18, but Debian Stable still uses an older version (please confirm). If supporting old kernels is important for us (think about Android), we may want to use mergerfs or something — but I'm concerned about its performance if all the file operations need to go through it.

Cc @LubosD

By the way, your log only shows outputting usage info because you forgot to add "shell".

vlad-ivanov-name commented 7 years ago

think about Android

About 60% of Android devices run Linux kernel 3.18 or newer (https://developer.android.com/about/dashboards/index.html, https://android.stackexchange.com/questions/51651/which-android-runs-which-linux-kernel)

bugaevc commented 7 years ago

@resetnow unfortunately, that's not how it works, as the comments point out:

Also, when a device is released with specific android version and kernel, and later the android version is updated by manufacturer, the kernel version is mostly kept at initial version with patches.

For example, I have 3.10 on my Nexus 5X running the latest 7.1 Nougat.

On the other hand, Darling clearly can't be run as an app under Android -- it requires the kernel module at the very least -- so general statistics are irrelevant, and we should count custom ROMs instead -- and since they are based on AOSP, the situation may be better.

stek29 commented 7 years ago

we should count custom ROMs instead -- and since they are based on AOSP, the situation may be better.

It's usually not. Custom ROMs rarely update the manufacturers' kernel version, because a lot of stuff may break.

P.S. I also have 3.10 on my device running CM14.1 (Nougat 7.1 based)

vlad-ivanov-name commented 7 years ago

Good to know, I have 3.18 (Android 7) on a chinese phone with mtk cpu, so I assumed others have similar versions too. I guess > 3.18 users are a minority.

TheTumultuousUnicornOfDarkness commented 7 years ago

What about KitKat? I have Linux 3.4 on mine, haha. If overlayfs is not available, why not copy the entire prefix (like Wine does)?

LubosD commented 7 years ago

Guys, I think Android devices will have sufficiently fresh kernels by the time we have anything truly useful on iOS emu ;-)

msva commented 7 years ago

Guys, I think Android devices will have sufficiently fresh kernels by the time we have anything truly useful on iOS emu ;-)

I afraid, it will be only "flagmans", who will. And anyway not all of them. Most vendors stopping to release updates right after the model release. And none of them released major kernel update on my memory.

bugaevc commented 7 years ago

See #291

ahyattdev commented 7 years ago

As time goes on, this will become less and less of an issue.