OS: Ubuntu 24.04

I have searched this for a while and seems i can’t get my search terms right.

Back when ifuo/down system worked custom scripts were put under ‘/etc/network/if-up.d’ etc. Now ubuntu uses netplan. But where to put custom script? That would handle tc rules in my case. /etc/networkd-dispatcher/routable.d was told by internet but that just trows error during boot; ERROR:Unknown state for interface.

  • Juntti@sopuli.xyzOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 day ago

    ‘journalctl -u networkd-dispatcher’ says:

    systemd[1]: Starting networkd-dispatcher.service - Dispatcher daemon for systemd-networkd...
    networkctl[2463]: systemd-networkd is not running, output might be incomplete.`
    systemd[1]: networkd-dispatcher.service: Got notification message from PID 2463, but reception only permitted for main PID 2242
    networkd-dispatcher[2242]: ERROR:Unknown state for interface NetworkctlListState(idx=1, name='lo', type='loopback', operational='-', administrative='unmanaged'): -
    networkd-dispatcher[2242]: Traceback (most recent call last):
    networkd-dispatcher[2242]:   File "/usr/bin/networkd-dispatcher", line 299, in trigger_all
    networkd-dispatcher[2242]:     self.handle_state(iface_name,
    networkd-dispatcher[2242]:   File "/usr/bin/networkd-dispatcher", line 349, in handle_state
    networkd-dispatcher[2242]:     raise UnknownState(operational_state)
    networkd-dispatcher[2242]: UnknownState: -
    networkd-dispatcher[2242]: ERROR:Unknown state for interface NetworkctlListState(idx=2, name='enp3s0', type='ether', operational='-', administrative='unmanaged'): -
    networkd-dispatcher[2242]: Traceback (most recent call last):
    networkd-dispatcher[2242]:   File "/usr/bin/networkd-dispatcher", line 299, in trigger_all
    networkd-dispatcher[2242]:     self.handle_state(iface_name,
    networkd-dispatcher[2242]:   File "/usr/bin/networkd-dispatcher", line 349, in handle_state
    networkd-dispatcher[2242]:     raise UnknownState(operational_state)
    networkd-dispatcher[2242]: UnknownState: -
    networkd-dispatcher[2242]: ERROR:Unknown state for interface NetworkctlListState(idx=3, name='wlp0s20f3', type='wlan', operational='-', administrative='unmanaged'): -
    networkd-dispatcher[2242]: Traceback (most recent call last):
    networkd-dispatcher[2242]:   File "/usr/bin/networkd-dispatcher", line 299, in trigger_all
    networkd-dispatcher[2242]:     self.handle_state(iface_name,
    networkd-dispatcher[2242]:   File "/usr/bin/networkd-dispatcher", line 349, in handle_state
    networkd-dispatcher[2242]:     raise UnknownState(operational_state)
    networkd-dispatcher[2242]: UnknownState: -
    

    That error comes either I have my script there or not.

    I think scripts in ‘/etc/networkd-dispatcher/routable.d’ or ‘/usr/lib/networkd-dispatcher/routable.d’ are not ran because networkd-dispatched do not get interface state.

    Based on https://netplan.io/faq > ‘Use pre-up, post-up, etc. hook scripts’; routable.d is correct location in my case.