Skip to content

Inconsistent path lookup of iproute2 shell commands on Linux #472

@blenderfreaky

Description

@blenderfreaky

Currently, iproute2 is called in two ways on linux:

  • via routeCommand (on Linux that is set to = "/sbin/ip")
  • and via path-lookup (shell.Exec(log, "ip", ...), in daemon/vpn/wireguard/wireguard_linux.go and daemon/v2r/v2ray_linux.go)

If ip is not in PATH but is present in /sbin/, this can cause confusing errors where it finds ip in some cases but not others.

This is a very niche issue, but we encountered this specific issue in the Nix packaging of ivpn, where we have to patch in a hardcoded path to the ip command (because standard FHS paths don't exist in Nix), while the PATH is kept very minimal. See here for more context: NixOS/nixpkgs#474377

I'd propose either changing all the path-lookups to use /sbin/ instead, or use routeCommand and introduce a second one for ip link (as used in wireguard_linux.go)

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