Yes, failure when run as root. Seems to work fine as user, after clearing /var/tmp/pamac. Perhaps a user warning when run as root/sudo would avoid this.
Pamac also includes a fully functional CLI for when you don’t have a working GUI or for those that prefer to manage packages that way.
Warning
Using sudo with pamac can have undesirable effects, especially when building packages. if in doubt, don’t use sudo. Pamac will ask for escalated rights if needed.
Warning: Do not execute pamac as root or using sudo.
You will be prompted if elevated privileges are needed.
and then the command should fail gracefully, allowing you to try again?
I think something to that extent might be beneficial for those who (for whatever reason) were unaware that sudo should not be used, or perhaps are also pacman users and typed sudo instinctively, without thinking.
Perhaps you could suggest this in the Feedback category, where it might be given fair consideration.
I think something like this would do the trick. I hereby present safepamac:
#!/bin/bash
#safepamac - a script to ensure Pamac is run only as a normal user, not as root or sudo or run0
if [[ $EUID -eq 0 ]]; then
echo -e >&2 "Warning: Do not execute pamac as root or using sudo or run0.\nPamac should only be run as a normal user\nYou will be prompted if elevated privileges are needed.\nExiting in 5 seconds..."
sleep 5
exit 1
fi
echo -e "Pamac is being run correctly as a normal user...\nYou will be prompted for your password if elevated privileges are required"
pamac $*
exit 0
Tested using run0, sudo, su & as a normal user:
~ run0 ✔
[scott-ser scotty]# /home/scotty/bin/safepamac search makemkv
Warning: Do not execute pamac as root or using sudo or run0.
Pamac should only be run as a normal user
You will be prompted if elevated privileges are needed.
Exiting in 5 seconds...
[scott-ser scotty]# exit
logout
~ sudo /home/scotty/bin/safepamac search makemkv 1 ✘ 14s
[sudo] password for scotty:
Warning: Do not execute pamac as root or using sudo or run0.
Pamac should only be run as a normal user
You will be prompted if elevated privileges are needed.
Exiting in 5 seconds...
~ su 1 ✘ 8s
Password:
[scott-ser scotty]# /home/scotty/bin/safepamac search makemkv
Warning: Do not execute pamac as root or using sudo or run0.
Pamac should only be run as a normal user
You will be prompted if elevated privileges are needed.
Exiting in 5 seconds...
[scott-ser scotty]# exit
exit
~ /home/scotty/bin/safepamac search makemkv 1 ✘ 15s
Pamac is being run correctly as a normal user...
You will be prompted for your password if elevated privileges are required
makemkv-libaacs 1:1-3 AUR
Enable libaacs emulation from MakeMKV
makemkv-cli 1.17.8-1 AUR
DVD and Blu-ray to MKV converter and network streamer - CLI only
makemkv 1.17.8-1 AUR
DVD and Blu-ray to MKV converter
Of course, the ultimate aim is to have this as part of Pamac, not a separate command that feeds the arguments to Pamac if run as a normal user. But it does show that it can be done.