-
-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Labels
Description
Affected Version
Any version supporting run0
Describe the bug
- run0 "support" is detected by checking for the existence of the binary. Unlike with doas/sudo/pkexec, this check is insufficient to ensure a working configuration: The systemd package creates the symlink no matter whether you have polkit installed or not, and without polkit installed run0 just crashes
- If run0 crashes, no other elevator is attempted
- Additionally, the
sudoconfig file setting is ignored - That means yay cannot not crash on a system with systemd installed but not polkit; unless you manually pass
--sudoon every yay invocation
Reproduction Steps
- Set up Arch with only
baseinstalled (=no polkit) - Install yay
- Watch yay crash with
Failed to start transient service unit: Access denied - Try setting
"sudo": "sudo",or any other working configuration in your config file - Watch yay crash anyway
Expected behavior
sudoconfig file option actually works- yay does not crash without manual configuration
Possible mechanisms:
- Just try elevation mechanisms in order – would still throw an error, but a harmless one
- De-prioritize run0 – easiest solution, but probably sucks for people who do have polkit?
- Check for pkexec existence, prioritize run0 if pkexec exists – slightly more complicated, but would keep run0 as default for polkit-enabled systems
Output
> python -mjson.tool ~/.config/yay/config.json && echo " --> valid json file"
{
"buildDir": "/home/creshal/.cache/yay/",
"editor": "",
"makepkgbin": "/usr/bin/makepkg",
"pacmanbin": "/usr/bin/pacman",
"pacmanconf": "/etc/pacman.conf",
"tarbin": "/usr/bin/bsdtar",
"requestsplitn": 150,
"sortmode": 0,
"sudo": "/usr/bin/doas",
"sudoloop": false,
"timeupdate": false,
"devel": false,
"cleanAfter": false
}
--> valid json file
> yay --debug
[DEBUG:runner] running /usr/sbin/run0 /usr/bin/pacman --debug -S -y --config /etc/pacman.conf --
Failed to start transient service unit: Access denied
-> error refreshing databases - exit status 1
> yay --debug --sudo /usr/bin/doas
[DEBUG:runner] running /usr/bin/doas /usr/bin/pacman --debug -S -y --config /etc/pacman.conf --
doas (creshal@localhost) password:(It would be helpful if --debug did debug config file parsing. Or was documented in the manpage.)