0

My problem on my macOS High Sierra is that recently none of sudo commands are working.

here is a sample,

Majids-MacBook-Pro:etc mjzarrin$ sudo vi x.txt
dyld: lazy symbol binding failed: Symbol not found: __chkstk_darwin
Referenced from: /usr/local/libexec/sudo/sudoers.so
Expected in: flat namespace

dyld: Symbol not found: __chkstk_darwin
Referenced from: /usr/local/libexec/sudo/sudoers.so
Expected in: flat namespace

Abort trap: 6

Please advise.

I'll update the question if any extra information is needed. later I will prone to show only related stuff regarding the solution.

Updates regarding comments:

Majids-MacBook-Pro:local mjzarrin$ sudo
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

Majids-MacBook-Pro:local mjzarrin$ type sudo
sudo is hashed (/usr/local/bin/sudo)

Majids-MacBook-Pro:local mjzarrin$ /usr/bin/sudo vi x.txt
sudo: setrlimit(8): Invalid argument
sudo: error in /etc/sudo.conf, line 16 while loading plugin "sudoers_audit"
sudo: unable to find symbol "sudoers_audit" in sudoers.so
sudo: fatal error, unable to load plugins

here is what I did till now and it's results.

Unfortunately I don't know when exactly this problem begins. I found it when I tried to install something with Brew. then I was thought it's the Brew corruption. deciding reinstalling it but could not install it again. I installed a new local Brew. Then I found something about sudo is wrong. I didn't recall touching sudoer explicitly before the problem shows up, Then based on some other similar answers I replaced it with it's backup ("/etc/sudoer~orig"). although both files was same in size,lines and content ,I did changing in the command line inside Mac Recovery Mode. then chown and chmod it as expected. finally nothing changes. all errors are the same as before.

I also set read/write permission to everyone(USER) for /etc/sudoer file to check the results.

here are environment variables:

Majids-MacBook-Pro:local mjzarrin$ env
MANPATH=/Users/mjzarrin/.nvm/versions/node/v12.19.0/share/man:/usr/local/share/man:/usr/share/man:/Library/TeX/texbin/man:/Library/Developer/CommandLineTools/usr/share/man
TERM_PROGRAM=Apple_Terminal
NVM_CD_FLAGS=
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/zp/p6j34s0511q33t8npcpsj9gw0000gn/T/
CONDA_SHLVL=1
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.tTwjH0va6l/Render
CONDA_PROMPT_MODIFIER=
TERM_PROGRAM_VERSION=404.1
OLDPWD=/Users/mjzarrin/Documents
TERM_SESSION_ID=33152693-16F1-4C64-A226-3E4AA8CDB8BF
NVM_DIR=/Users/mjzarrin/.nvm
USER=mjzarrin
CONDA_EXE=/Users/mjzarrin/anaconda3/bin/conda
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.VwFyVepaRs/Listeners
PATH=/Users/mjzarrin/.cargo/bin:/Users/mjzarrin/.yarn/bin:/Users/mjzarrin/.config/yarn/global/node_modules/.bin:/Users/mjzarrin/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/opt/openssl/bin:/usr/local/sbin:/Users/mjzarrin/.nvm/versions/node/v12.19.0/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Users/mjzarrin/apache-maven-3.5.0/bin/:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
CONDA_PREFIX=/Users/mjzarrin/anaconda3
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
PWD=/usr/local
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
LANG=en_US.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
M2_HOME=/Users/mjzarrin/apache-maven-3.5.0/
SHLVL=1
HOME=/Users/mjzarrin
CONDA_PYTHON_EXE=/Users/mjzarrin/anaconda3/bin/python
LOGNAME=mjzarrin
CONDA_DEFAULT_ENV=base
NVM_BIN=/Users/mjzarrin/.nvm/versions/node/v12.19.0/bin
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
DISPLAY=/private/tmp/com.apple.launchd.sNNQyX8v30/org.macosforge.xquartz:0
_=/usr/bin/env

I also checked the following. I went to single-user mode (CMD+S during boot). it gives me command line then I typed following.

mount -uw /
update_dyld_shared_cache -force 

It's finished without errors but some warning. then I reboot. and logged in to my account.

Majids-MacBook-Pro:~ mjzarrin$ sudo vi x.txt
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /usr/local/libexec/sudo/sudoers.so
  Expected in: flat namespace

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /usr/local/libexec/sudo/sudoers.so
  Expected in: flat namespace

Abort trap: 6

Majids-MacBook-Pro:~ mjzarrin$ /usr/bin/sudo vi x.txt
sudo: setrlimit(8): Invalid argument
sudo: error in /etc/sudo.conf, line 16 while loading plugin "sudoers_audit"
sudo: unable to find symbol "sudoers_audit" in sudoers.so
sudo: fatal error, unable to load plugins

Majids-MacBook-Pro:~ mjzarrin$ /usr/local/bin/sudo vi x.txt
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /usr/local/libexec/sudo/sudoers.so
  Expected in: flat namespace

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /usr/local/libexec/sudo/sudoers.so
  Expected in: flat namespace

Abort trap: 6
6
  • 3
    What does type sudo return? What kind of changes have you made to the sudoers file?
    – nohillside
    Sep 21 at 5:19
  • 1
    1. Did you recently install new software, either by using Apple’s Installer or by a third-party package manager command-line tool such as brew or port? 2. What happens if you reboot in single-user mode (CMD+S during boot), remount your boot volume as read-write by following the instructions onscreen, run the command update_dyld_shared_cache -force, and reboot again? Does this still reoccur?
    – pion
    Sep 21 at 5:45
  • 1
    Also can you amend your question with a list of your environment variables (ENV)? (Please be sure to scrub any personal information from the output first.)
    – pion
    Sep 21 at 5:48
  • 2
    +1 on @nohillside’s comment: My first suspicion is that you’re running a local install of sudo. Try again with /usr/bin/sudo vi x.txt
    – pion
    Sep 21 at 5:50
  • 1
    /usr/local/libexec doesn't exist by default, so some sort of nonstandard software has been installed here -- maybe a nonstandard version of sudo itself, maybe a PAM module or something like that. But there's something nonstandard here, and that's almost certainly what's causing the problem. Sep 21 at 6:09
2

So we are looking at two issues here:

  • /etc/sudo.conf points to a missing plugin. Normally you would need to boot into Single User or Recovery, edit the file using visudo to remove the offending line and reboot. As the file is already writeable to everybody, you can just run vi /etc/sudo.conf to fix it, followed by chmod 640 /etc/sudo.conf; chown root:wheel /etc/sudo.conf.
  • brew uninstall sudo because this is most likely not needed at all.

PS: Always use visudo to have syntax checks done automatically, it will protect against a lot of typos. It will not protect against symbol errors in plugins though.

3
  • One suggestion I would have is to use visudo -f /PATH/TO/ROOT/VOLUME/etc/sudoers rather than vi to edit /etc/sudo.conf. The former will perform validity checks to ensure that the file is properly formatted and permissioned.
    – pion
    Sep 21 at 13:49
  • @pion Agreed. But this will not work if the configuration is already broken (because visudo relies on sudo).
    – nohillside
    Sep 21 at 13:54
  • Yes, I should have been explicit: This would have to be run from Recovery.
    – pion
    Sep 21 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .