Password Prompt for sudo -v within brew Installation Script

Dear all,

I’m encountering an issue where a password prompt appears for the sudo -v command specifically within the brew installation script.

When I run the brew installation script, it unexpectedly requests a password at the point where the sudo -v command is executed:

...
have_sudo_access
...
/usr/bin/sudo -v
[sudo] password for ubuntu:

Interestingly, I also encounter the same password prompt when I directly execute the sudo -v command in the terminal.

Normally, I expect to be able to run sudo commands without being prompted for a password on this system. My user, ubuntu, has a NOPASSWD configuration set in /etc/sudoers.d/90-cloud-init-users:

/etc/sudoers.d/90-cloud-init-users:ubuntu ALL=(ALL) NOPASSWD:ALL

Has anyone else experienced this behavior, or does anyone have insights into why sudo -v might be prompting for a password in this specific context, despite the NOPASSWD configuration?

Below script helps me,

NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

However Homebrew currently does not support ARM processor.