postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.89k stars 250 forks source link

Installation failing due to sudo failure #478

Open jcoglan opened 7 months ago

jcoglan commented 7 months ago

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:

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)
postmodern commented 7 months ago

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. https://github.com/postmodern/ruby-install/blob/6c5180d6843f1c6f6b49e16576c11f168f22b114/share/ruby-install/package_manager.sh#L32-L41

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

postmodern commented 7 months ago

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 commented 7 months ago

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.