Package: ifupdown
Version: 0.8.36
Severity: important
X-Debbugs-Cc: syso...@yandex.ru

Hello!

(Not sure why such rather important issue is not filled yet, but anyway. Sorry 
if I'm creating duplicate.)

My network is down after running `systemctl restart networking` on fresh 
installed Debian 11.5 (but the same issue is on Debian 10). There is no way to 
start it with `systemctl start networking`. Not sure if this relevant but I'm 
using static IPv4 config, no DHCP. The installation is very minimal without any 
systemd-networkd or NetworkManager stuff.

The reason for this is that systemd unit file networking.service using `ifdown 
-a` to stop network and then `ifup -a` to start it. According to the manual, 
the first command unconditionally deconfigure _all_ interfaces defined in 
/etc/network/interfaces, but the second one configure only interfaces which is 
defined as "auto" in the configuraton and not as "allow-hotplug".

During the installation all interfaces (fixed PCI NICs too, because udev events 
generated for PCI devices too [1]) in /etc/network/interfaces is created with 
"allow-hotplug", so restarting networking with systemd leads to non-functional 
network.

When using old-school `/etc/init.d/networking restart` (don't forget to set 
SYSTEMCTL_SKIP_REDIRECT=1) the issue is not present. This is because of special 
treatment for "allow-hotplug" interfaces in /etc/init.d/networking. See 
ifup_hotplug () function. The functionality is lacking in systemd unit file.

Forgot to mention that the network starting normally during the system startup. 
This is because of ifup@.service template unit which is started from udev rule 
via /lib/udev/ifupdown-hotplug script which runs unit for specific interface. 
This leads to running `ifup eth0`. When you run ifup this way, there is no need 
to define interface as "auto".

Yes, everything can be fixed using "auto" instead of "allow-hotplug", but 
"allow-hotplug" is set by Debian Installer [2]. This leads to the issue just 
"by default".

Should we sync systemd unit file behaviour with old SysV script by implementing 
something like ifup_hotplug() logic in unit file? Network must not be broken 
after silly systemctl restart.

[1] 
https://salsa.debian.org/installer-team/hw-detect/-/blob/master/net-hotplug.sh
[2] 
https://salsa.debian.org/installer-team/netcfg/-/blob/master/write_interface.c


-- Package-specific info:
--- /etc/network/interfaces:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*

allow-hotplug eth0
iface eth0 inet static
    address 172.17.0.3
    netmask 255.255.0.0
    gateway 172.17.0.1

--- /etc/network/interfaces.d/*:
cat: '/etc/network/interfaces.d/*': No such file or directory

--- up and down scripts installed:
/etc/network/if-down.d:
total 0

/etc/network/if-post-down.d:
total 0

/etc/network/if-pre-up.d:
total 0

/etc/network/if-up.d:
total 0


-- System Information:
Debian Release: 11.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.12.2 (SMP w/1 CPU thread)
Kernel taint flags: TAINT_FORCED_MODULE, TAINT_WARN, TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ifupdown depends on:
ii  adduser   3.118
ii  iproute2  5.10.0-4
ii  libc6     2.31-13+deb11u5
ii  lsb-base  11.1.0

Versions of packages ifupdown recommends:
ii  isc-dhcp-client [dhcp-client]  4.4.1-2.3+deb11u1

Versions of packages ifupdown suggests:
pn  ppp     <none>
pn  rdnssd  <none>

-- no debconf information

Reply via email to