Homebrew-core: mtr doesn't work

Created on 16 Jun 2017  ยท  11Comments  ยท  Source: Homebrew/homebrew-core

Please always follow these steps:

  • [X] Confirmed this is a problem with brew installing one, specific formula (not cask) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/Homebrew/caskroom/homebrew-cask/new
  • [X] Ran brew update and retried your prior step?
  • [ ] Ran brew doctor, fixed all issues and retried your prior step?
  • [ ] Ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [X] If brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

Output of brew config:

HOMEBREW_VERSION: 1.2.3
ORIGIN: https://github.com/Homebrew/brew
HEAD: ed9942fbd1ec4243f0a92ab8f9b2411c8b1fb091
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 46d9cb11d61d074b745f251459e85f05d08eb295
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.13.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.5-x86_64
Xcode: 8.3.2
CLT: 8.3.2.0.1.1492020469
X11: 2.7.11 => /opt/X11

output of brew doctor:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

(The PATH thing, okay, but I'm executing with an absolute path, so it is a bit inconvenient, but shouldn't cause issues.)

To help us debug your issue please explain:

  • What you were trying to do (and why)

I did brew install mtr; then I ran sudo /usr/local/sbin/mtr, but mtr fails to start with:

mtr: Failure to start mtr-packet: Invalid argument

(I am on OS X Sierra, version 10.12.5 (16F73), in case this is some weird "OS X is locking down the OS" thing.)

  • What happened (include command output)
    (above)
  • What you expected to happen
    I expect mtr to run.
  • Step-by-step reproduction instructions (by running brew install commands)
    (above)
bug

All 11 comments

@thanatos I've reported it upstream here: https://github.com/traviscross/mtr/issues/204.

@thanatos mtr-packet is the child process used by mtr to actually send and receive network probes. According to the source code there are three different ways that the exec can be located.

  • Locate it in the path (this would mean adding /usr/local/sbin to your path of course).
  • Locate it using the env variable MTR_PACKET, which overrides the path.
  • Have it located in the current directory, i.e $PWD=/usr/local/sbin.

The final one does not seem well suited for production environments, but who am I to judge. ๐Ÿ˜‰
This is where I got this information.

We could consider using a wrapping script that adds /usr/local/sbin to the PATH, or even just sets MTR_PACKET, but upstream should really fix this so that using the full path to the executable works as expected regardless of whether you choose to have /usr/local/sbin in your PATH. We can consider Homebrew-side changes if upstream decides to designate https://github.com/traviscross/mtr/issues/204 "won't fix," but in the meantime you should add /usr/local/sbin to your PATH as suggested by brew doctor.

โžœ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
โžœ which mtr
/usr/local/sbin/mtr
โžœ which mtr-packet
/usr/local/sbin/mtr-packet
โžœ mtr -rw google.com.au
Failure to open IPv4 sockets: Operation not permitted
Failure to open IPv6 sockets: Operation not permitted
mtr: Failure to start mtr-packet: Invalid argument

I have followed the steps to include '/usr/local/sbin' into the PATH but I am still getting an error. Something else that I find strange is the output to the command "mtr -v" --> "mtr UNKNOWN".

However, when I trie to reinstall mtr again, I get that the version is 0.92 (Warning: mtr 0.92 is already installed)

Note:

mtr needs to run as root.

So, if anybody experiencing the following error,

Failure to open IPv4 sockets: Operation not permitted
Failure to open IPv6 sockets: Operation not permitted
mtr: Failure to start mtr-packet: Invalid argument

just run it again with sudo:

$ sudo mtr example.com

โžœ ~ brew install mtr
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
roswell spdlog twarc

==> Downloading https://homebrew.bintray.com/bottles/mtr-0.92.sierra.bottle.tar.gz

################################################################## 100.0%

==> Pouring mtr-0.92.sierra.bottle.tar.gz
==> Caveats
mtr requires root privileges so you will need to run sudo mtr.
You should be certain that you trust any software you grant root privileges.
==> Summary
๐Ÿบ /usr/local/Cellar/mtr/0.92: 12 files, 181.9KB
โžœ ~ mtr co.za
zsh: command not found: mtr
โžœ ~ sudo mtr co.za
Password:
sudo: mtr: command not found
โžœ ~ which mtr
mtr not found

/usr/local/sbin

โžœ ~ sudo /usr/local/sbin/mtr co.za
mtr: Failure to start mtr-packet: Invalid argument
โžœ ~

right. you need to add /usr/local/sbin to your PATH.

geez .. that was a long way to get to it.. thx for help @ilovezfs
i thought brew was handling all this ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ralexx picture ralexx  ยท  4Comments

oli-laban picture oli-laban  ยท  3Comments

gregvirgin picture gregvirgin  ยท  3Comments

dredmorbius picture dredmorbius  ยท  3Comments

yuna9 picture yuna9  ยท  4Comments