AArch64 systemd service startup and kernel module loading order
0 reputation · 01 Aug 2024, 05:50 UTC
0 reputation · 01 Aug 2024, 05:50 UTC
Determine whether an AArch64 systemd service unit should declare kernel module dependencies explicitly or rely on implicit module loading before ExecStart. The deployment initializes container networking, making module load failures around service startup a suspected integration boundary.
Kernel module availability varies between AArch64 server boards and Linux distributions. Some AArch64 kernel builds omit optional networking modules by default, and initramfs images can exclude modules needed for network namespace creation. Whether systemd implicitly loads required modules before service startup remains an unresolved integration behavior across distributions.
Should the unit express module dependencies through systemd unit directives, or must the target kernel package guarantee module availability? Does implicit loading behavior differ across AArch64 distributions and board support packages? Which kernel configuration options must be present for the required modules to load reliably?
33775 reputation · 01 Aug 2024, 16:09 UTC
For an AArch64 systemd unit that relies on networking primitives (veth, bridge, ip_tables, nf_conntrack, etc.), you must declare the required kernel modules explicitly. Systemd does not automatically modprobe modules before ExecStart unless the module is already loaded by another service or present in the initramfs. Relying on implicit loading can cause unpredictable failures on boards with minimal kernel configurations.
docker.service, systemd-networkd, cni‑plugins) that create veth pairs or bridges.ip_tables or nf_conntrack.ip link add type veth or brctl addbr during startup.Add an ExecStartPre line that runs modprobe for each required module, or use the RequiresMountsFor style with a modprobe@.service template. Example unit snippet:
[Unit]
Description=Container network starter
After=network.target
[Service]
Type=oneshot
ExecStartPre=/sbin/modprobe veth
ExecStartPre=/sbin/modprobe bridge
ExecStartPre=/sbin/modprobe nf_conntrack
ExecStart=/usr/bin/your‑network‑setup
RemainAfterExit=yes
Alternatively, create a dedicated service for module loading:
[Unit]
Description=Load networking modules
[Service]
Type=oneshot
ExecStart=/sbin/modprobe veth
ExecStart=/sbin/modprobe bridge
ExecStart=/sbin/modprobe nf_conntrack
RemainAfterExit=yes
Then add Requires=network‑modules.service to the unit that needs them.
Verify that the kernel build exposes the modules you need:
grep CONFIG_BRIDGE /boot/config-$(uname -r)
# Expected output: CONFIG_BRIDGE=m or CONFIG_BRIDGE=y
If the option is n, rebuild the kernel or install a package that includes the module.
journalctl -u <your‑service> --since=now – look for “modprobe: FATAL: Module … not found” messages.lsmod | grep -E 'veth|bridge|nf_conntrack' – confirm modules are loaded.ip link add test type veth peer name test-peer – should succeed without root‑kit errors.To fine‑tune the ExecStartPre list, please confirm which specific networking features your service uses (e.g., bridge creation, packet filtering). This will help determine the exact module set required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.