Message info
 
To:Arch Linux Release Engineering From:Christian Hesse Subject:Re: [arch-releng] [archiso] keep name resolver settings Date:Thu, 19 Apr 2012 23:08:39 +0200
 

Ionut Biru <ibiru@archlinux.org> on Thu, 2012/04/19 23:56:
> On 04/19/2012 10:50 PM, Christian Hesse wrote:
> > Hello everybody,
> >
> > I am not shure if this is the correct place to report or if there is any
> > better one... If so - please let me know.
> >
> > Ok, the initrd hooks from archiso support PXE booting. In this case the
> > initrd is responsible for setting up the network. All these setting are
> > persistent, so are still valid after changing to the real system. With one
> > exception: name resolver settings (namely file /etc/resolv.conf) are lost,
> > which ends up in a system with network connectivity that can not resolve a
> > single host.
> >
> > Even worse: When launching a dhcp client you may get a new address and
> > end up with something completely useless as nbd connection is lost.
> >
> > I would like to write the final /etc/resolv.conf from within initrd. For
> > me this completely solves the problem. Patch is attached.
>
> Please send the patch inline since our mailing list filters regular
> attachments.
>

Sorry, did not know that.

Here we go:

--- archiso/archiso/hooks/archiso 2012-04-19 18:39:24.381454201 +0200
+++ archiso/archiso/hooks/archiso 2012-04-19 18:40:58.095839569 +0200
@@ -193,6 +193,13 @@ archiso_mount_handler() {
if [[ "${copytoram}" == "y" ]]; then
umount /run/archiso/bootmnt
fi
+
+ if [[ -s "/etc/resolv.conf" ]]; then
+ echo "# These settings have been generated within initrd and moved" \
+ > /etc/resolv.conf
+ echo "# to main system by hook archiso." >> /etc/resolv.conf
+ cat "/etc/resolv.conf" >> "${newroot}/etc/resolv.conf"
+ fi
}

# vim:ft=sh:ts=4:sw=4:et:

--
Best regards,
Chris
O< ascii ribbon campaign
stop html mail - www.asciiribbon.org