After I made a backup for /etc/sudoers
file:
sudo mv /etc/sudoers{,.bak}
I get the same errors like in your case.
If you use
pkexec apt-get install sudo
will not work because apt-get
will see that:
sudo is already the newest version.
If you use:
pkexec apt-get install --reinstall sudo
will also not work because /etc/sudoers
file is not found to be removed and replaced.
But if you use:
pkexec apt-get purge sudo
pkexec apt-get install sudo
as described in this answer, everything will work like a charm. I can say this because I just test it again.
So, there is no point to lose time and boot your system with a live disk.
Files "deleted" in other partitions should be temporarily be moved in a .Trash-1000
folder within the same partition they were "deleted" from while pending a "definitive deletion"; this is a hidden folder, so try the following:
- Open
Files
- Open the partition in which the file was deleted
- Hit Ctrl+h
- Open the
.Trash-1000
folder and browse its content
The "deleted" file should be somewhere inside this folder.
If it's not, you can try to recover it with testdisk
:
- Open a
Terminal
by hitting Ctrl+Alt+t
- Install
testdisk
: sudo apt-get install testdisk
- Run testdisk:
sudo testdisk
- Choose
No Log
- Select the drive containing the partition from which the file was deleted and choose
Proceed
- Choose the partition table type
- Choose
Analyse
- Choose
Quick Search
- Select the partition from which the file was deleted and hit p
- Browse both the folder which used to contain the deleted file and the
.Trash-1000
folder and see if your file is listed in red; if it is, select it and hit c
- Browse to a folder in which you can copy the recovered file and hit C
- Quit
testdisk
This should recover the deleted file and copy it in the location specified, altough the file might have been overwritten (and be corrupted) since his deletion from the filesystem entries.
Best Answer
The reason I write this instruction here is that I didn't find a step-by-step solution when I ran into the problem myself. I'm a Linux newbie myself, so feel free to edit this :)
These steps solved the problem for me:
Boot into recovery mode (press Esc or left Shift after BIOS splash)![enter image description here](https://i.stack.imgur.com/ZKhOM.jpg)
Select Drop to root shell prompt option![enter image description here](https://i.stack.imgur.com/I27De.jpg)
Mount the file system in writable mode:
Add the internet connection (I'm not sure if this works with Wi-Fi):
Now you have to purge the existing sudo package. It's protected against removal, so you have to set this environment variable:
Purge the sudo:
That command also purged the ubuntu-minimal package, so if we run
this will restore both packages
Reboot the system: