Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(SOLVED) Initramfs DNS query
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 21
Location: FL, USA

PostPosted: Mon Apr 15, 2013 1:19 am    Post subject: (SOLVED) Initramfs DNS query Reply with quote

Hello,

I have initramfs which contains just busybox (with static libs). I am trying to wget a file from server using host name, but it seems that it can not resolve any names. Nslookup returns "name or service not known". My resolv.conf populates by DHCP and contains two DNS servers. I am wondering if I am missing some libraries which are minimal requirements for DNS resolver to work.

Can anyone tell me what are the least libraries I need to have in my initramfs in order for dns resolver to be workable?
_________________
Use GNU/Linux


Last edited by nc-pv on Mon Apr 15, 2013 10:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2167

PostPosted: Mon Apr 15, 2013 8:47 am    Post subject: Reply with quote

nc-pv ...

The default IUSE for busybox is +static, and the nslookup component seems to function fine from a full install:

Code:
% busybox nslookup forums.gentoo.org
Server:    127.0.0.1
Address 1: 127.0.0.1 aporia.local

Name:      forums.gentoo.org
Address 1: 204.187.15.12 forums.gentoo.org

% busybox nslookup forums.gentoo.org 8.8.8.8
Server:    8.8.8.8
Address 1: 8.8.8.8 google-public-dns-a.google.com

Name:      forums.gentoo.org
Address 1: 204.187.15.12 forums.gentoo.org

If we look at a strace we can see it parsing /resolv.conf and /etc/hosts. We can also see it open the following:

/etc/ld.so.cache
/lib/libnss_files.so.2
/lib/libc.so.6
/lib/ld-linux.so.2
/lib/libnss_dns.so.2
/lib/libresolv.so.2

Code:
% strace busybox nslookup forums.gentoo.org
execve("/bin/busybox", ["busybox", "nslookup", "forums.gentoo.org"], [/* 68 vars */]) = 0
uname({sys="Linux", node="aporia", ...}) = 0
brk(0)                                  = 0x9f52000
brk(0x9f52d80)                          = 0x9f52d80
set_thread_area({entry_number:-1 -> 6, base_addr:0x9f52880, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
brk(0x9f73d80)                          = 0x9f73d80
brk(0x9f74000)                          = 0x9f74000
getuid32()                              = 0
getpid()                                = 21335
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
fstat64(3, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b3000
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b3000, 4096)                = 0
uname({sys="Linux", node="aporia", ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b3000
write(1, "Server:    127.0.0.1\n", 21)  = 21
socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_FILE, sun_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, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3)                                = 0
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=508, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# /etc/nsswitch.conf:\n# $Header:"..., 4096) = 508
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=58750, ...}) = 0
mmap2(NULL, 58750, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb77a4000
close(3)                                = 0
open("/lib/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220\37\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=42832, ...}) = 0
mmap2(NULL, 46120, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb7798000
mmap2(0xb77a2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9) = 0xb77a2000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\246\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1598752, ...}) = 0
mmap2(NULL, 1608380, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb760f000
mmap2(0xb7792000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x183) = 0xb7792000
mmap2(0xb7795000, 10940, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7795000
close(3)                                = 0
open("/lib/ld-linux.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\10\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=125940, ...}) = 0
mmap2(NULL, 129272, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb75ef000
mmap2(0xb760d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1d) = 0xb760d000
close(3)                                = 0
mprotect(0xb760d000, 4096, PROT_READ)   = 0
mprotect(0xb7792000, 8192, PROT_READ)   = 0
mprotect(0xb77a2000, 4096, PROT_READ)   = 0
munmap(0xb77a4000, 58750)               = 0
time(NULL)                              = 1366013422
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
uname({sys="Linux", node="aporia", ...}) = 0
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=935, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# /etc/host.conf:\n# $Header: /va"..., 4096) = 935
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
mmap2(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb74ef000
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 3
fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
fstat64(3, {st_mode=S_IFREG|0644, st_size=1079, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# /etc/hosts: Local Host Databas"..., 4096) = 1079
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
write(1, "Address 1: 127.0.0.1 aporia.loca"..., 34) = 34
write(1, "\n", 1)                       = 1
time(NULL)                              = 1366013422
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=1079, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# /etc/hosts: Local Host Databas"..., 4096) = 1079
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=58750, ...}) = 0
mmap2(NULL, 58750, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb77a4000
close(3)                                = 0
open("/lib/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220\r\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=21940, ...}) = 0
mmap2(NULL, 24700, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb74e8000
mmap2(0xb74ed000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4) = 0xb74ed000
close(3)                                = 0
open("/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260-\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=75444, ...}) = 0
mmap2(NULL, 84040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb74d3000
mmap2(0xb74e4000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11) = 0xb74e4000
mmap2(0xb74e6000, 6216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb74e6000
close(3)                                = 0
mprotect(0xb74e4000, 4096, PROT_READ)   = 0
mprotect(0xb74ed000, 4096, PROT_READ)   = 0
munmap(0xb77a4000, 58750)               = 0
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
uname({sys="Linux", node="aporia", ...}) = 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({1366013422, 990733}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\257t\1\0\0\1\0\0\0\0\0\1\6forums\6gentoo\3org\0\0"..., 46, MSG_NOSIGNAL) = 46
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=3, revents=POLLOUT}])
send(3, "+\330\1\0\0\1\0\0\0\0\0\1\6forums\6gentoo\3org\0\0"..., 46, MSG_NOSIGNAL) = 46
gettimeofday({1366013422, 991179}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4999)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [126])               = 0
recvfrom(3, "\257t\201\200\0\1\0\3\0\0\0\1\6forums\6gentoo\3org\0\0"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 126
gettimeofday({1366013422, 991593}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, 4999)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [110])               = 0
recvfrom(3, "+\330\201\200\0\1\0\2\0\0\0\1\6forums\6gentoo\3org\0\0"..., 1922, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 110
close(3)                                = 0
write(1, "Name:      forums.gentoo.org\n", 29) = 29
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=1079, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# /etc/hosts: Local Host Databas"..., 4096) = 1079
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
time(NULL)                              = 1366013423
stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=82, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77b2000
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0xb77b2000, 4096)                = 0
uname({sys="Linux", node="aporia", ...}) = 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({1366013423, 17287}, NULL) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
send(3, "\227\233\1\0\0\1\0\0\0\0\0\1\00212\00215\003187\003204\7in-ad"..., 55, MSG_NOSIGNAL) = 55
poll([{fd=3, events=POLLIN}], 1, 5000)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [86])                = 0
recvfrom(3, "\227\233\201\200\0\1\0\1\0\0\0\1\00212\00215\003187\003204\7in-ad"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [16]) = 86
close(3)                                = 0
write(1, "Address 1: 204.187.15.12 forums."..., 43) = 43
exit_group(0)                           = ?
+++ exited with 0 +++

Here is a strace from a busybox compiled with an Aboriginal Linux root-filesystem image.

Code:
% strace ./busybox nslookup forums.gentoo.org
execve("./busybox", ["./busybox", "nslookup", "forums.gentoo.org"], [/* 68 vars */]) = 0
brk(0)                                  = 0xa0e8000
brk(0xa0e8480)                          = 0xa0e8480
set_thread_area({entry_number:-1 -> 6, base_addr:0xa0e8010, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
getuid32()                              = 0
getpid()                                = 21502
brk(0xa0e9480)                          = 0xa0e9480
brk(0xa0ea000)                          = 0xa0ea000
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97e224) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
uname({sys="Linux", node="aporia", ...}) = 0
write(2, "nslookup: can't resolve '(null)'"..., 60) = 60
write(1, "\n", 1)                       = 1
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97ddec) = -1 ENOTTY (Inappropriate ioctl for device)
brk(0xa0eb000)                          = 0xa0eb000
read(3, "# /etc/hosts: Local Host Databas"..., 4096) = 1079
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97da3c) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
uname({sys="Linux", node="aporia", ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 28) = 0
send(3, "\0\2\1\0\0\1\0\0\0\0\0\0\6forums\6gentoo\3org\0\0"..., 35, 0) = 35
poll([{fd=3, events=POLLIN}], 1, 5000)  = 1 ([{fd=3, revents=POLLIN}])
recv(3, "\0\2\201\200\0\1\0\2\0\0\0\0\6forums\6gentoo\3org\0\0"..., 512, MSG_DONTWAIT) = 99
close(3)                                = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97da3c) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
uname({sys="Linux", node="aporia", ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 28) = 0
send(3, "\0\3\1\0\0\1\0\0\0\0\0\0\tforums-lb\6gentoo\3or"..., 38, 0) = 38
poll([{fd=3, events=POLLIN}], 1, 5000)  = 1 ([{fd=3, revents=POLLIN}])
recv(3, "\0\3\201\200\0\1\0\1\0\0\0\0\tforums-lb\6gentoo\3or"..., 512, MSG_DONTWAIT) = 78
close(3)                                = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97da3c) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
uname({sys="Linux", node="aporia", ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 28) = 0
send(3, "\0\4\1\0\0\1\0\0\0\0\0\0\31gossamer-ipvs-forum"..., 54, 0) = 54
poll([{fd=3, events=POLLIN}], 1, 5000)  = 1 ([{fd=3, revents=POLLIN}])
recv(3, "\0\4\201\200\0\1\0\0\0\0\0\0\31gossamer-ipvs-forum"..., 512, MSG_DONTWAIT) = 54
close(3)                                = 0
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97d978) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# /etc/hosts: Local Host Databas"..., 4096) = 1079
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97d5c8) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
uname({sys="Linux", node="aporia", ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 28) = 0
send(3, "\0\5\1\0\0\1\0\0\0\0\0\0\6forums\6gentoo\3org\0\0"..., 35, 0) = 35
poll([{fd=3, events=POLLIN}], 1, 5000)  = 1 ([{fd=3, revents=POLLIN}])
recv(3, "\0\5\201\200\0\1\0\3\0\0\0\0\6forums\6gentoo\3org\0\0"..., 512, MSG_DONTWAIT) = 115
close(3)                                = 0
write(1, "Name:      forums.gentoo.org\n", 29) = 29
open("/etc/hosts", O_RDONLY)            = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97dfc4) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# /etc/hosts: Local Host Databas"..., 4096) = 1079
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/etc/resolv.conf", O_RDONLY)      = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf97dc60) = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "# Generated by net-scripts for i"..., 4096) = 82
read(3, "", 4096)                       = 0
close(3)                                = 0
uname({sys="Linux", node="aporia", ...}) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 28) = 0
send(3, "\0\6\1\0\0\1\0\0\0\0\0\0\00212\00215\003187\003204\7in-ad"..., 44, 0) = 44
poll([{fd=3, events=POLLIN}], 1, 5000)  = 1 ([{fd=3, revents=POLLIN}])
recv(3, "\0\6\201\200\0\1\0\1\0\0\0\0\00212\00215\003187\003204\7in-ad"..., 512, MSG_DONTWAIT) = 75
close(3)                                = 0
write(1, "Address 1: 204.187.15.12 forums."..., 43) = 43
exit_group(0)                           = ?
+++ exited with 0 +++

Not sure if you'd get similar results with your initramfs but I would say those calls to glibc are probably the issue.

best ... khay
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 21
Location: FL, USA

PostPosted: Mon Apr 15, 2013 10:26 pm    Post subject: Reply with quote

Thank you Khay!

I copied over following libraries into my initramfs /lib64 folder:

Code:
ld-linux-x86-64.so.2
ld-linux.so.2
libc.so.6
libnss_dns.so.2
libnss_files.so.2
libresolv.so.2

That resolved my problem and I can successfully wget file using hostname.
_________________
Use GNU/Linux
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2167

PostPosted: Wed Apr 17, 2013 11:26 am    Post subject: Reply with quote

nc-pv wrote:
Thank you Khay!

nc-pv ... you're welcome ...

nc-pv wrote:
That resolved my problem and I can successfully wget file using hostname.

Actually, just so that you know, I was hinting that you might be able to build a lighter initramfs by not having glibc but by using Aboriginal Linux.

My initramfs with busybox, cryptsetup, lvm2, askpass, and a few other binaries, plus init itself and config files in /etc is 2.5mb uncompressed, so, about the size of the files from glibc you've added above.

For some idea of the method of building such a initramfs see: better-initramfs

best ... khay
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2440
Location: Germany

PostPosted: Wed Apr 17, 2013 6:01 pm    Post subject: Reply with quote

You already solved it, but anyway: http://en.gentoo-wiki.com/wiki/Initramfs#DNS

khayyam wrote:
My initramfs with busybox, cryptsetup, lvm2, askpass, and a few other binaries, plus init itself and config files in /etc is 2.5mb uncompressed, so, about the size of the files from glibc you've added above.


That's certainly impressive. Outside of embedded systems, the size of the Initramfs hardly matters though.
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 21
Location: FL, USA

PostPosted: Wed Apr 17, 2013 6:46 pm    Post subject: Reply with quote

Frostschutz,

Appreciated for the link!

I definitely have read this document before I started to work out my initramfs, but obviously I missed that part of text...


And, Khayyam, I would agree with Frostschutz on the point of initramfs size. I am not doing embedded system so I do not need to completely cut down initramfs size. But anyway thanks for link, I will reference it if I will get to setting up embedded system.
_________________
Use GNU/Linux
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2167

PostPosted: Wed Apr 17, 2013 6:59 pm    Post subject: Reply with quote

nc-pv wrote:
Khayyam, I would agree with Frostschutz on the point of initramfs size. I am not doing embedded system so I do not need to completely cut down initramfs size. But anyway thanks for link, I will reference it if I will get to setting up embedded system.

nc-pv, frostschutz ... the issue for me is that I have to build the initramfs into the kernel, I can't reuse the initramfs from the filesystem, so, it has a cumulative effect on the boot partition, I know that the kernel doesn't hold the initramfs in ram once its done its job, so it wasn't said as a method to save memory in some manner.

best ... khay
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 21
Location: FL, USA

PostPosted: Wed Apr 17, 2013 9:22 pm    Post subject: Reply with quote

Khayyam,

Quote:
the issue for me is that I have to build the initramfs into the kernel


I do it as well...

Anyways, main question was answered well by you guys. I think farther discussion is slightly outside of the subject of this topic.
_________________
Use GNU/Linux
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2440
Location: Germany

PostPosted: Thu Apr 18, 2013 12:09 pm    Post subject: Reply with quote

khayyam wrote:
the issue for me is that I have to build the initramfs into the kernel, I can't reuse the initramfs from the filesystem, so, it has a cumulative effect on the boot partition


Same here. But I don't keep 20 old kernels (only 4-5 or so) and my boot partition is 1G. With a bzImage size of 8M (for cryptsetup, mdadm, lvm, and luks-encrypted key container) there is no problem really...

It'll be a different story if you have like a 32M /boot but nobody does that anymore. If you can waste several gigabytes on swap, you can waste 1 gig on /boot and have it do something useful on the side (bootable live cd / rescue image and the like).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum