Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore dpkg files when running hook scripts #304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lawli3t
Copy link

@lawli3t lawli3t commented Jun 27, 2024

Currently ifupdown2 executes scripts that are backed up by dpkg (e.g. foo.dpkg-old). This can lead to issues with hook scripts getting executed after upgrading ifupdown2 via dpkg, even though they should not be executed.

This also brings ifupdown2 closer on par with the behavior of ifupdown, which did not execute hook scripts with dpkg suffixes.


We had the following issue occur a few times:

  • Suppose there is a legacy Debian host with ifupdown and ifenslave installed that has a bond configured in /etc/network/interfaces.
  • ifenslave installs a script /etc/network/if-pre-up.d/ifenslave.
  • Now, an upgrade creates a second script /etc/network/if-pre-up.d/ifenslave.dpkg-new. As ifupdown executes network scripts via run-parts which ignores scripts with . in their name, ifenslave.dpkg-new has no effect.
  • If the host switches over to ifupdown2 by installing it (removing ifupdown, keeping ifenslave) and reboots, the network will not come up:
    • /etc/network/if-pre-up.d/ifenslave still exists, but is ignored by ifupdown2's bond addon [1]
    • /etc/network/if-pre-up.d/ifenslave.dpkg-new is executed by ifupdown2 because it executes all scripts in /etc/network/if-pre-up.d, even if their name contains a dot

This leads to broken network configuration on upgrades, where users did have no network.

[1]

overrides_ifupdown_scripts = ['ifenslave', ]

Currently ifupdown2 executes scripts that are backed up by dpkg (e.g.
foo.dpkg-old). This can lead to issues with hook scripts getting
executed after upgrading ifupdown2 via dpkg, even though they should
not be executed.

This also brings ifupdown2 closer on par with the behavior of
ifupdown, which did not execute hook scripts with dpkg suffixes.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
@csmart
Copy link

csmart commented Jul 8, 2024

Oh, nice catch. Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants