2

What are the steps to take, files to examine on a memory card of a.headless Raspberry Pi running Raspbian that (unexpectedly) boots into emergency mode with a standard message:

Welcome to emergency mode! After logging in, type "journalctl -xb" to view system logs, ...

(Connecting a keyboard to the device and running suggested command is an option, but outside of this question.)

4

I believe an aspect of emergency mode is that the root filesystem is mounted read-only, which is a complication...keep reading.

Connecting a keyboard to the device and running suggested command is an option, but outside of this question.

Yes. Jessie uses systemd which includes a new-fangled logger, journald. I think systemd is great, but since journald keeps its log in a binary format, it is a PITA for stuff like this (where you want/need to look for errors in the log without the system running).

There is a way to examine journald files using a journald tool on another system (see Wilf's comment below). Raspbian by default keeps the journald log on disk, but I've always disabled this since it tends to become ginormous (i.e., the binary format is not a space saving one).

This does indicate an advantage to journald, namely it keeps a system log in memory and hence does not require a read-write filesystem be available (making it particularly useful if you are running in emergency mode).

Fortunately, logging to disk can also be done in a human readable format via old school syslog, and Raspbian is default configured that way. The configuration (see /etc/rsyslog.conf) dumps a copy of everything to /var/log/syslog. This includes stuff from the kernel that you can view with dmesg when the system is running.

There is a caveat: If the system failed before the root filesystem was mounted read-write, there will be nothing to read about whatever happened and no indication in the on disk logs that the system even booted.

  • Yeah journald must be new-fangled - 5 years old instead of 30~ :). Anyway, on my fedora box I could scan a journal file quite easily, though it did require reading man journalctl a bit: journalctl -x --file=/home/wilf/Desktop/user-1000@8ea36297ec954dab88242d87574589ad-000000000000081e-00051ff7b3c640e1.journal. So if the SD card can be plugged into a linux machine you can get probably all of the logs (from when it could last write to disk....) – Wilf Oct 24 '15 at 14:06
  • 1
    @Wilf I started disabling them after leaving it as is on a Fedora desktop, but keeping rsyslog since that's what I was used to. One day I went to look for what was filling up my filesystem and found 5+ gigabytes of stuff in /var/log/journal -- the equivalent messages in text were < 20 MB. Ever since then I've just said no thanks (Storage=volatile). BTW you may want to add an answer about that as the OP may prefer it. P.S. rsyslogd ain't 30, more like 10. – goldilocks Oct 24 '15 at 14:23
1

Easy if you have a second Pi. Take the questionable boot microSD card, stick it in an adapter and put it in one of the USB slots in the other Pi.

Then you can fsck, mount and do whatever you want with it.

  • That is not an answer to this question. – techraf Oct 24 '15 at 6:20
  • Easier with a desktop linux machine :) – Wilf Oct 24 '15 at 14:07
  • This is a great tip - super-easy way to fix the issue if you have on to hand. Thank you! – jkp Sep 6 '16 at 19:55
1

Other than examing the SD card on another system there should be a way to connect to the headless Pi. Network is typically down in emergency mode but the remote console via the serial port should be available as it is pretty low-level:

"The Serial Port is a low-level way to send data between the Raspberry Pi and another computer system. ... Connecting to a PC to allow access to the Linux console. This can help to fix problems during boot, or to log in to the Pi if the video and network are not available."

(I understand that the question specifically asks for a way to check the SD card but this approach could still be an alternative.)

1

https://bugs.launchpad.net/ubuntu-mate/+bug/1512248 Check out Morgans last post. Nothing worked for me but this did

  • Could you please include relevant information from the link in your answer otherwise it will be converted to a comment. – Darth Vader Jan 2 '18 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.