Skip to content

Failed to create TUN: failed to set MTU of TUN device: invalid argument on ARMv5 (Marvell Kirkwood) #1277

@nickbash11

Description

@nickbash11

Description:

Yggdrasil fails to start due to an error when setting the MTU for the TUN device, resulting in a panic: "failed to create TUN: failed to set MTU of TUN device: invalid argument". The kernel logs (dmesg) show "tun1: mtu less than device minimum", suggesting that the MTU is being interpreted as below the minimum (e.g., 68 bytes) despite explicit configuration values like 65535.
This occurs consistently on an older ARMv5 platform (Marvell Kirkwood), even though manual creation of a TUN interface with the same MTU works fine. The issue persists across different MTU values, TAP mode, and Yggdrasil versions (0.5.12 and 0.5.9). It seems like a potential bug in how MTU is set via ioctl(SIOCSIFMTU) on this architecture, possibly leading to an invalid or zero MTU being passed to the kernel.

Steps to Reproduce:

  1. Install Yggdrasil 0.5.12 on Debian 10 (armel) via .deb package: dpkg -i yggdrasil-0.5.12-armel.deb.
  2. Use the default or modified configuration file (see below).
  3. Start the service: systemctl start yggdrasil (or run manually: yggdrasil -useconffile /etc/yggdrasil/yggdrasil.conf).
  4. Observe the panic in logs and the service failing.

Expected Behavior:

Yggdrasil should successfully create and configure the TUN/TAP interface with the specified MTU (e.g., 65535 or lower valid values) and start without panicking.

Actual Behavior:

Panic occurs during TUN creation, with "invalid argument" error. Kernel reports MTU below minimum, even when IfMTU is set to valid values.

System Details:

  • Hardware: QNAP TS-119+, Marvell Kirkwood ARMv5 (Feroceon 88FR131 rev 1).
  • OS: Debian 10 (Buster, armel).
  • Kernel: 4.19.0-21-marvell.
  • Yggdrasil Version: 0.5.12 (also tested 0.5.9; older versions avoided due to known network connectivity issues).
  • TUN/TAP Device: /dev/net/tun exists with permissions crw-rw-rw- 1 root root 10, 200.
  • Module: tun is loaded (via modprobe tun).

Manual TUN creation works without issues:

# ip tuntap add dev tun0 mode tun
# ip link set tun0 mtu 65535
# ip link set tun0 up

Output from ifconfig tun0:

tun0: flags=4241<UP,POINTOPOINT,NOARP,MULTICAST>  mtu 65535
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Minimum MTU tested manually: Fails at 67 with "Error: mtu less than device minimum", but succeeds at 68+.

Configuration File (/etc/yggdrasil/yggdrasil.conf):

{
  PrivateKey: 4dfb0e22501c7ee087ddd3fc7a410e0ec3bbc9971fa167a166f7a0c867dcc1bc9353ab9fe79ec80c23a0efee5a22e41e049cb374028a112f7dfb638c62de34b5

  Peers: []

  InterfacePeers: {}

  Listen: []

  MulticastInterfaces: [
    {
      Regex: .*
      Beacon: true
      Listen: true
      Port: 0
      Priority: 0
      Password: ""
    }
  ]

  AllowedPublicKeys: []

  IfName: auto

  IfMTU: 65535

  NodeInfoPrivacy: false

  NodeInfo: {}
}

(Note: Output from yggdrasil -useconffile /etc/yggdrasil/yggdrasil.conf -normaliseconf not provided here, but the config parses without errors in testing.)

What Was Tried:

  • Various IfMTU values in config: 1280, 1480, 1500, 6500, 65535 (and others between min IPv6 MTU and max).
  • TAP mode: Set IfTAPMode: true and IfName: tap0, but same error (panic and dmesg message).
  • Manual TUN/TAP creation: Works as shown above.
  • Different Yggdrasil versions: 0.5.9 exhibits the same behavior.
  • Verbose logging: -loglevel debug doesn't provide additional insights into MTU setting.
  • Kernel checks: IPv6 enabled, TUN module loaded, no permission issues (running as root).

Logs (from systemd and yggdrasil):

Sep  1 13:25:56 debian-qnap systemd[1]: Starting Yggdrasil Network...
Sep  1 13:25:56 debian-qnap systemd[1]: Started Yggdrasil Network.
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 Build name: yggdrasil
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 Build version: 0.5.12
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 Your public key is 6190c660a89c75650a45c1b34e30a833f65eae36f860c222c0e80b5bd0812a7e
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 Your IPv6 address is 201:79bc:e67d:5d8e:2a6b:d6e8:f932:c73d
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 Your IPv6 subnet is 301:79bc:e67d:5d8e::/64
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 UNIX admin socket listening on /var/run/yggdrasil/yggdrasil.sock
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 TLS listener started on [fe80::208:9bff:fe8c:828b%eth0_228]:38839
Sep  1 13:25:57 debian-qnap systemd-udevd[20326]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 2025/09/01 13:25:57 TLS listener started on [fe80::208:9bff:fe8c:828b%eth0]:45941
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: panic: failed to create TUN: failed to set MTU of TUN device: invalid argument
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: goroutine 1 [running]:
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: main.main()
Sep  1 13:25:57 debian-qnap yggdrasil[20320]: 	/home/runner/work/yggdrasil-go/yggdrasil-go/cmd/yggdrasil/main.go:292 +0x2970
Sep  1 13:25:57 debian-qnap systemd[1]: yggdrasil.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep  1 13:25:57 debian-qnap systemd[1]: yggdrasil.service: Failed with result 'exit-code'.
Sep  1 13:25:57 debian-qnap systemd[1]: yggdrasil.service: Service RestartSec=100ms expired, scheduling restart.
Sep  1 13:25:57 debian-qnap systemd[1]: yggdrasil.service: Scheduled restart job, restart counter is at 1.
Sep  1 13:25:57 debian-qnap systemd[1]: Stopped Yggdrasil Network.

dmesg Output (relevant line):

[522421.048665] tun1: mtu less than device minimum

Related Issues:

This platform is quite old, so it might be an edge case, but Yggdrasil claims ARM support. Happy to provide more details or test patches!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions