Sudo as hard dependency on yay

Hi Manjaro forum.
This is my first post on here, however I have been using Manjaro for quite a while, and it is a distro that I will always recommend to others. It is the most stable distro I have ever used.

However, I was unsure where to post this but how come sudo is not a hard dependency on yay? As far as I am concerned yay can be found in pacman on Manjaro.
I removed sudo in favor of doas (I know, this is my own choice), but yay suddenly stopped working after. It also took me quite a while to figure this out, especially given that there were no warnings from pacman.
I also think it is a bit unresonable to assume that everyone is using sudo, and thus not make it a hard dependency.

Please forgive me moderators if this is the wrong place to post this :slight_smile:

Sudo is listed as an optional dependency for yay. Not sure for what though…

Making it an optional dependency was an upstream decision based on a user request.

Oh, my apologies then.

However, if the package breaks without sudo installed (at least it does on my system), then why is it optional?

edit* spelling error

Good question. What errors do you get without sudo?

Well that is the funny part.
I do not get any errors, but it does not start building the package either.
Like, it finishes the downloading and I can also find the pkgbuild in the cache dir, but it never prompts for root password or give any indication that it finished (or started for that matter) building.

A workaround for those using doas could be the opendoas-sudo aur package, which symlinks doas to sudo, but I still do not think that the responsibility should be shifted in that direction.

You need sudo for installing a package. Not for building it. But if the package require additional packages to be installed, yay will just exit with 1. It does not print an error.

And of course you can’t update a packages because yay would need to install the new verion. But you can build it, if all the dependencies are installed.

You can use --sudo /path/to/a/special/binary as long as it works similar to the normal sudo.

I was not aware of the --sudo trick, that is a nice one :slight_smile:

However you do not need sudo for installing packages, you may use other options that are less bloated, such as doas. I am only hinting at the fact that it could be convenient for others in similar situations to actually get some error rather than just an exit status of 1 :innocent:
In my opinion this should be handled by the package manager, but if it was a user request to remove it and it was agreed upon, then I guess there only exists this special case where one removes sudo from the system.

I will be marking this as closed now. Thank you for your time.

Let me rephrase that. yay requires sudo for installing packages. It explicitly looks for a binary called sudo and tries to use that.

I forgot to mention sudo is also only an optional dependency for pacman.

Remember AUR helpers like yay are just pacman wrappers.

1 Like

Jguer commented 26 days ago

One more thing what can be done is to remove sudo from dependencies, since you still have sudo installed to use yay

Done as of yay 10.1.2-2

It’s set as high priority,

opendoas-sudo enables sudo to be removed.
If you do ‘sudo pacman -Syu’ then the login is for doas, and yay/paru work as expected.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.