[SOLVED] ifupdown2 and /etc/network/interfaces issue

RobFantini

Famous Member
May 24, 2012
2,080
116
133
Boston,Mass
I upgraded a KVM running Debian bookworm to trixie. pve runs v8

after upgrade and reboot the network was down.

tried to bring up network:
Code:
  ifup ens19
  main exception 'RawConfigParser' object has no attribute 'readfp'

my interfaces file is below.

the solution from grok ai:
Code:
Edit /usr/share/ifupdown2/ifupdown/main.py
Find the line containing parser.readfp(configFP) (around line 300-400, depending on the exact version).
Replace it with parser.read_file(configFP).

after that interfaces could come up

interfaces file:
Code:
# The loopback network interface
#auto lo
#iface lo inet loopback


auto ens18
iface ens18 inet static
        address 127.0.0.1
        netmask 255.255.255.0


auto ens19
iface ens19 inet static
        address 10.1.7.90/24
        gateway 10.1.7.1


we need ens18 for software license .


more from grok:

The issue you're encountering is due to an incompatibility between the ifupdown2 package (which handles network interface management, commonly used in environments like Proxmox VE) and Python 3.12, the default Python version in Debian Trixie. Specifically, the readfp method in Python's configparser module was deprecated and fully removed in Python 3.12, causing the error when ifupdown2 tries to parse configuration files.
This was a known bug in ifupdown2 versions prior to 3.0.0-1.3 (Debian bug #1074250).

The bug has been fixed in version 3.0.0-1.3, which is the current version available in Trixie.
 
Last edited:
I upgraded a KVM running Debian bookworm to trixie. pve runs v8

after upgrade and reboot the network was down.
You cannot run Promox VE 8 while also running on Debian Trixie on the host, because there are many API breakages inbetween. The error is caused because Debian Trixie already ships a recent version of Python3, where API was changed which affects ifupdown2 here.

You need to also fully upgrade to Proxmox VE 9 as we package ifupdown2 in our own repositories, where this API change is already fixed.
 
You cannot run Promox VE 8 while also running on Debian Trixie on the host, because there are many API breakages inbetween. The error is caused because Debian Trixie already ships a recent version of Python3, where API was changed which affects ifupdown2 here.

You need to also fully upgrade to Proxmox VE 9 as we package ifupdown2 in our own repositories, where this API change is already fixed.


maybe i did not explain this:

pve runs v8 .

KVM runs trixie

I did not put trixie on v8 pve
 
I did not put trixie on v8 pve
Are you sure? Or did I misunderstood that those errors are from within the VM?

Especially with the error message above, I cannot see any reason that the host would fail with that error message if there wasn't any API breakage introduced by at least an upgrade of the python package.
 
another kvm running trixie did not need the fix.
Code:
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug ens18
#iface ens18 inet dhcp

auto ens18
iface ens18 inet static
        address 10.1.3.5/24
        gateway 10.1.3.1

I think the 'auto lo' section commented in the problem kvm may have something to do with the issue. when I installed ifupdown2 on one of the systems needing the fix [ 2 of 9 did not have ifupdown2 ] this warning showed during install:

ifupdown2.postinst: Warning: No 'iface lo' definition found in /etc/network/interfaces
ifupdown2.postinst: Warning: No 'auto lo' statement found in /etc/network/interfaces
 
I had one more system which had an ifupdown2 issue after upgrade to Trixie. All 5 systems with ifupdown2 bug were solved with removing comments from /etc/network/interfaces . specifically the comment lines had a interface name within the comment line. These insterface files with those comment lines had no issue with ifupdown2 3.0 [ bookworm]

here is the non working interfaces file:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug ens18
#iface ens18 inet dhcp

auto ens18
iface ens18 inet static
        address 10.1.3.90/24
        gateway 10.1.3.1

this works .
Code:
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto ens18
iface ens18 inet static
        address 10.1.3.90/24
        gateway 10.1.3.1


the kvm is using Debian Trixie , ifupdown2 Version: 3.1.0-1+pmx4