Problem running preseed_networking_setup

Problem:

I am setting up a new proxmox-based host using the foreman-proxmox-plugin, ipxe and Preseed-Templates.

The generated network configuration is faulty.

After installation the interface-configuration (/etc/interfaces) should look like this:

#loopback
auto lo
iface lo inet loopback

#net0
auto ens18
allow-hotplug 
iface  ens18 inet static
    address 123.123.123.123
    gateway 123.123.123.1
    netmask 255.255.255.224
    dns-nameservers 208.67.222.222 208.67.220.220
    dns-search my.zone

but it does look like this:

#loopback
auto lo
iface lo inet loopback

#net0
auto
allow-hotplug 
iface  inet static
    address 123.123.123.123
    gateway 123.123.123.1
    netmask 255.255.255.224
    dns-nameservers 208.67.222.222 208.67.220.220
    dns-search my.zone

as you can see, the interface-identifier (ens18) is missing.

On preseed_networking_setup, the following line seems to fail:

<% host_subnet = @host.subnet -%>
<% host_dhcp = host_subnet.nil? ? true : host_subnet.dhcp_boot_mode? -%>
<% host_subnet6 = @host.subnet6 -%>
<% host_dhcp6 = host_subnet6.nil? ? true : host_subnet6.dhcp_boot_mode? -%>

real=`ip -o link | awk '/<%= @host.mac -%>/ {print $2;}' | sed s/://`
cat << EOF > /etc/network/interfaces

Seems like $real is empty during setup. But now if I run

ip -o link | awk '/86:ce:ea:52:51:42/ {print $2;}' | sed s/://

on this very host, I am getting ens18 as result. This is not the interface-name I set up during creation (net0) and I am wondering if this could be an issue with the Proxmox-plugin, which forces me to set the interface name to net[n] or a more generic error.

Foreman and Proxy versions:

  • Foreman 1.24

Distribution and version:

  • Debian 10

Wrong version in the post above. It’s 2.4 of course.

Hello,

interface identifier is actually ignored and interface is found via MAC address instead. I do not remember the reason tho, @Marek_Hulan do you?

Anyway, you need to run the ip -o link command during provisioning and capture the output to see what it prints.

Hi @lzap

huhm, it’s not that easy for me as I’m quite new to preseeding Debian :wink:

I managed to enter a shell and mentioned two things:

The interface’s name is ens18 and that command is really difficult to type on noVNC with a German-layouted keyboard and an English-layouted input :smiley:

Bildschirmfoto 2021-04-13 um 15.26.31

This is the result for my current attempt.

Okay, this is also a trap: The interface’s name has to be net[n], because if it’s not, I can not modify that host, as the proxmox-plugin keeps complaining:

Must be net[n] with n integer >= 0

So I am wondering why the interface-name is ens18 in the installer and not net0 as I set in the interface-configuration.

Well, I am from Red Hat and I am not particularly good in writing preseed files as well. :slight_smile:

Have you seen Czech layout yet? :slight_smile:

This is a question for Proxmox, Debian engineers or Linux kernel drivers. Anaconda in Red Hat uses Dracut which uses systemd (by default) which applies the predictable naming scheme. If there is some mechanism in Proxmox Linux drivers there must be something wrong.

Can you try to avoid awk. Use sed or something what is available.

That’s too bad. But maybe there’s somebody out here who did solve this using preseed…?

Haha, no :smiley: No party to type on a VNC console with EN_US-Layout, too, hm? :wink:

Hm, I opened an issue on the plugin’s GitHub repo. Seems like the net naming-schema comes from fog_proxmox. But on VMs I created manually the interfaces are named ens18, too - even if Proxmox calls the ethernet-card itself net0 in the hardware-overview. So it seems to be some kind of convention in fog_proxmox.

Thank you for your help and maybe there’s someone out there who faced the same problems.

Cheers,

Roman

Absolutely.

But from what I understand, isn’t the problem more in fact that awk is missing for some reason rather than from interface name? Because that is exactly for the shell line you refer to is - to actually ignore interfafe name and find the real identifier via MAC addres.

Hi @lzap

Alright, seems like I was able to solve the first problem:

Replacing

real=`ip -o link | awk '/<%= @host.mac -%>/ {print $2;}' | sed s/://`

with

real=`ip -o link | grep -i '<%= @host.mac -%>' | cut -d' ' -f2 | sed s/://`

returns the correct interface name now and /etc/network/interfaces looks fine now. The problem regarding the interface-name remains, but I’ll open a new topic for that.

Thanks for your help :slight_smile:

2 Likes

Thanks for getting back to us, would you mind opening a PR against:

To be on the safest side, you can write something like "if awk is available, then do awk, otherwise do grep/cut. I am not really sure why is that you don’t have awk. So let’s not break this for others but fix the problem.