#1349 PR merged: Include systemd/network to preserve Predictable Network Interface Names

Labels: enhancement, fixed / solved / done

schabrolles opened issue at 2017-05-08 08:50:

Some modern distros (like ubuntu16.04) use systemd to control inet naming.
Those information are stored in /lib/systemd/network or /usr/lib/systemd/network.

For example, my system in Ubuntu16.04 uses Predictable interface name by default : enp0s1
I'm not a big fan of Predictable interface name, but it seems to become the new standard (Fedora 25 / Ubuntu 16.04, CoreOS...)

When I boot to the rescue image, the interface is renamed eth0 => with NO IP because of name chaged.

I think we should add /lib/systemd/network or /usr/lib/systemd/network to the rescue image as we want to "replicate" network configuration from the original machine when booting on the rescue image.
If the user doesn't like the "Predictable naming", it could add net.ifnames=0 or change the configuration file /lib/systemd/network/99-default.link (which will be saved in the rescue image)

jsmeix commented at 2017-05-08 09:15:

@schabrolles
is plain adding /lib/systemd/network or /usr/lib/systemd/network
to the rescue image sufficient to make the recovey system somehow
"automagically just work" also in case of predictable interface names
or are there more adaptions and enhancements needed
e.g. in rescue/GNU/Linux/310_network_devices.sh
to make predictable interface names "just work"
in the ReaR recovery system?

jsmeix commented at 2017-05-08 09:20:

@gdha
could you also have a look here because it seems
prep/GNU/Linux/280_include_systemd.sh
is mainly your file (according to "git log -p --follow ...").

schabrolles commented at 2017-05-08 09:54:

@jsmeix Some changes will be required in rescue/GNU/Linux/310_network_devices.sh during a migration.

  • booting rescue on the original system will work without any changes (Predictable Names comes from PCI topology (bus/port etc...))
  • booting rescue on a different system (migration) will not work because inet name should have changed (except if PCI topology is the same)...

=> There is still some work for migration.... I notice that "modern" distros doesn't seems to use udev/*persistent* anymore but use systemd network instead ... (like CoreOS: https://coreos.com/blog/intro-to-systemd-networkd.html). I don't know if it is "stable" and if all the next linux major release will embrace this when they will be all migrated to systemd, but we should start to have a look.

gdha commented at 2017-05-08 10:02:

@jsmeix Do not merge it yet until Sebastien has finished his code (and tested from his side)

jsmeix commented at 2017-05-08 10:03:

@schabrolles
but for recovery on "same" hardware (i.e. for "non-migration")
plain adding /lib/systemd/network or /usr/lib/systemd/network
to the rescue image is sufficient to make networking in the
recovey system also work for predictable interface names?

schabrolles commented at 2017-05-08 10:20:

@jsmeix for recovery on "same" hardware (i.e. for "non-migration") it works well...
Interface is created enp0s1 and IP is setup by OS during boot (/etc/network/interfaces for ubuntu).

Tested on Ubuntu 16.04

jsmeix commented at 2017-05-08 10:28:

@gdha
from my point of view
https://github.com/rear/rear/pull/1349#issuecomment-299829602
is sufficient to merge this one.

I hope there cannot be regressions when there are some more
systemd related files in the rescue image that make some more
systemd magic "just work" in the recovery system.
On the other hand:
Any more "systemd magic" might result anything ;-)

gdha commented at 2017-08-26 08:27:

See also issue #1400 - I will be using Ubuntu 16.04 next week in my automated testing rounds


[Export of Github issue for rear/rear.]