<div dir="ltr"><div dir="ltr">Ok; replying to myself. I found the solution.<div><br></div><div>I just created a script for my BIONIC64 class (using the debian script) :</div><div><br></div><div>```</div><div><div>#! /bin/bash</div><div><br></div><div>iface=`ip -o -f inet addr show |awk '$2 !~ "lo|docker" {print $2;exit;}'`</div><div>mac=`ip -o -f link addr |awk -v iface=$iface '{ if ( $2 == iface":" ) {print;} }' |cut -d"/" -f2|awk '{print $2}'`</div><div>fields="ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH"</div><div>for field in $fields; do</div><div> name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E: $field=(.+)/\1/p")</div><div> if [[ $name ]]; then</div><div> newnicname=$name</div><div><span style="white-space:pre"> </span>break</div><div> fi</div><div>done</div><div><br></div><div><br></div><div>fcopy /etc/netplan/01-netcfg.yaml</div><div>fcopy /etc/cron.d/dhclient</div><div><br></div><div>sed -ri "s|inet_to_replace|$newnicname|" $target/etc/netplan/01-netcfg.yaml</div><div>sed -ri "s|inet_to_replace|$newnicname|" $target/etc/cron.d/dhclient</div><div>sed -ri "s|inet_to_replace|$newnicname|" $target/etc/network/interfaces</div><div>sed -ri "s|mac_to_replace|$mac|" $target/etc/netplan/01-netcfg.yaml</div></div><div>```</div><div><br></div><div>With `{mac,inet}_to_replace` in those files (which is replaced with my sed).</div><div><br></div><div>Best regards,</div><div>Rémy.</div></div></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 22 nov. 2018 à 09:54, Rémy Dernat <<a href="mailto:remy.d1@gmail.com">remy.d1@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I am facing the same issue. However, I would like to adopt the new naming style, and so, retrieving the interface name dynamically.</div><div><br></div><div>The Debian script previously cited seems to do the job at the FAI nfsroot step, during installation. However, when it reboots, it looses the ability to get this new name.</div><div><br></div><div>What I did :</div><div> - copying this debian script ( <a href="https://github.com/faiproject/fai-config/blob/master/scripts/DEBIAN/30-interface" target="_blank">https://github.com/faiproject/fai-config/blob/master/scripts/DEBIAN/30-interface</a> ) into a BIONIC64 (ubuntu 18.04) class (script/BIONIC64/),</div><div> - In the files/ subdirectory in fai-config directory, I created 2 files :</div><div> - etc/cron.d/dhclient/BIONIC64 (to launch dhclient at reboot),</div><div> - etc/netplan/01-netcfg.yaml/BIONIC64.</div><div><br></div><div>I tried to put $NIC1 in those files thinking it would be replaced by the right interface name, but it is not.</div><div><br></div><div>So, I think that FAI variable cannot be used in the files/ subdirectory because it is not avalaible anymore at this step (after the install).</div><div><br></div><div>$NIC1 is used in this script <a href="https://github.com/faiproject/fai/blob/master/lib/get-boot-info" target="_blank">https://github.com/faiproject/fai/blob/master/lib/get-boot-info</a></div><div><br></div><div>Any idea on how to achieve this according to the new naming convention ?</div><div><br></div><div>Kind regards,</div><div>Rémy.</div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Le lun. 15 oct. 2018 à 09:37, Steffen Grunewald <<a href="mailto:steffen.grunewald@aei.mpg.de" target="_blank">steffen.grunewald@aei.mpg.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
thanks for the responses which may turn out to be helpful in some way (if it's<br>
already too late to get hold of the old-style if names) - during a half-hearted<br>
test, the grub cmdline trick did not work for me.<br>
<br>
What still makes me curious is<br>
<br>
> > What I still haven't found is which magic FAI uses to avoid the renaming<br>
> > to "predictable network interface names" (a term that's completely misleading<br>
> > to me as I'm unable to predict the network names if I'm given a brand-new<br>
> > machine). Thomas, can you shed some light on this?<br>
<br>
If I run FAI sysinfo, I see eth0, ..., wlan0, etc., and dmesg.log doesn't<br>
contain any "renamed to" strings, so this renaming must have been avoided<br>
somehow, and it's the "how" I am still looking for. (I.e., was makes the <br>
NFSROOT special in this respect as it uses the default kernel?)<br>
<br>
> > My plan is to read the (old-style) interface names assigned by FAI, then<br>
> > create a $target/etc/udev/rules.d/70-persistent-net.rules file from that<br>
> > information. Is there a hidden trap? When is it best to write that file?<br>
<br>
As long as the un-renamed if names are available witin FAI, it's simple to<br>
create that rules file. The devil may be in the detail when it's required<br>
to exist (I suspect there's some initrd magic?)...<br>
<br>
Thanks again,<br>
Steffen<br>
</blockquote></div>
</blockquote></div>