Restore Sudo Permission from accidentally removed the sudo package

Today, I’ve successfully restored Sudo Permission from accidentally removed the sudo package. It’s happened after I upgrade the Arch Linux on my very old Raspberry Pi B+ Model for a long long time running as home VPS.

As I remember, the last time I upgraded OS for more than a year ago, so pacaur won’t work anymore. I switched to yay because it’s supported Arch Linux ARMv6l (my hardware) then I removed pacaur as useless component.From that moment, I found that I can’t install any new package because the sudo package has removed together with pacaur by the command:

$ sudo pacman -Rscn pacaur

It’s humorous, I’ve removed myself from the system administrator group. I known the method to recover my root permission by reboot in GRUB recover mode, but I didn’t my Raspberry Pi B+ is running as headless VPS, I control it through SSH connection. Did you know? openssh disables ssh password access for root by default. I must switch to root account after login successfully.

$ ssh 192.168.0.151
Welcome to Arch Linux ARM

     Website: http://archlinuxarm.org
       Forum: http://archlinuxarm.org/forum
         IRC: #archlinux-arm on irc.Freenode.net
Last login: Sun Feb 28 06:08:30 2021 from 192.168.0.170
Kernel Information:  Linux 5.4.80-1-ARCH armv6l
GNU bash, version 5.1.4(1)-release (armv6l-unknown-linux-gnueabihf)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Uptime:  16:45:01 up 28 days,  5:29,  1 user,  load average: 0.42, 0.30, 0.28
Server time is: Sun Feb 28 16:45:01 +07 2021
$ sudo su   
-bash: sudo: command not found
$ su root 
Password:
#  pacman -S sudo

Now, the sudo package was re-installed, don’t forget to add yourself to wheel group or give system administrator permission via /etc/sudoers file:

root ALL=(ALL) ALL

That’s it. Now type exit and do anything as you wish.

Leave a Comment