Summary
load_kernel_module() in python/vyos/vpp/control_host.py is supposed to
skip calling modprobe when the module is already loaded, but the check
never matches for hyphenated module names (e.g. vfio-pci), so it always
falls through to modprobe even when the module is demonstrably already
loaded.
Details
def load_kernel_module(module_name: str) -> None: # check if a module already loaded if Path(f'/sys/module/{module_name}').exists(): return run(['/usr/sbin/modprobe', '-q', module_name], check=True)
This checks /sys/module/{module_name} using the driver name verbatim
(vfio-pci, with a hyphen). Linux sysfs module directories always use
underscores regardless of the module's canonical/modprobe name —
vfio-pci shows up as /sys/module/vfio_pci. So this check never matches
for any hyphenated module name.
This surfaced as a hard failure in a container environment where modprobe
execution itself is blocked, even though the module was already loaded
there via another mechanism:
PermissionError: [Errno 1] Operation not permitted: '/usr/sbin/modprobe'
but it's a real bug independent of that environment — it causes an
unnecessary modprobe call every single time override_driver() is used
with a hyphenated driver name, anywhere.
Environment
- VyOS rolling (2026.09.09-0029-rolling)
Fix (tested locally)
diff
# check if a module already loaded
- if Path(f'/sys/module/{module_name}').exists():
+ if Path(f"/sys/module/{module_name.replace('-', '_')}").exists():
returnConfirmed /sys/module/vfio-pci does not exist while /sys/module/vfio_pci
does on a running VPP node with vfio-pci loaded; confirmed the corrected
check returns early without invoking modprobe.