User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Power supply failed? now in emergency mode - headless SOLVED

Mon Aug 20, 2018 6:07 pm

I have been running RPi3+ headless for about 6 months continuously using a PiHut power supply. It has a separately powered cooling fan and very large heatsink.

An SSD was connected via USB to store data and only a torrents and 'John' a password cracking program were installed over the basic install which was done headless. The SSD had a separate power supply.

I had a network problem today which seemed to affect the whole network and finally suspected the pi power supply. To get any control I had to shut the pi down by pulling the plug.

The symptoms were the large pixel flashing on and off without booting. (I forgot to notice the icon top left corner). Changing the power supply effected a boot with errors:

"You are in emergency mode. After logging in type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, Systemctl default" or D to try again to boot into default mode.

Cannot open access to console, the root account is locked. See su log(8) man page for more details.

Press Enter to continue."

I have inserted a wireless mouse/keyboard dongle but neither is recognised.

I do not normally have the HDMI lead connected and am unable to access the pi via SSH

Using another SSD card I installed Raspbian following headless help:

https://howtoraspberrypi.com/how-to-ra ... ss-setup/

But again was unable to access the pi via SSH (I had made the SSH file in /boot). (No route)

Any pointers where to start would be appreciated especially as I cannot confirm whether the sd card is corrupt or there is a problem with the pi itself.
Last edited by makem on Tue Aug 21, 2018 1:11 pm, edited 1 time in total.

Roken
Posts: 232
Joined: Sun Dec 31, 2017 4:35 pm

Re: Power supply failed? now in emergency mode - headless

Mon Aug 20, 2018 7:44 pm

If you have access to a PC, boot the PC with a linux livecd, and run fsck on both the sdcard and the external drive. Allow it to repair any errors. Once done, reassemble the Pi, and re-try.
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

User avatar
DougieLawson
Posts: 34124
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Power supply failed? now in emergency mode - headless

Mon Aug 20, 2018 7:51 pm

Since you have a Raspberry that's capable of running Linux (power supply permitting) then grab a new SDCard. Build a copy of plain Raspbian 2018-06-27 on it. Boot that. Mount the broken SDCard in a USB reader. Use the new Raspbian system to repair the borken one.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Mon Aug 20, 2018 8:27 pm

DougieLawson wrote:
Mon Aug 20, 2018 7:51 pm
Since you have a Raspberry that's capable of running Linux (power supply permitting) then grab a new SDCard. Build a copy of plain Raspbian 2018-06-27 on it. Boot that. Mount the broken SDCard in a USB reader. Use the new Raspbian system to repair the borken one.
Ah, I like that idea. But how to effect the repair? That is the question!

I have already built a new copy of Raspbian AND now been able to get it working headless.

EDIT: From RaTTuS in Corrupt SD card -- guide::

sudo fdisk -l
does this show the sd card?
then mount the relevant drives i.e.
sudo mount /dec/sda4 /mnt (should read /dev/sda4?)
ls -l /mnt

Really might fix the problem?

My usb sd card reader needs replacing so will look again tomorrow.
Last edited by makem on Tue Aug 21, 2018 12:23 am, edited 2 times in total.

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Mon Aug 20, 2018 8:31 pm

Roken wrote:
Mon Aug 20, 2018 7:44 pm
If you have access to a PC, boot the PC with a linux livecd, and run fsck on both the sdcard and the external drive. Allow it to repair any errors. Once done, reassemble the Pi, and re-try.
I use xubuntu solely so would assume I can run fsck from there rather than a live usb which I already have.

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Mon Aug 20, 2018 8:47 pm

Code: Select all

[email protected]:~$ sudo fdisk -l
[sudo] password for makem: 
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9EFB600C-A9FF-4A05-863B-84E383D8B32F

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    487423    485376   237M EFI System
/dev/sda2     487424  40486911  39999488  19.1G Linux filesystem
/dev/sda3   40486912 464422911 423936000 202.2G Linux filesystem
/dev/sda4  464422912 468860927   4438016   2.1G Linux swap


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: C79D48CD-4D4D-4DAA-A116-0A83EBA9B7EC

Device          Start        End    Sectors   Size Type
/dev/sdb1        2048    2099199    2097152     1G Windows recovery environment
/dev/sdb2     2099200    2303999     204800   100M EFI System
/dev/sdb3     2304000    2566143     262144   128M Microsoft reserved
/dev/sdb4     2566144  204298724  201732581  96.2G Microsoft basic data
/dev/sdb5   204300288 1902323711 1698023424 809.7G Microsoft basic data
/dev/sdb6  1902323712 1953523711   51200000  24.4G Linux filesystem


Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x46aa400e

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    93802    85611 41.8M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      98304 62333951 62235648 29.7G 83 Linux
[email protected]:~$ umount /dev/mmcblk0p1
[email protected]:~$ sudo fsck /dev/mmcblk0p1
fsck from util-linux 2.27.1
fsck.fat 3.0.28 (2015-05-16)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
Perform changes ? (y/n) y
/dev/mmcblk0p1: 164 files, 44279/84261 clusters
[email protected]:~$ umount /dev/mmcblk0p2
[email protected]:~$ sudo fsck /dev/mmcblk0p2
fsck from util-linux 2.27.1
e2fsck 1.42.13 (17-May-2015)
rootfs: clean, 160102/1926848 files, 1794372/7779456 blocks
[email protected]:~$

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Mon Aug 20, 2018 10:22 pm

Roken wrote:
Mon Aug 20, 2018 7:44 pm
If you have access to a PC, boot the PC with a linux livecd, and run fsck on both the sdcard and the external drive. Allow it to repair any errors. Once done, reassemble the Pi, and re-try.
Did as you suggest but get same error and unable to connect via SSH.

User avatar
rpdom
Posts: 12863
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Power supply failed? now in emergency mode - headless

Tue Aug 21, 2018 5:09 am

If you haven't sorted this out by the end of the week, drop me an email. I will be at the usual library on Saturday (10am-4pm) and can bring my laptop, USB card reader and other bits and if you bring your Pi we can get this fixed.

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Tue Aug 21, 2018 9:35 am

rpdom wrote:
Tue Aug 21, 2018 5:09 am
If you haven't sorted this out by the end of the week, drop me an email. I will be at the usual library on Saturday (10am-4pm) and can bring my laptop, USB card reader and other bits and if you bring your Pi we can get this fixed.
Thank you Dom.

I am very reluctant to make any changes to the defective sd card because it contains the status of John (I think) which I would like to continue. The status should be in /home (I think), which is a separate partition.

What I propose to do today is to copy the contents of /boot from the fresh spare sd card to my linux laptop. Then clone the defective sd card to the spare sd card and replace /boot, copy the kernal modules and at this stage not sure whether to keep the /boot/config.txt.

This suggestion is from:

https://raspberrypi.stackexchange.com/ ... partition

That will avoid having to buy another spare sd card and if it does not work I will be seeing you on Saturday!

Many thanks again for the assistance offer.

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Tue Aug 21, 2018 12:12 pm

makem wrote:
Tue Aug 21, 2018 9:35 am

What I propose to do today is to copy the contents of /boot from the fresh spare sd card to my linux laptop. Then clone the defective sd card to the spare sd card and replace /boot, copy the kernal modules and at this stage not sure whether to keep the /boot/config.txt.

This suggestion is from:

https://raspberrypi.stackexchange.com/ ... partition

That will avoid having to buy another spare sd card and if it does not work I will be seeing you on Saturday!

Many thanks again for the assistance offer.
Well, it's just not my day!

Both sd cards are supposed to be same size but the spare one is 800MB smaller so cannot clone. I can't justify buying another spare sd card just yet.

fruitoftheloom
Posts: 17603
Joined: Tue Mar 25, 2014 12:40 pm

Re: Power supply failed? now in emergency mode - headless

Tue Aug 21, 2018 12:59 pm

makem wrote:
Tue Aug 21, 2018 12:12 pm
makem wrote:
Tue Aug 21, 2018 9:35 am

What I propose to do today is to copy the contents of /boot from the fresh spare sd card to my linux laptop. Then clone the defective sd card to the spare sd card and replace /boot, copy the kernal modules and at this stage not sure whether to keep the /boot/config.txt.

This suggestion is from:

https://raspberrypi.stackexchange.com/ ... partition

That will avoid having to buy another spare sd card and if it does not work I will be seeing you on Saturday!

Many thanks again for the assistance offer.
Well, it's just not my day!

Both sd cards are supposed to be same size but the spare one is 800MB smaller so cannot clone. I can't justify buying another spare sd card just yet.

Raspbian Stretch with Desktop has built in SD Card Copier, so a fresh install and a couple of USB SDHC Card Readers should suffice....
Adieu

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless

Tue Aug 21, 2018 1:10 pm

Fixed!

How?

I used sudo fsck -y /dev/sdc1

Result said both partitions were clean and when I booted the pi it worked!

Was it the -y switch? Was it the new usb card reader I bought today instead of using the sd slot in my xubuntu laptop?

Don't know but am a happy bunny :D

fruitoftheloom
Posts: 17603
Joined: Tue Mar 25, 2014 12:40 pm

Re: Power supply failed? now in emergency mode - headless

Tue Aug 21, 2018 1:34 pm

makem wrote:
Tue Aug 21, 2018 1:10 pm
Fixed!

How?

I used sudo fsck -y /dev/sdc1

Result said both partitions were clean and when I booted the pi it worked!

Was it the -y switch? Was it the new usb card reader I bought today instead of using the sd slot in my xubuntu laptop?

Don't know but am a happy bunny :D

The SD Card Reader in your Laptop is it SDHC Compliant ??

https://en.wikipedia.org/wiki/Secure_Digital#SDHC
Adieu

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless SOLVED

Tue Aug 21, 2018 2:26 pm

Satellite P50-C
Model: P50-C-12Z

1 × SD™ card slot (SD™, SDHC™, SDXC™ supporting UHS-I, MMC)

So, "Yes".

Roken
Posts: 232
Joined: Sun Dec 31, 2017 4:35 pm

Re: Power supply failed? now in emergency mode - headless SOLVED

Tue Aug 21, 2018 8:22 pm

Not to gloat, but back to my original reply.

fsck -y allows all repairs.
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

User avatar
makem
Posts: 241
Joined: Tue Jun 18, 2013 9:22 pm

Re: Power supply failed? now in emergency mode - headless SOLVED

Tue Aug 21, 2018 10:34 pm

Roken wrote:
Tue Aug 21, 2018 8:22 pm
Not to gloat, but back to my original reply.

fsck -y allows all repairs.
Yes but you didn't include the '-y' ;)

As I showed, without it, it didn't do a fix.

So, it must have missed whatever needed repairing.

However, I am grateful for your time and input.

Return to “Raspbian”