It happened to me right now while testing that what can be the cause of the problem and sure it is because of a non-existent shell being set as root default shell.
I couldn't run any command with sudo, I wasn't able to run sudo -i, sudo -i /bin/bash or even sudo su -, because there is no /bin/bash/asd.
The only thing that I could do and it worked was running:
sudo -s /bin/dash
to get shell with root access, sudo -s /bin/bash should work too.
Then use nano to edit passwd file:
nano /etc/passwd
you should see a line look like this:
root:x:0:0:root:/root:/bin/bash/asd
change it to :
root:x:0:0:root:/root:/bin/bash
use Ctrl+O then pressing Enterto save the file.
Now use exit command to get out of dash shell which hasroot access.
You are done, however I suggest running:
sudo chsh root -s /bin/bash
to make sure permissions are correct.
sudo chsh ...to change the root shell becasuesudodoes not work correctly right now as I described you should change/etc/passwdfile manually. read my answer again; also Pay attention to the answer, I didn't say to change root shell to/bin/bash/I said change it to:/bin/bash:-) – Ravexina May 14 '17 at 21:54chsherrors. – Chai T. Rex May 14 '17 at 22:39