dex4er / fakechroot

gives a fake chroot environment
GNU Lesser General Public License v2.1
295 stars 73 forks source link

Running minimal rootfs as non-root on arm device #11

Open corbinlc opened 11 years ago

corbinlc commented 11 years ago

Hello,

I have created a rootfs using buildroot, but using a crosstool-ng toolchain with glibc. This showed me the minimal set of files necessary. I then replaced all the libraries with ones pulled straight from the squeeze .deb packages for armel. I then added fakeroot and fakechroot to the mix. I also modified the resolv.conf, hosts, and nsswitch.conf files to my liking. After uploading this to my device, a lot is working. "cd /" takes me to the correct place. "whoami" returns root. But, anything DNS related is not working. For example "ping google.com" returns "bad address". I have copied the libnss_* and libresolv libraries over and everything else I think is necessary. Entering the same setup, but using qemu and chroot on my host machine works, but I am trying to figure out what it is not working on my target device.

When I run "strace ping google.com" I get the following: open("/data/local/target/bin/ping", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0(\0\1\0\0\0\0\314\0\0004\0\0\0"..., 4094) = 4094 close(3) = 0 execve("/data/local/target/bin/ping", ["ping", "google.com"], [/* 21 vars */]) = 0 brk(0) = 0xb5000 uname({sys="Linux", node="localhost", ...}) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001d000 open("/data/local/target/usr/lib/fakechroot/libfakechroot.so", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\364\32\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0666, st_size=45540, ...}) = 0 mmap2(NULL, 77628, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40026000 mprotect(0x40031000, 28672, PROT_NONE) = 0 mmap2(0x40038000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa) = 0x40038000 close(3) = 0 open("/data/local/target/usr/lib/libfakeroot/libfakeroot-sysv.so", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\340'\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0666, st_size=29092, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001f000 mmap2(NULL, 60672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40039000 mprotect(0x40040000, 28672, PROT_NONE) = 0 mmap2(0x40047000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6) = 0x40047000 close(3) = 0 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/v7l/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/v7l/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/v7l/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/v7l/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/v7l/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/v7l/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/v7l/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/v7l", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/tls", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/v7l/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/v7l/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/v7l/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/v7l/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/v7l/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/v7l/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/v7l/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/v7l", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/usr/lib", {st_mode=S_IFDIR|0775, st_size=0, ...}) = 0 open("/data/local/target/lib/tls/v7l/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/v7l/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/v7l/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/v7l/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/v7l/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/v7l/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/v7l/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/v7l", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/tls", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/v7l/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/v7l/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/v7l/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/v7l/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/v7l/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/v7l/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/v7l/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/v7l", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/neon/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/neon/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/neon/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/neon", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/vfp/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/data/local/target/lib/vfp", 0xbe8980f8) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\374V\1\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=1209660, ...}) = 0 mmap2(NULL, 1246468, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40048000 mprotect(0x4016b000, 32768, PROT_NONE) = 0 mmap2(0x40173000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x123) = 0x40173000 mmap2(0x40176000, 9476, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40176000 close(3) = 0 open("tls/v7l/neon/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libdl.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0$\t\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=9808, ...}) = 0 mmap2(NULL, 41136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40179000 mprotect(0x4017b000, 28672, PROT_NONE) = 0 mmap2(0x40182000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1) = 0x40182000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40020000 set_tls(0x40020170, 0x40020847, 0x40020848, 0x40020170, 0x40025000) = 0 mprotect(0x40182000, 4096, PROT_READ) = 0 mprotect(0x40173000, 8192, PROT_READ) = 0 mprotect(0xb1000, 4096, PROT_READ) = 0 mprotect(0x40024000, 4096, PROT_READ) = 0 brk(0) = 0xb5000 brk(0xd6000) = 0xd6000 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libnss_compat.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0|\r\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=26480, ...}) = 0 mmap2(NULL, 57952, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40184000 mprotect(0x4018a000, 28672, PROT_NONE) = 0 mmap2(0x40191000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5) = 0x40191000 close(3) = 0 open("tls/v7l/neon/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libnsl.so.1", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0x/\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=75732, ...}) = 0 mmap2(NULL, 116488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40193000 mprotect(0x401a5000, 28672, PROT_NONE) = 0 mmap2(0x401ac000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11) = 0x401ac000 mmap2(0x401ae000, 5896, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401ae000 close(3) = 0 mprotect(0x401ac000, 4096, PROT_READ) = 0 mprotect(0x40191000, 4096, PROT_READ) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libnss_nis.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0X\30\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=38608, ...}) = 0 mmap2(NULL, 70236, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x401b0000 mprotect(0x401b9000, 28672, PROT_NONE) = 0 mmap2(0x401c0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x8) = 0x401c0000 close(3) = 0 open("tls/v7l/neon/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libnss_files.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\330\31\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=42688, ...}) = 0 mmap2(NULL, 74492, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x401c2000 mprotect(0x401cc000, 28672, PROT_NONE) = 0 mmap2(0x401d3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9) = 0x401d3000 close(3) = 0 mprotect(0x401d3000, 4096, PROT_READ) = 0 mprotect(0x401c0000, 4096, PROT_READ) = 0 open("/data/local/target/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC) _llseek(3, 0, [0], SEEK_CUR) = 0 fstat64(3, {st_mode=S_IFREG|0666, st_size=596, ...}) = 0 mmap2(NULL, 596, PROT_READ, MAP_SHARED, 3, 0) = 0x40021000 _llseek(3, 596, [596], SEEK_SET) = 0 munmap(0x40021000, 596) = 0 close(3) = 0 getpid() = 5994 socket(PF_NETLINK, SOCK_RAW, 0) = 3 bind(3, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0 getsockname(3, {sa_family=AF_NETLINK, pid=5994, groups=00000000}, [12]) = 0 gettimeofday({1366699621, 228514}, NULL) = 0 sendto(3, "\24\0\0\0\26\0\1\3e.vQ\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"0\0\0\0\24\0\2\0e.vQj\27\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 108 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0\24\0\2\0e.vQj\27\0\0\n\200\200\376\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 128 recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0e.vQj\27\0\0\0\0\0\0\1\0\0\0\24\0\1\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 20 close(3) = 0 open("/etc/resolv.conf", O_RDONLY) = -1 ENOENT (No such file or directory) uname({sys="Linux", node="localhost", ...}) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(3) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libnss_dns.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0000\v\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=18040, ...}) = 0 mmap2(NULL, 49316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x401d5000 mprotect(0x401d9000, 28672, PROT_NONE) = 0 mmap2(0x401e0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3) = 0x401e0000 close(3) = 0 open("tls/v7l/neon/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/neon/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/v7l/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/neon/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("tls/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/neon/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("v7l/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("neon/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("vfp/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/usr/lib/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) open("/data/local/target/lib/libresolv.so.2", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0H$\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0777, st_size=71524, ...}) = 0 mmap2(NULL, 79772, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x401e2000 mmap2(0x401f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10) = 0x401f2000 mmap2(0x401f4000, 6044, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401f4000 close(3) = 0 mprotect(0x401f2000, 4096, PROT_READ) = 0 mprotect(0x401e0000, 4096, PROT_READ) = 0 open("/etc/host.conf", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/etc/resolv.conf", 0xbe897e98) = -1 ENOENT (No such file or directory) gettimeofday({1366699621, 250480}, NULL) = 0 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 gettimeofday({1366699621, 251348}, NULL) = 0 poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}]) send(3, "\332\316\1\0\0\1\0\0\0\0\0\0\6google\3com\0\0\1\0\1", 28, MSG_NOSIGNAL) = 28 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLERR}]) close(3) = 0 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 gettimeofday({1366699621, 253357}, NULL) = 0 poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}]) send(3, "\332\316\1\0\0\1\0\0\0\0\0\0\6google\3com\0\0\1\0\1", 28, MSG_NOSIGNAL) = 28 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLERR}]) close(3) = 0 gettimeofday({1366699621, 254826}, NULL) = 0 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 gettimeofday({1366699621, 255502}, NULL) = 0 poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}]) send(3, "DU\1\0\0\1\0\0\0\0\0\0\6google\3com\0\0\1\0\1", 28, MSG_NOSIGNAL) = 28 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLERR}]) close(3) = 0 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 gettimeofday({1366699621, 257278}, NULL) = 0 poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}]) send(3, "DU\1\0\0\1\0\0\0\0\0\0\6google\3com\0\0\1\0\1", 28, MSG_NOSIGNAL) = 28 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLERR}]) close(3) = 0 open("/data/local/target/etc/hosts", O_RDONLY|O_CLOEXEC) = 3 fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC) fstat64(3, {st_mode=S_IFREG|0666, st_size=40, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40021000 read(3, "127.0.0.1\tlocalhost\n127.0.1.1\tbu"..., 4096) = 40 read(3, "", 4096) = 0 close(3) = 0 munmap(0x40021000, 4096) = 0 write(2, "ping: bad address 'google.com'\n", 31) = 31 exit_group(1) = ?

You can see it finds the various libnss_* libraries and it figured out that the host file wasn't simply at /etc/hosts, but why do you think it didn't look in the correct location for nsswitch.conf and resolv.conf?

Thanks, Corbin

dex4er commented 10 years ago

Could you provide some script which creates such crosstool environment? I didn't use this tool before and I don't know how it works but I'd like to reproduce your problem.

Thanks