This is intended as a personal memo, but also public service. It contains info I gathered from multiple sites while resurrecting my own Raspi.
A part of the salvation process happens on the Raspi directly, so you need a screen and keyboard attached to it.
If you edited /etc/fstab and your Raspi won't go beyond the boot sequence while running hot.
- Cut the power. Also let the machine cool down before you touch it.
- Mount the Raspi's boot SD card in a Mac/PC. (Do NOT format it!)
It should be mounted as
boot(/Volumes/booton my Mac) - Edit
boot/commandline.txtas described in detail below. Save (unmountboot) and put the SDcard back in the cooled down Raspi. - Switch on the Raspi. Wait for it to boot up to a shell
- Try editing
/etc/fstabwithsudo nano /etc/fstab. If it doesn't show any warning that the file is READ ONLY, great! Read the part about editing/etc/fstabbelow. Else, continue reading below. - Remount
/as read-write. See the section below for details. - Edit
/etc/fstab(see above). If should be writable now. If not, I'm sorry, but I can't help you. Maybe try remounting again? - Reboot
- Shut the Raspi down using
sudo shutdown -h now. - Put the Raspi's SDcard back in your Mac/PC and edit
cmdline.txtagain to undo your previous changes. - Put the Raspi's SDcard back into the Raspi and switch on. Fingers crossed that the boot sequences finishes without issues.
Good luck!
When you first open cmdline.txt, it should read something like this single line below:
console=serial0,115200 console=tty1 root=PARTUUID=467086ff-02 rootfstype=ext4 fsck.repair=yes rootwait
You need to add init=/bin/sh at the end of this line like below.
console=serial0,115200 console=tty1 root=PARTUUID=467086ff-02 rootfstype=ext4 fsck.repair=yes rootwait init=/bin/sh
Similarly, when undoing the changes, you need to just remove the init=/bin/sh part.
This one can be tricky, as there are several possible commands.
Don't despair if one of the given commands doesn't work, and just try the next one until it works.
Also try adding sudo in front of it.
mount -o remount,rw /mount -o remount,rw / –target /If you get an error like Can't find PARTUUID=eb55478c-02:
sudo mount -o remount,rw /dev/mmcblk0p2 /Also, I've found the above one to always work for me.
When opening /etc/fstab you should see a number of entries like below.
proc /proc proc defaults 0 0
PARTUUID=467086ff-01 /boot vfat defaults,flush 0 2
PARTUUID=467086ff-02 / ext4 defaults,noatime 0 1
UUID=10f1b8d9-6166-4dee-9f6f-bf71aa56379a /mnt/timemachine ext4 sync,noexec,nodev,noatime,nodiratime,0 0
UUID=409c8a4c-0629-4fde-b049-82eff80fe308 /mnt/dataserver ext4 sync,noexec,nodev,noatime,nodiratime,0,0
#
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
In my case, it's the last 2 entries causing the boot issue, so we just comment them out for now with #.
proc /proc proc defaults 0 0
PARTUUID=467086ff-01 /boot vfat defaults,flush 0 2
PARTUUID=467086ff-02 / ext4 defaults,noatime 0 1
#UUID=10f1b8d9-6166-4dee-9f6f-bf71aa56379a /mnt/timemachine ext4 sync,noexec,nodev,noatime,nodiratime,0 0
#UUID=409c8a4c-0629-4fde-b049-82eff80fe308 /mnt/dataserver ext4 sync,noexec,nodev,noatime,nodiratime,0,0
It will be easier to edit this file using a remote shell later after getting the Raspi back to booting.