Comment 11 for bug 1770082

Revision history for this message
Ryan Harper (raharper) wrote : Re: [Bug 1770082] Re: systemd-networkd not renaming devices on boot

root@rharper-b1:~# vi /etc/netplan/50-cloud-init.yaml
# changed the set-name: to eth_lan
root@rharper-b1:~# netplan generate
root@rharper-b1:~# cp /run/systemd/network/10-netplan-ens3.link
/etc/systemd/network/

# just the default link file in the initramfs
root@rharper-b1:~# lsinitramfs /boot/initrd.img-4.15.0-20-generic | grep \.link
lib/systemd/network/99-default.link
lib/modules/4.15.0-20-generic/kernel/net/core/devlink.ko
lib/udev/rules.d/80-net-setup-link.rules
bin/readlink

root@rharper-b1:~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.15.0-20-generic

# now we see the local .link file from /etc copied in.
root@rharper-b1:~# lsinitramfs /boot/initrd.img-4.15.0-20-generic | grep \.link
lib/modules/4.15.0-20-generic/kernel/net/core/devlink.ko
lib/systemd/network/99-default.link
lib/systemd/network/10-netplan-ens3.link
lib/udev/rules.d/80-net-setup-link.rules
bin/readlink

On Fri, May 11, 2018 at 9:35 AM, Ryan Harper <email address hidden> wrote:
> I'm just verifying that on my end; note that the 99-default.link is
> going to be sufficient to trigger a rename from eth0 to ens3; which
> then prevents any rename once we mount root.
>
> Here's the trigger:
>
> % /usr/share/initramfs-tools/hooks/udev
> # copy .link files containing interface naming definitions
> mkdir -p $DESTDIR/lib/systemd/network/
> find /lib/systemd/network -name '*.link' -execdir cp -pt
> $DESTDIR/lib/systemd/network/ '{}' +
> if [ -d /etc/systemd/network ]; then
> find /etc/systemd/network -name '*.link' -execdir cp -pt
> $DESTDIR/lib/systemd/network/ '{}' +
> fi
>
> If you create a .link file in /etc/systemd/network/ lower than 99-*
> then those link rules will apply first.
>
>
> On Fri, May 11, 2018 at 9:24 AM, Daniel Axtens
> <email address hidden> wrote:
>> Ok, so the bit I'm stuck on is how the link files and the netplan
>> generator are getting pulled into the initramfs then.
>>
>> ubuntu@btest:~$ sudo update-initramfs -u
>> update-initramfs: Generating /boot/initrd.img-4.15.0-20-generic
>>
>> ubuntu@btest:~$ lsinitramfs /boot/initrd.img-4.15.0-20-generic | grep \\.link
>> lib/systemd/network/99-default.link
>> ubuntu@btest:~$ lsinitramfs /boot/initrd.img-4.15.0-20-generic | grep netplan
>> ubuntu@btest:~$ lsinitramfs /boot/initrd.img-4.15.0-20-generic | grep generate
>> ubuntu@btest:~$ lsinitramfs /boot/initrd.img-4.15.0-20-generic | grep system-generators
>>
>> As you can see there's no generator and no link files in my initramfs -
>> by what mechanism is it supposed to work? What package/script/tool is
>> supposed to pull the link files in?
>>
>> --
>> You received this bug notification because you are subscribed to
>> netplan.
>> Matching subscriptions: netplan
>> https://bugs.launchpad.net/bugs/1770082
>>
>> Title:
>> systemd-networkd not renaming devices on boot
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/netplan/+bug/1770082/+subscriptions