kasijus
Posts: 2
Joined: Sun Jul 15, 2018 5:43 pm

Cannot boot anymore, root account locked

Sun Jul 15, 2018 6:03 pm

I have a Pi3 model B, with an external HDD, connected through powered USB hub. I just followed tutorials to set up samba server, vpn server, etc, and it's been working just fine, until today.

A couple of days ago, there was a power outage, but I restarted Pi, and it seemed to work fine. Then I left home for a couple of days, and when I returned today, I couldn't access my drive, I tried to ssh into my public folder, but there was an error, something about 'input/output'. I ran `dmesg`, and it said something like "print_req_error: critical target error...".

Then I tried to reboot the Pi and that's when the nightmare began. It entered the emergency mode, the root account is locked, and just says "Press Enter to continue", but when I press enter, nothing happens. I read about adding `init=/bin/sh` to my cmdline.txt and remounting root. I tried `mount -o remount,rw /` but then I got the error saying something like "cannot find partuuid=...". My /etc/fstab is "unwritable"...

I don't know what to do now, looks like it's something about my HDD being corrupted, but how do I go about fixing this? Does anyone have an idea?

Thanks.

mutrised
Posts: 44
Joined: Thu Nov 08, 2012 12:41 am
Location: France

Re: Cannot boot anymore, root account locked

Mon Jul 16, 2018 8:12 am

Hi,

Seems like file corruption to me.

Your system was running from SD or DD ?

If from SD your problem is here. I just stopped running PIs on SD "as is". I tried running it on HDD but had trouble with some pour quality USB to SATA bridges. A main issue I spotted is that, depending on the DD and bridge you're using, you may have write cache enabled or not.
Once your system booted, type dmesg, if you got red bold message saying write cache not enabled on /dev/sda (you DD), it will be corrupted on power outage... Even is no system is running on, your partition will got messed up.
The above explanation may not be "engineer certified", I'm more a computer enthusiast than an expert, but that's my observations base on my own experiences.

The best solution I found so far and the one I use for all my PIs =D is to set the system mostly read only, and use tmpfs storage for little files, external SD card, or DD for databases or user files. I though about setting up a battery power backup, but I found is less eco friendly...

I won't be able to help you I think on how to recover your system... Maybe try fsck to repare de file system, search google for further help on this.

To setup a read only rasbian, follow this guide: https://hallard.me/raspberry-pi-read-only/
This is the one I always follow.

See my signature, all these PIs run with a mostly read only FS. The gateway is 100% readonly (just logs on tmpfs), VPN as well. Owncloud server is a bit trickier because you need to move more files to the harddrive such as mysql databases, php cache...
But I can't help you for this =)
RPI2B 7/24 - web, NAS/media, Owncloud and more
RPI0 7/24 - VPN, DHCP, DNS (including filtering), wakeonlan proxy
RPI0W - VPN gateway providing secure WIFI AP and network router, some kind of internet BOX when on the move ;)

kasijus
Posts: 2
Joined: Sun Jul 15, 2018 5:43 pm

Re: Cannot boot anymore, root account locked

Mon Jul 16, 2018 7:51 pm

Hi,

Thanks for your answer.

Yes, the system is running from SD. I managed to recover it. My main issue was that I couldn't write to fstab until I did 'mount -o remount,rw /dev/sda1 /'.

After that, my fstab was writable, I was able to comment out the line that was mounting the corrupted HDD, and I was able to boot the Pi normally after that. Then I fixed the HDD using fsck.

But I will consider your advice.

mutrised
Posts: 44
Joined: Thu Nov 08, 2012 12:41 am
Location: France

Re: Cannot boot anymore, root account locked

Mon Jul 16, 2018 7:55 pm

As far I understood how linux journalised file system are supposed to work, you should always be able to recover from file corruption.

But I consider seting up read only file system worth the pain to recover your system 2/3 a year as I was doing before...

Happy you fixed it =)
RPI2B 7/24 - web, NAS/media, Owncloud and more
RPI0 7/24 - VPN, DHCP, DNS (including filtering), wakeonlan proxy
RPI0W - VPN gateway providing secure WIFI AP and network router, some kind of internet BOX when on the move ;)

SuperBoby
Posts: 11
Joined: Sat Jul 14, 2018 5:05 pm
Location: France

Re: Cannot boot anymore, root account locked

Mon Jul 16, 2018 8:09 pm

Hi guys, I am very sorry about this, but since you are talking about your signature mutrised, I was curious about your Pi0W setup. Do you have any link to share about it ?

« RPI0W - VPN gateway providing secure WIFI AP and network router, some kind of internet BOX when on the move ;) »

I would have asked you through PM but apparently this function no longer exists on the forum...

Return to “Troubleshooting”