Yaourt as root
Since pacman 4.2 when running yaourt as root user you get error message. It was really a horrifying experience for me as I run my system as root user. Switching to another user just to run yaourt was not feasible for me. Also adding switch user alias wasn’t good solution for me. So I looked for a workaround and here it is. No more alias and no more switching user. The only problem is you need to do this everytime you update or pacman updates. Better download the file and copy it after every update.
Manual Fix for Yaourt as root
makepkg: invalid option '--asroot'
To fix this, we can edit /usr/bin/makepkg 3:)
Add asroot to OPT_LONG. Just search for “OPT_LONG”.
OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' 'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild' 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version' 'asroot')
Remove EUID check. Just search for “EUID”.
if (( ! INFAKEROOT )); then if (( EUID == 0 )); then error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\catastrophic damage to your system.")" "makepkg" #exit 1 # $E_USER_ABORT fi fi
Screenshot of Yaourt as root
Click to enlarge
Now you should be able to run yaourt as root 🙂
Still didn’t work? I have a file ready for you. Download and copy 🙂
If you still have problem, download this file here and replace it. Download makepkg (right click save link as) to your home directory (~)
cp /usr/bin/makepkg /usr/bin/makepkg_bkp cd ~ sudo cp makepkg /usr/bin/makepkg
Last words :’)
If you are still having some problems, do comment below I’ll try to help you out as much as I can. Also let me know if you want me to post tutorials/fixes on any other problem.