Skip to content

Instantly share code, notes, and snippets.

@duk3luk3
Last active May 13, 2018 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duk3luk3/855b0ba01cdf45fe2bbc53fa0b33665b to your computer and use it in GitHub Desktop.
Save duk3luk3/855b0ba01cdf45fe2bbc53fa0b33665b to your computer and use it in GitHub Desktop.
Pacman Recovery on a Raspberry Pi via open-sdcard surgery

Problem:

When booting the RPi3, everything seems normal and the login console appears.

However, entering any login name (e.g. root) and hitting enter leads to the login console going away and reappearing - as if the login name was rejected, the login failure lockout got triggered, or the login process is crashing (which is what's actually happening).

Diagnosis

We shut down the RPi by hitting Ctrl-Alt-Del and removing the power once it is done with the shutdown process (you may be able to perform SysRq-REISUO to perform an emergency sync,unmount,halt instead if you have the Magic SysRq key enabled)

We remove the SD-Card from the RPi and insert it into an SD Card Reader connected to our Arch laptop, and mount the rootfs:

sudo blkid # identify SDCard partitions
export DEV=sdd # replace sdd by SDCard device determined from blkid command's output
sudo mkdir -p /mnt/${DEV}
sudo mount /dev/${DEV}2 /mnt/${DEV}
sudo mount /dev/${DEV}1 /mnt/${DEV}/boot # mount /boot partition

Now we get a root shell chdir'd into the RPi rootfs:

$ sudo -i
# cd /mnt/sdd

And now we can do cool stuff like reading the journal:

journalctl -D var/log/journal/ -b

Or running pacman:

sudo pacman -r . --config etc/pacman.conf -Qkk

Please note the relative paths specified in the above two commands!

Finding the issue

In the journal (see journal command mentioned before) we find this:

May 13 12:13:28 alarmpi systemd-coredump[328]: Process 321 (login) of user 0 dumped core.
                                               
                                               Stack trace of thread 321:
                                               #0  0x0000000076f1cf8c _dl_check_map_versions (ld-linux-armhf.so.3)

This means something is very wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment