[arch-releng] [RFC][PATCH] [configs/releng] Use systemd-networkd instead of dhcpcd

Tom Gundersen teg at jklm.no
Wed Feb 26 04:57:14 EST 2014


On Wed, Feb 26, 2014 at 3:04 AM, Gerardo Exequiel Pozzi
<vmlinuz386 at yahoo.com.ar> wrote:
> On 02/25/2014 10:10 PM, Tom Gundersen wrote:
>> On Wed, Feb 26, 2014 at 1:43 AM, Gerardo Exequiel Pozzi
>> <vmlinuz386 at yahoo.com.ar> wrote:
>>> Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
>>> ---
>>>  .../releng/root-image/etc/systemd/network/dhcp-on-ethernet.network   | 5 +++++
>>>  configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules           | 1 -
>>>  configs/releng/root-image/root/customize_root_image.sh               | 2 +-
>>>  3 files changed, 6 insertions(+), 2 deletions(-)
>>>  create mode 100644 configs/releng/root-image/etc/systemd/network/dhcp-on-ethernet.network
>>>  delete mode 100644 configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules
>>>
>>> diff --git a/configs/releng/root-image/etc/systemd/network/dhcp-on-ethernet.network b/configs/releng/root-image/etc/systemd/network/dhcp-on-ethernet.network
>>> new file mode 100644
>>> index 0000000..aec1849
>>> --- /dev/null
>>> +++ b/configs/releng/root-image/etc/systemd/network/dhcp-on-ethernet.network
>>> @@ -0,0 +1,5 @@
>>> +[Match]
>>> +Name=en*
>>> +
>>> +[Network]
>>> +DHCP=yes
>>> diff --git a/configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules b/configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules
>>> deleted file mode 100644
>>> index 1c4053c..0000000
>>> --- a/configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules
>>> +++ /dev/null
>>> @@ -1 +0,0 @@
>>> -ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="en*|eth*", ENV{SYSTEMD_WANTS}="dhcpcd@$name.service"
>>> diff --git a/configs/releng/root-image/root/customize_root_image.sh b/configs/releng/root-image/root/customize_root_image.sh
>>> index 9c85453..3e01e2d 100755
>>> --- a/configs/releng/root-image/root/customize_root_image.sh
>>> +++ b/configs/releng/root-image/root/customize_root_image.sh
>>> @@ -18,5 +18,5 @@ chmod 440 /etc/sudoers.d/g_wheel
>>>  sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist
>>>  sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf
>>>
>>> -systemctl enable pacman-init.service choose-mirror.service
>>> +systemctl enable pacman-init.service choose-mirror.service systemd-networkd.service
>>>  systemctl set-default multi-user.target
>>
>>
>> Please also symlink /etc/resolv.conf to
>> /run/systemd/network/resolv.conf (I need to document that better,
>> sorry about that). Otherwise, (surprisingly ;-) ) +1 from me.
>>
>> Cheers,
>>
>> Tom
>>
>
> Oki doki! Thanks for your great work!

Thanks for integrating it this quickly!

> The issue here is when booting via PXE... The initcpio hook, writes on
> (append) etc/resolv.conf. Now, I think that I need to hack, and write to
> /run/systemd/network/resolv.conf instead.

Hm, are you sure you can't just keep it at /etc/resolv.conf? The hook
should should follow the symlink just fine :)

> * Under PXE scenario: systemd-networkd will not be used because
> interface rename will fail (already UP from initramfs as eth) then
> /run/systemd/network/resolv.conf is untouched from systemd-network.
>
> * Under non-PXE scenario: /run/systemd/network/resolv.conf will be
> touched only by systemd-network.

This sounds ok... or is there an issue here I'm not seeing?

> Also I think that can be a good idea for PXE scenario if-down-eth0, on
> initramfs as last step, then in this case, rename does work and dhcpcd
> is requested again but from systemd-networkd on real-root-fs.

If the network connection is no longer used at that stage, it may make sense.

-t


More information about the arch-releng mailing list