Service start crashes when the bypass table holds a default route (import-time netifaces lookup) #66

Closed
opened 2026-08-19 14:10:58 -04:00 by mysticalsoap · 0 comments
Owner

aqomui_service.py:66 reads the default gateway interface with netifaces in the class body, at import time:

interface = netifaces.gateways()['default'][netifaces.AF_INET][1]

Two independent problems stack here:

  1. Import-time: if the lookup fails for any reason, the service refuses to start at all — including right after its own teardown removed the default route.
  2. netifaces (archived upstream since 2021) mis-flags the default when a second routing table also holds a default route. With the bypass table populated (default via 192.168.0.1 dev enp5s0 table 11 — written by bypass_up.sh / bypass.py), netifaces.gateways() returns both gateway entries but an empty 'default' dict → KeyError: 2.

Which means aqomui sabotages its own restart: start service → run bypass once (table 11 populated) → any later systemctl restart aqomui crash-loops until the table-11 route is removed by hand. Observed live 2026-08-19 on the 0.9.0.r302 build; sudo ip route del default table 11 unblocks.

Fix direction: drop netifaces for this lookup — parse ip -j route show default (iproute2 is already a hard dependency) — do it lazily at the point of use, and tolerate a missing default route instead of dying.

`aqomui_service.py:66` reads the default gateway interface with netifaces **in the class body, at import time**: ```python interface = netifaces.gateways()['default'][netifaces.AF_INET][1] ``` Two independent problems stack here: 1. **Import-time**: if the lookup fails for any reason, the service refuses to start at all — including right after its own teardown removed the default route. 2. **netifaces (archived upstream since 2021) mis-flags the default when a second routing table also holds a default route.** With the bypass table populated (`default via 192.168.0.1 dev enp5s0 table 11` — written by `bypass_up.sh` / `bypass.py`), `netifaces.gateways()` returns both gateway entries but an **empty** `'default'` dict → `KeyError: 2`. Which means aqomui sabotages its own restart: start service → run bypass once (table 11 populated) → any later `systemctl restart aqomui` crash-loops until the table-11 route is removed by hand. Observed live 2026-08-19 on the 0.9.0.r302 build; `sudo ip route del default table 11` unblocks. Fix direction: drop netifaces for this lookup — parse `ip -j route show default` (iproute2 is already a hard dependency) — do it lazily at the point of use, and tolerate a missing default route instead of dying.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mysticalsoap/aqomui#66
No description provided.