last day (16 days later) » 

6:35 PM
7
A: sudo is deleted

Eliah KaganIf you've actually deleted the sudo command, you can reinstall the package that provides it by running: pkexec apt-get update pkexec apt-get --reinstall install sudo This works because most Ubuntu systems have two separate ways that let administrators perform actions as root, sudo and Polkit. ...

 
it's give me error:pkexec must be setuid root
 
@KaliyaMitesh This means the permissions on /usr/bin/pkexec have been changed. You said sudo was deleted. What exactly happened? For example, what commands did you run? Is sudo really gone, or are you unable to run it because it has wrong permissions, too? Running chmod or chown recursively on /, /usr, or /usr/bin could prevent sudo from working and also produce this error with pkexec. I recommend editing your question to provide more details about what happened, and also about what error message you get when you do try to use sudo.
 
okey my sudo file is deleted? when i run pkexec apt-get update command it gives me must be setuid root error.i can not install anything and when i try to reinstall sudo it gives error like Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
 
@KaliyaMitesh How was sudo deleted, and how do you know it was? Did you deliberately delete it? Did you try to run it and get told The program 'sudo' is currently not installed.? Are you certain it is deleted, not broken in some other way? What's the output of ls -l /usr/bin/sudo and (as Spas Spasov suggested) sudo echo? This is relevant to figuring out what has caused your problem and how best to fix it. Depending on what happened, there might be much more wrong with your system than the sudo executable needing to be restored. I recommend you edit your question with full details.
 
yes i acidentlly deleted the sudo file. the output of ls -l /usr/bin/sudo is cannot access '/usr/bin/sudo': No such file or directory
 
6:35 PM
@KaliyaMitesh Did you run chown or chmod on /, /usr, or /usr/bin? Since /usr/bin/sudo is deleted, sudo and pkexec are unable to run for separate reasons. If that's the extent of the damage, then this is still easy to fix: you can boot in recovery mode, remount / readwrite with mount -o remount,rw /, and fix pkexec by running chown root:root /usr/bin/pkexec followed by chmod 4755 /usr/bin/pkexec, then reboot and reinstall sudo using pkexec. But if you can say how sudo got deleted, I may be able to give a more appropriate fix.
@KaliyaMitesh I've added an expanded version of the fix I suggested in a comment to my answer, and there are some other answers with different approaches, in case you prefer them. However you solve this, I still think you should provide details about exactly what may have caused sudo to be deleted, and any changes to ownership and permissions that you may have done in your Ubuntu system.
I think it's likely that more in your system is broken than just the sudo executable being absent and the pkexec excutable no longer being setuid. In case it is useful, I've made this chat room to discuss this. If you reply here, I'll try to help you troubleshoot and figure out what caused the problem. And if the current answers don't solve the immediate problem, that can be worked on here too. (Anyone else can join this room, it's not limited to us.)
 

  last day (16 days later) »