Frihu
Posts: 1
Joined: Fri Mar 06, 2020 12:45 pm

Can not log in to root account

Fri Mar 06, 2020 1:03 pm

Hello!

I have Raspberry Pi 2 and I meet with a problem to log in to root account.
Normally and by default I have created account "pi". This is standard user without admin privileges.
When I am trying to log in as root I am prompted to put pi password...
1. Here I have issue, I do not know this password. I wrote down some old password for pi, but when I put it I have information that something like "I'm not on the list of sudoers". Is this password correct and issue is somewhere else? Any others password return "password incorrect" except this one.
2. Secondly, when I tried command on pi user to log in as root: sudo su root I am prompted to put password, when I putting it, I got notification that authentication failure. I am sure that this password is correct for root but somehow it says no...

Is there way to maybe connect to Raspberry via USB cable or something to go inside configuration files and change it.
Unfortunately I am not able to log in to Raspberry via SSH (probably it turns off or is locked due to many tries to put password).

Thank you in advance.

jbudd
Posts: 1446
Joined: Mon Dec 16, 2013 10:23 am

Re: Can not log in to root account

Fri Mar 06, 2020 1:55 pm

What operating system are you using?

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can not log in to root account

Fri Mar 06, 2020 1:56 pm

You will need to create a new copy of Raspbian on a spare SDCard. Boot that, insert your broken system in a USB reader and use the new Raspbian system to repair the old one.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Can not log in to root account

Fri Mar 06, 2020 3:27 pm

Assuming raspbian, if you didn't set a password for root yourself, it won't have one. Or at least not one you can login with.

Again, assuming raspbian, using sudo when logged in as the user "pi" shouldn't be prompting for a password unless you have changed the configuration from the default. "I'm not on the list of sudoers" means exactly that. The user you're currently logged in as is not permitted to use sudo but it's likely that you have entered the correct password.

With "sudo" the password you need to use is that of the currently logged in user. With "sudo su root" I'd expect the same. Sudo will prompt for your password to elevate you to root who then uses "su" to change the effective user. As you're efectively root at that point "su" won't be prompting for a password.

As has been suggested, you'll need another linux system to fix this. Which could be a Pi running from another SD card or a desktop linux system.

In brief:
  1. Mount the correct partition of your SD card from your other linux box. Which partition depends on which OS you're using and whether you're using Noobs or not.
  2. On the broken SD card backup etc/sudoers
  3. Copy the default /etc/sudoers from an unmodified OS image to replace the one on the broken SD card.
Be careful when doing this, it's easy to copy things the wrong way if you're not paying attention.
Arguing with strangers on the internet since 1993.

GordonS
Posts: 1
Joined: Thu Mar 12, 2020 2:50 pm

Re: Can not log in to root account

Thu Mar 12, 2020 2:56 pm

One way that one can get around this, provided the account pi is still available is to first use the su command to become pi, then use sudo:

me@mypi $ su pi
Password:
pi@mypi: sudo raspi-config or whatever.

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Can not log in to root account

Thu Mar 12, 2020 6:26 pm

GordonS wrote:
Thu Mar 12, 2020 2:56 pm
One way that one can get around this, provided the account pi is still available is to first use the su command to become pi, then use sudo:

me@mypi $ su pi
Password:
pi@mypi: sudo raspi-config or whatever.
Only if you know what the pi user's password is. Which isn't at all clear from the OP.
Arguing with strangers on the internet since 1993.

Return to “Troubleshooting”