Skip to content

RTNETLINK answers: File exists / Linux route add command failedΒ #9

@davetapley

Description

@davetapley

I was having an issue where the action appeared to complete successfully,
but nothing was reachable.

On close inspection I saw RTNETLINK answers: File exists / Linux route add command failed in the logs:

Tue Dec 28 01:36:27 2021 ROUTE_GATEWAY 10.1.0.1/255.255.0.0 IFACE=eth0 HWADDR=00:0d:3a:c3:be:d8
[...]
Tue Dec 28 01:36:27 2021 /sbin/ip route add 10.1.0.0/16 via 10.2.128.1
RTNETLINK answers: File exists
Tue Dec 28 01:36:27 2021 ERROR: Linux route add command failed: external program exited with error status: 2
[...]
VPN connected successfully. Daemon PID: 2665

I figured (via netstat -rn) that I was just unlucky that the hosted runners have a conflicting route:

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.1.0.1        0.0.0.0         UG        0 0          0 eth0
10.1.0.0        0.0.0.0         255.255.0.0     U         0 0          0 eth0
168.63.129.16   10.1.0.1        255.255.255.255 UGH       0 0          0 eth0
169.254.169.254 10.1.0.1        255.255.255.255 UGH       0 0          0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0

I'm not sure what that route is for, but with this workaround ⬇️ I was able to get it working πŸ’«

      - name: Delete conflicting route
        run: sudo route del -net 10.1.0.0 gw 0.0.0.0 netmask 255.255.0.0 dev eth0

      - name: Connect to VPN
        uses: "kota65535/github-openvpn-connect-action@v1"

I think there are a few solutions here:

  • Easier: Detect the ERROR: Linux route add command failed and fail the action.
  • Harder: Detect conflict and automatically sudo route del.

It would also be nice to know why the runners have that route πŸ€”

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions