1,开发板:韦东山JZ2440。
2,linux 版本:linux-3.4.2
3,参考文献:http://blog.csdn.net/liangzhuangdongtou/article/details/51942595
按照参考文献的方法上次成功移植了apache1.3.39,前几天把文件系统搞崩了,开始了为期两天的坑爹移植之路。
悲剧的开始:
#/usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start httpd: bad user name nobody
什么情况,于是各种尝试修改/etc/passwd和/etc/group以及addgroup nobody和adduser -g nobody nobody,改来改去,折腾了半天,还是bad user name nobody.真是奇了怪了。
[root@UnixHost ]# ping localhost ping: bad address 'localhost' [root@UnixHost ]#
ping本地回环地址也出现问题,但是ping主机的ip是正常的(开发板和主机通过网线相连)。网上找找资料,改了/etc/hosts文件为如下:
[root@UnixHost etc]# cat hosts 127.0.0.1 localhost 127.0.1.1 book-desktop # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback
再次ping ,还是bad address,网上说是缺少nss的库,于是在交叉编译工具的lib文件夹中找到了libnss相关的*.so文件,拷贝到开发板,再次尝试ping,正常。
[root@UnixHost lib]# tar xzvf libnss.tar.gz libnss_compat-2.9.so libnss_compat.so.2 libnss_dns-2.9.so libnss_dns.so.2 libnss_files-2.9.so libnss_files.so.2 libnss_hesiod-2.9.so libnss_hesiod.so.2 libnss_nis-2.9.so libnss_nisplus-2.9.so libnss_nisplus.so.2 libnss_nis.so.2
这里注意,拷贝的时候,一定要用以下两个命令进行打包解包,否则会丢失符号链接!!!!
打包命令:tar czvf output.tar.gz input 解包命令:tar xzvf output.tar.gz
这样就能够保留符号链接,拷贝到开发板解包之后能够正常工作。
这样是能够ping通了,但是apache还是一样的报错。
漫长思索中........
根据这篇文章的提示https://www.linuxquestions.org/questions/linux-server-73/httpd-bad-user-name-apache-540565/
把strace 移植到开发板,跟踪httpd的执行过程,果然发现了一些猫腻。
[root@UnixHost lib]# strace /usr/local/apache/bin/httpd -f /usr/local/apache/con f/httpd.conf start execve("/usr/local/apache/bin/httpd", ["/usr/local/apache/bin/httpd", "-f", "/usr/local/apache/conf/httpd.con"..., "start"], [/* 13 vars */]) = 0 brk(0) = 0xb1000 uname({sys="Linux", node="UnixHost", ...}) = 0 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/lib/tls/v4l/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/v4l/half", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/tls/v4l/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/v4l", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/tls/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/half", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/tls/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/v4l/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/v4l/half", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/v4l/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/v4l", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/half", 0xbeb31448) = -1 ENOENT (No such file or directory) open("/lib/libm.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\3701\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0555, st_size=730551, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f15000 mmap2(NULL, 680104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e4c000 mprotect(0xb6eea000, 28672, PROT_NONE) = 0 mmap2(0xb6ef1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9d) = 0xb6ef1000 close(3) = 0 open("/lib/libcrypt.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\0t\7\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0555, st_size=42059, ...}) = 0 mmap2(NULL, 225608, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e14000 mprotect(0xb6e1c000, 28672, PROT_NONE) = 0 mmap2(0xb6e23000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7) = 0xb6e23000 mmap2(0xb6e25000, 155976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6e25000 close(3) = 0 open("/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\334Q\1\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0555, st_size=1479594, ...}) = 0 mmap2(NULL, 1212952, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6ceb000 mprotect(0xb6e06000, 32768, PROT_NONE) = 0 mmap2(0xb6e0e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11b) = 0xb6e0e000 mmap2(0xb6e11000, 8728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6e11000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f14000 set_tls(0xb6f144a0, 0xb6f14b77, 0xb6f14b78, 0xb6f144a0, 0xb6f17000) = 0 mprotect(0xb6e0e000, 8192, PROT_READ) = 0 mprotect(0xb6e23000, 4096, PROT_READ) = 0 mprotect(0xb6ef1000, 4096, PROT_READ) = 0 mprotect(0xa8000, 4096, PROT_READ) = 0 mprotect(0xb6f16000, 4096, PROT_READ) = 0 brk(0) = 0xb1000 brk(0xd4000) = 0xd4000 stat64("/usr/local/apache/bin/suexec", 0xbeb31b38) = -1 ENOENT (No such file or directory) lstat64("/usr/local/apache/conf/httpd.conf", {st_mode=S_IFREG|0766, st_size=33429, ...}) = 0 open("/usr/local/apache/conf/httpd.conf", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0766, st_size=33429, ...}) = 0 fstat64(3, {st_mode=S_IFREG|0766, st_size=33429, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f13000 read(3, "##\n## httpd.conf -- Apache HTTP "..., 4096) = 4096 stat64("/home/webroot", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 read(3, "r by using \"/dev/null\" (for Unix"..., 4096) = 4096 read(3, " is called. The default is Off.\n"..., 4096) = 4096 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/lib/libnss_compat.so.2", O_RDONLY) = 4 read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0x\r\0\0004\0\0\0"..., 512) = 512 fstat64(4, {st_mode=S_IFREG|0555, st_size=33624, ...}) = 0 mmap2(NULL, 57944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6cdc000 mprotect(0xb6ce2000, 28672, PROT_NONE) = 0 mmap2(0xb6ce9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x5) = 0xb6ce9000 close(4) = 0 open("/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/v4l/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/v4l", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/v4l/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/v4l", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/usr/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 open("/lib/alsalib/tls/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls/v4l/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/tls/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls/v4l", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/tls/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/v4l/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/v4l", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/half", 0xbeb2ef28) = -1 ENOENT (No such file or directory) open("/lib/alsalib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 open("/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No such file or directory) open("/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) munmap(0xb6cdc000, 57944) = 0 open("/lib/libnss_files.so.2", O_RDONLY) = 4 read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0t\30\0\0004\0\0\0"..., 512) = 512 fstat64(4, {st_mode=S_IFREG|0555, st_size=49617, ...}) = 0 mmap2(NULL, 70336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6cd9000 mprotect(0xb6ce2000, 28672, PROT_NONE) = 0 mmap2(0xb6ce9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x8) = 0xb6ce9000 close(4) = 0 mprotect(0xb6ce9000, 4096, PROT_READ) = 0 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4 fcntl64(4, F_GETFD) = 0x1 (flags FD_CLOEXEC) fstat64(4, {st_mode=S_IFREG|0644, st_size=135, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f12000 read(4, "root:x:0:0:root:/root:/bin/sh\nss"..., 4096) = 135 close(4) = 0 munmap(0xb6f12000, 4096) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/group", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) write(2, "httpd: bad group name nobody\n", 29httpd: bad group name nobody ) = 29 exit_group(1) = ? +++ exited with 1 +++open("/usr/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
这句话很关键,系统尝试在多个lib路径中都没有找到该so,于是
[root@UnixHost lib]# find / -name libnsl.so.1 /lib/sshlib/libnsl.so.1 [root@UnixHost lib]#
系统中有该文件!!!,于是把环境变量设置一下
root@UnixHost lib]# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/sshlib
open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/group", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/etc/group", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) write(2, "httpd: bad group name nobody\n", 29httpd: bad group name nobody ) = 29 exit_group(1) = ? +++ exited with 1 +++
还是报错,前面的省了,注意到/etc/group 没有这个文件,那就建立一个,如下
[root@UnixHost etc]# cat group nobody::65533: nogroup::65534:nobody
[root@UnixHost etc]# /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start [Thu Jan 1 07:44:41 1970] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName fopen: No such file or directory httpd: could not open error log file /work/software/web/apache_1.3.39/built/logs/error_log. [root@UnixHost etc]#
这下终于出来点“正常”的错误了。根据报错,在httpd.conf末尾加上一句ServerName localhost,把error_log的路径创建出来:
[root@UnixHost conf]# mkdir -p /work/software/web/apache_1.3.39/built/logs/ [root@UnixHost conf]# touch /work/software/web/apache_1.3.39/built/logs/error_log
再次尝试执行httpd,竟然什么都没有,浏览器也无法访问,ps查看进程,没有发现httpd的守护进程:
[root@UnixHost conf]# /usr/local/apache/bin/httpd -f /usr/local/apache/conf/http d.conf start [root@UnixHost conf]# ps |grep http 1206 root 0:00 grep http
再次进入了僵局,于是再次strace,打印如下:
[root@UnixHost conf]# strace /usr/local/apache/bin/httpd -f /usr/local/apache/co nf/httpd.conf start execve("/usr/local/apache/bin/httpd", ["/usr/local/apache/bin/httpd", "-f", "/usr/local/apache/conf/httpd.con"..., "start"], [/* 18 vars */]) = 0 brk(0) = 0xb1000 uname({sys="Linux", node="UnixHost", ...}) = 0 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/lib/tls/v4l/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/v4l/half", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/tls/v4l/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/v4l", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/tls/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls/half", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/tls/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/tls", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/v4l/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/v4l/half", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/v4l/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/v4l", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/half/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/half", 0xbec39398) = -1 ENOENT (No such file or directory) open("/lib/libm.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\3701\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0555, st_size=730551, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f63000 mmap2(NULL, 680104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e9a000 mprotect(0xb6f38000, 28672, PROT_NONE) = 0 mmap2(0xb6f3f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9d) = 0xb6f3f000 close(3) = 0 open("/lib/libcrypt.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\0t\7\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0555, st_size=42059, ...}) = 0 mmap2(NULL, 225608, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e62000 mprotect(0xb6e6a000, 28672, PROT_NONE) = 0 mmap2(0xb6e71000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7) = 0xb6e71000 mmap2(0xb6e73000, 155976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6e73000 close(3) = 0 open("/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\334Q\1\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0555, st_size=1479594, ...}) = 0 mmap2(NULL, 1212952, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6d39000 mprotect(0xb6e54000, 32768, PROT_NONE) = 0 mmap2(0xb6e5c000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11b) = 0xb6e5c000 mmap2(0xb6e5f000, 8728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6e5f000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f62000 set_tls(0xb6f624a0, 0xb6f62b77, 0xb6f62b78, 0xb6f624a0, 0xb6f65000) = 0 mprotect(0xb6e5c000, 8192, PROT_READ) = 0 mprotect(0xb6e71000, 4096, PROT_READ) = 0 mprotect(0xb6f3f000, 4096, PROT_READ) = 0 mprotect(0xa8000, 4096, PROT_READ) = 0 mprotect(0xb6f64000, 4096, PROT_READ) = 0 brk(0) = 0xb1000 brk(0xd4000) = 0xd4000 stat64("/usr/local/apache/bin/suexec", 0xbec39a88) = -1 ENOENT (No such file or directory) lstat64("/usr/local/apache/conf/httpd.conf", {st_mode=S_IFREG|0766, st_size=33450, ...}) = 0 open("/usr/local/apache/conf/httpd.conf", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0766, st_size=33450, ...}) = 0 fstat64(3, {st_mode=S_IFREG|0766, st_size=33450, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f61000 read(3, "##\n## httpd.conf -- Apache HTTP "..., 4096) = 4096 stat64("/home/webroot", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 read(3, "r by using \"/dev/null\" (for Unix"..., 4096) = 4096 read(3, " is called. The default is Off.\n"..., 4096) = 4096 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/lib/libnss_compat.so.2", O_RDONLY) = 4 read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0x\r\0\0004\0\0\0"..., 512) = 512 fstat64(4, {st_mode=S_IFREG|0555, st_size=33624, ...}) = 0 mmap2(NULL, 57944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6d2a000 mprotect(0xb6d30000, 28672, PROT_NONE) = 0 mmap2(0xb6d37000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x5) = 0xb6d37000 close(4) = 0 open("/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/v4l/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/v4l", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/tls", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/v4l/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/v4l", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/usr/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 open("/lib/alsalib/tls/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls/v4l/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/tls/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls/v4l", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/tls/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/tls", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/v4l/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/v4l", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/alsalib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/alsalib", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 open("/lib/sshlib/tls/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/tls/v4l/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/tls/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/tls/v4l", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/tls/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/tls/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/tls", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/v4l/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/v4l/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/v4l/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/v4l", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/half/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) stat64("/lib/sshlib/half", 0xbec36e78) = -1 ENOENT (No such file or directory) open("/lib/sshlib/libnsl.so.1", O_RDONLY) = 4 read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0t/\0\0004\0\0\0"..., 512) = 512 fstat64(4, {st_mode=S_IFREG|0555, st_size=96883, ...}) = 0 mmap2(NULL, 116488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6d0d000 mprotect(0xb6d1f000, 28672, PROT_NONE) = 0 mmap2(0xb6d26000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x11) = 0xb6d26000 mmap2(0xb6d28000, 5896, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6d28000 close(4) = 0 mprotect(0xb6d26000, 4096, PROT_READ) = 0 mprotect(0xb6d37000, 4096, PROT_READ) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/lib/libnss_nis.so.2", O_RDONLY) = 4 read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\300\30\0\0004\0\0\0"..., 512) = 512 fstat64(4, {st_mode=S_IFREG|0555, st_size=48791, ...}) = 0 mmap2(NULL, 70244, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6cfb000 mprotect(0xb6d04000, 28672, PROT_NONE) = 0 mmap2(0xb6d0b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x8) = 0xb6d0b000 close(4) = 0 open("/lib/libnss_files.so.2", O_RDONLY) = 4 read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0t\30\0\0004\0\0\0"..., 512) = 512 fstat64(4, {st_mode=S_IFREG|0555, st_size=49617, ...}) = 0 mmap2(NULL, 70336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6ce9000 mprotect(0xb6cf2000, 28672, PROT_NONE) = 0 mmap2(0xb6cf9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x8) = 0xb6cf9000 close(4) = 0 mprotect(0xb6cf9000, 4096, PROT_READ) = 0 mprotect(0xb6d0b000, 4096, PROT_READ) = 0 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4 fcntl64(4, F_GETFD) = 0x1 (flags FD_CLOEXEC) _llseek(4, 0, [0], SEEK_CUR) = 0 fstat64(4, {st_mode=S_IFREG|0644, st_size=135, ...}) = 0 mmap2(NULL, 135, PROT_READ, MAP_SHARED, 4, 0) = 0xb6f60000 _llseek(4, 135, [135], SEEK_SET) = 0 munmap(0xb6f60000, 135) = 0 close(4) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) close(4) = 0 open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/group", O_RDONLY|O_CLOEXEC) = 4 _llseek(4, 0, [0], SEEK_CUR) = 0 fstat64(4, {st_mode=S_IFREG|0644, st_size=37, ...}) = 0 mmap2(NULL, 37, PROT_READ, MAP_SHARED, 4, 0) = 0xb6f60000 _llseek(4, 37, [37], SEEK_SET) = 0 munmap(0xb6f60000, 37) = 0 close(4) = 0 read(3, "m this server.\n#\n Order allow"..., 4096) = 4096 read(3, "ince enabling it means that\n# ea"..., 4096) = 4096 read(3, "cumentRoot. Comment it if you do"..., 4096) = 4096 read(3, "d_mime.c>\n\n #\n # AddLangua"..., 4096) = 4096 read(3, "ure\n #\n #AddHandler send-a"..., 4096) = 4096 read(3, "ls before you try to setup virtu"..., 4096) = 682 read(3, "", 4096) = 0 close(3) = 0 munmap(0xb6f61000, 4096) = 0 stat64("/home/webroot/conf/srm.conf", 0xbec39a10) = -1 ENOENT (No such file or directory) stat64("/home/webroot/conf/access.conf", 0xbec39a10) = -1 ENOENT (No such file or directory) open("/work/software/web/apache_1.3.39/built/logs/error_log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3 fcntl64(3, F_DUPFD, 15) = 15 close(3) = 0 fcntl64(15, F_GETFL) = 0x401 (flags O_WRONLY|O_APPEND) fstat64(15, {st_mode=S_IFREG|0644, st_size=159, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f61000 _llseek(15, 0, [0], SEEK_CUR) = 0 dup2(15, 2) = 2 open("/work/software/web/apache_1.3.39/built/conf/mime.types", O_RDONLY) = -1 ENOENT (No such file or directory) gettimeofday({3069, 838718}, NULL) = 0 open("/etc/localtime", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=389, ...}) = 0 fstat64(3, {st_mode=S_IFREG|0644, st_size=389, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f60000 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\0"..., 4096) = 389 _llseek(3, -7, [382], SEEK_CUR) = 0 read(3, "\nCST-8\n", 4096) = 7 close(3) = 0 munmap(0xb6f60000, 4096) = 0 write(15, "[Thu Jan 1 07:51:09 1970] [erro"..., 159) = 159 exit_group(1) = ? +++ exited with 1 +++
注意到这句:connect(4, {sa_family=AF_FILE, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
查找相关资料,没有发现什么有价值的线索,搞了半天不知道毛意思。。。。。
于是又发现这句可疑:write(15, "[Thu Jan 1 07:51:09 1970] [erro"..., 159) = 159
这句话的意思应该是终端会打印出errorlog,但是终端什么都没有打印,会不会是输出到了errorlog文件呢??
很有可能!!!,于是再次仔细分析,
root@UnixHost conf]# cat /work/software/web/apache_1.3.39/built/logs/error_log [Thu Jan 1 07:48:44 1970] [error] (2)No such file or directory: could not open mime types config file /work/software/web/apache_1.3.39/built/conf/mime.types. [Thu Jan 1 07:51:09 1970] [error] (2)No such file or directory: could not open mime types config file /work/software/web/apache_1.3.39/built/conf/mime.types.
有猫腻,,于是把文件复制到该路径下,注意,httpd是以nobody用户运行的,注意权限问题
[root@UnixHost conf]# ls httpd.conf mime.types [root@UnixHost conf]# mkdir -p /work/software/web/apache_1.3.39/built/conf/ [root@UnixHost conf]# cp mime.types /work/software/web/apache_1.3.39/built/conf/ [root@UnixHost conf]# chown -R nobody:nobody /work/software/web/apache_1.3.39/built/logs/error_log [root@UnixHost conf]# chown -R nobody:nobody /work/software/web/apache_1.3.39/built/conf/mime.types [root@UnixHost conf]#
终于正常了:
[root@UnixHost conf]# /usr/local/apache/bin/httpd -f /usr/local/apache/conf/http d.conf start [root@UnixHost conf]# ps |grep httpd 1221 root 0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start 1222 nobody 0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start 1223 nobody 0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start 1224 nobody 0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start 1225 nobody 0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start 1226 nobody 0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf start 1231 root 0:00 grep httpd
赶紧喝杯咖啡压压惊,整整两天了,茶饭不思~~~~~
赶紧打开浏览器访问
什么情况,但总算把apache搞出来了,于是cat一下errorlog,
[root@UnixHost conf]# cat /work/software/web/apache_1.3.39/built/logs/error_log [Thu Jan 1 07:48:44 1970] [error] (2)No such file or directory: could not open mime types config file /work/software/web/apache_1.3.39/built/conf/mime.types. [Thu Jan 1 07:51:09 1970] [error] (2)No such file or directory: could not open mime types config file /work/software/web/apache_1.3.39/built/conf/mime.types. [Thu Jan 1 07:59:15 1970] [notice] Apache/1.3.39 (Unix) configured -- resuming normal operations [Thu Jan 1 07:59:15 1970] [notice] Accept mutex: sysvsem (Default: sysvsem) [Thu Jan 1 07:59:27 1970] [crit] (98)Address already in use: make_sock: could not bind to port 8080 [Thu Jan 1 08:01:20 1970] [error] [client 192.168.137.1] File does not exist: /work/software/web/apache_1.3.39/built/htdocs/ [root@UnixHost conf]#
又是该死的路径问题!!!,apache居然把路径都编译进了可执行文件中,于是从新编译一遍apache,但是把参数改为如下:
CC=arm-linux-gcc./configure --prefix=/www/webroot/
这下没那么罗嗦了,编译完成之后直接把apache的目录搬到开发板的/www/webroot/目录下面,哈哈,这下清净了,久违的helloword终于出来了~~~此次过程中可以看出,strace工具真是强大,要是没有这个工具,还真不知道该如何下手。