Emergency mode - can I recover? Now solved

Hi,

If anyone can answer any one of the questions I would appreciate it.

Thanks.

I have been using EmonSD with EmonTx happily for just over a year until a mains power failure. It now gives the ‘Welcome to emergency mode!’ message and asks me to enter the root password or Control-D to continue. Control-D just loops giving the same message. After a Google search it seems there is no root password so I think I am stuck. :frowning: Is there a way for me to try and recover so I can run fsck or investigate further? Please note I am a Linux noob.

I started from emonSD-22Dec2015.img but I did a full upgrade about a week ago which seemed to take me up to the latest low-write version of V9.7.7 I did a backup at that point but failed to pull it off the Pi - bother!

The only other Linux device I have is another Pi so I could mount the failed image in a USB adaptor to make changes/additions.

I have been sending all my data to Emoncms.org but I don’t know if I can pull the data back to create a local copy if I started with a fresh emonSD as I can’t find anyone else asking the same question.

In summary:

  1. Is there a root password?
  2. Can I add a root user to get past the failure point - if so how?
  3. Can I pull off my local data from the failed card (assuming that isn’t the file which has been corrupted)?
  4. Can I restore my local data from EmonCMS.org?
  5. Any better (polite!) suggestions?

Many thanks.

Hello @Jonno

There is no root password as the root account is disabled by default in raspbian. I would try mounting the SD card using a USB adaptor on a computer, If you search “Windows ext2” there are quite a few guides on how to mount linux partitions on windows, its been a long time since I last used them however to comment on which program is best.

If you can mount on another PI and can copy the data off it great. The important partition to copy is the 3rd partition as this is the writeable data partition and has all your emoncms data and mysql database.

If the SD card will not mount then running fsck from your second pi is probably your best bet, that may then allow you to continue to use the SD card as normal or perhaps at least allow you to copy the data.

Hi,

Thanks for the suggestions but I am still stuck!

fsck suggestion

I tried running fsck from the second Pi but, after finding you have to use the -a flag to clear the dirty bit due to a bug, all three partions seem to be clean. However it still boots into the emergency mode.

Backup suggestion

I think I found the backup file but it has the wrong name (backup.tar.gz) rather than starting with emoncms as in the instructions. Copying the file across to a new V9.8.0 and then doing a manual import works as far as line 114.
=== Emoncms import starts===
2016-11-08-05:58:26
.
.
Removing compressed backup to save disk space
/home/pi/backup/./emoncms-import.sh line 114 Error cannot find emoncms.sql database to import, command not found

Is the backup I’m trying to restore from too old a version or is there something else I need to do first? I tried copying emoncms.sql to the new unit but it did not help.

Copy 3rd partition suggestion

Do I copy the whole partition across in its entirety or just specific files? If just specific files then which ones? I have tried various options but nothing has worked yet. I also noticed that my failed version has different owner and group for mysql than on any new or older versions I have created. The new ones are mysql/mysql but the old failed version has statd/mosquitto. Is this significant?

Sorry for all the questions but I did say I was a noob and I have been working on this, and learning, for days!

Thanks,

Jon

All now rebuilt, fixed and running again.

Jon