You are not logged in.

#1 2016-11-23 17:23:11

Curly060
Member
Registered: 2015-03-05
Posts: 14

[SOLVED] DNS resolution in initramfs

Hi,

I am trying to make DNS resolution in initramfs work.
I have added the net hook and curl and dig (via add_binary) to initramfs and ip=dhcp to the kernel command line. This is working perfectly: I get an IP, domain and DNS server. I can also ping the DNS server by its IP address.

However, running "curl https://www.google.de" bails out with error "could not resolve host". dig complains about some missing file (lib_dso or something).

So, network is up and running, DNS resolution is not. I have not been able to find any documentation regarding this.

Does anyone have a suggestion what else is needed to make DNS resolution work in initramfs?

Cheers, Ingo =;->

Last edited by Curly060 (2016-12-07 21:55:34)

Offline

#2 2016-12-07 21:54:32

Curly060
Member
Registered: 2015-03-05
Posts: 14

Re: [SOLVED] DNS resolution in initramfs

Well, thanks to the Gentoo Wiki I found the solution:

Install hook:

add_file "/usr/lib/libnss_dns.so.2" "/usr/lib/libnss_dns.so.2" "$(stat -Lc %a /usr/lib/libnss_dns.so.2)"
add_file "/usr/lib/libnss_files.so.2" "/usr/lib/libnss_files.so.2" "$(stat -Lc %a /usr/lib/libnss_files.so.2)"

Hook:
Make sure to generate a valid /etc/resolv.conf from /tmp/net-*.conf

Maybe the net hook could be extended to support DNS resolution?

Offline

#3 2022-01-10 05:02:41

asg1448
Member
Registered: 2014-04-12
Posts: 74

Re: [SOLVED] DNS resolution in initramfs

I love you @Curly060

In my case it was raspbian, and my hook line was:

copy_exec /usr/lib/arm-linux-gnueabihf/libnss_dns.so.2

I was going insane trying to understand why nslookup works, but not anything else like ping

Offline

#4 2022-01-10 07:29:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,431

Re: [SOLVED] DNS resolution in initramfs

Glad to hear, however please don't necro 5 year old threads.

Closing.

Offline

Board footer

Powered by FluxBB