Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation failing due to sudo failure #478

Open
jcoglan opened this issue Jan 1, 2024 · 3 comments
Open

Installation failing due to sudo failure #478

jcoglan opened this issue Jan 1, 2024 · 3 comments

Comments

@jcoglan
Copy link

jcoglan commented Jan 1, 2024

Description

ruby-install cannot install ruby for me currently, it fails due to an error trying to use sudo:

$ sudo ruby-install -r /opt/rubies ruby 3.3.0
>>> Installing ruby 3.3.0 into /opt/rubies/ruby-3.3.0 ...
>>> Installing dependencies for ruby 3.3.0 ...
sudo: unknown user "jcoglan"
sudo: error initializing audit plugin sudoers_audit
sudo: unknown user "jcoglan"
sudo: error initializing audit plugin sudoers_audit
!!! Installing dependencies failed!

I am running ruby-install 0.9.3, installed via Homebrew, on macOS 13.6.3.

I am able to use sudo myself to run other programs and it behaves normally, which is why I suspect this is an issue with ruby-install specifically. I get the same error even if I become root first using sudo su.

Steps To Reproduce

Steps to reproduce the bug:

  • Run the command shown above

Expected Behavior

Ruby and its dependencies are installed.

Actual Behavior

ruby-install fails to install dependencies, reporting an error related to sudoers_audit.

Environment

$ ruby-install --version
ruby-install: 0.9.3

$ uname -a
Darwin berlin.local 22.6.0 Darwin Kernel Version 22.6.0: Tue Nov  7 21:42:27 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_ARM64_T8103 arm64

$ cc --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ openssl version
OpenSSL 3.2.0 23 Nov 2023 (Library: OpenSSL 3.2.0 23 Nov 2023)
@jcoglan jcoglan added the bug label Jan 1, 2024
@postmodern postmodern self-assigned this Jan 2, 2024
@postmodern
Copy link
Owner

That doesn't seem right! In ruby-install 0.9.3 I changed the logic of how brew is executed as a regular user to use $SUDO_USER, which should be the same as your $USER.

local brew_sudo=""
if (( UID == 0 )) && [[ -n "$SUDO_USER" ]]; then
# Note: to avoid running homebrew as root,
# drop privileges back to the original sudo user
brew_sudo="sudo -u \"$SUDO_USER\""
fi
run $brew_sudo brew install "$@" ||
run $brew_sudo brew upgrade "$@" || return $?

Can you run sudo -u jcoglan ls? Is your user name jcoglan or something else?

@postmodern
Copy link
Owner

The sudo: error initializing audit plugin sudoers_audit error also makes me think there's something up with sudo. Did you recently upgrade macOS or add something to /etc/sudo.conf, /etc/sudoers, or /etc/sudoers.d?

@jcoglan
Copy link
Author

jcoglan commented Jan 2, 2024

Thanks for the quick response :)

sudo -u jcoglan ls works fine, it lists the directory as normal with no errors.

/etc/sudoers looks very vanilla; I've never knowingly modified it. I contains a few Defaults lines affecting env_keep and lecture_file, it authorizes root and %admin to do everything (ALL = (ALL) ALL) and then includes everything that's in /etc/sudoers.d, which is empty.

I have not recently upgraded macOS to a new major version but I have all updates installed for Ventura.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants