public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH ifupdown2] debian: postinst: ensure /etc/iproute2/rt_tables.d exists
Date: Tue,  8 Jul 2025 18:43:44 +0200	[thread overview]
Message-ID: <20250708164344.104855-1-f.weber@proxmox.com> (raw)

When upgrading to Debian Trixie, iproute2 is also upgraded. Its
postinst deletes /etc/iproute2/rt_tables.d if it is currently empty
(or only contains a README file) [1]. After that, ifreload -a will
always print a warning:

> error: [Errno 2] No such file or directory: '/etc/iproute2/rt_tables.d/ifupdown2_vrf_map.conf'

because it cannot create the file if the parent directory does not
exist.

To avoid that, create the directory in ifupdown2's postinst if it
does not exist yet.

Commit b115f7f ("add /etc/iproute2/rt_tables.d/ to managed
directories") already added the directory to ifupdown2.dirs, but this
does not seem to be effective, due to the following sequence of events
on upgrade:

1) iproute2 is unpacked
2) ifupdown2 is unpacked. The directory still exists, so the
   ifupdown2.dirs entry does not have an effect
3) ifroute2 is set up, and its postinst empties and removes the
   directory
4) ifupdown2 is set up

[1] https://sources.debian.org/src/iproute2/6.15.0-1/debian/iproute2.postinst/

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---

Notes:
    Please check the reasoning for plausibility, my understanding of dpkg
    is very basic, this is just what I could infer from running strace on
    the upgrade.
    
    An alternative solution would be to patch ifupdown2 itself to create
    the directory (if needed) before trying to write to the
    ifupdown2_vrf_map.conf file.

 debian/ifupdown2.postinst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/debian/ifupdown2.postinst b/debian/ifupdown2.postinst
index f9a719c..13cc987 100644
--- a/debian/ifupdown2.postinst
+++ b/debian/ifupdown2.postinst
@@ -111,6 +111,9 @@ case "$1" in
         process_udev
         chmod +x /usr/share/ifupdown2/__main__.py
         postinst_remove_diverts
+        if [ ! -d /etc/iproute2/rt_tables.d ]; then
+            mkdir /etc/iproute2/rt_tables.d || echo "could not create /etc/iproute2/rt_tables.d"
+        fi
         if [ -z "$2" ] && [ ! -e /proxmox_install_mode ]; then
             proxmox_compatibility
             echo "Reloading network config on first install"
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-07-08 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08 16:43 Friedrich Weber [this message]
2025-07-08 17:01 ` Thomas Lamprecht
2025-07-09  6:40   ` Friedrich Weber
2025-07-09  8:01     ` [pve-devel] applied: " Thomas Lamprecht
2025-07-08 17:32 ` [pve-devel] " Michael Köppl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250708164344.104855-1-f.weber@proxmox.com \
    --to=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal