0

I basically softlocked my raspberry pi 4 8gb using ubuntu when I attempted to put a shell file on my taskbar. I used nano to put scrot in an .sh file for easy screenshots, and when I tried to put it on my taskbar, my mouse was locked into a drag and drop mode, where no matter the amount of clicks, nothing would happen. No shortcuts from my keyboard work either. Is there something I can do to turn it off without bricking my micro sd card?

EDIT: At the very least I need to unmount my micro sd card so that there is no chance of bricking.

3 Answers3

2

If the kernel is still running, you can perform a more gentle reboot by holding Alt+SysRq keys and typing "REISUB". The "S" and "U" parts will attempt to do sync and umount on all filesystems, before "B" (for re-boot) takes place.

If the system won't reboot then, you have to pull the plug. Whatever damage your data might receive is already done at this point. Run fsck on all partitions which were mounted (not just the SD card) to minimize the data loss. On most distributions fsck will run automatically after a crash, at least for partitions from /etc/fstab which were not cleanly unmounted.

I have journaling enabled on my SD card and have never actually lost any data (other than files that were being written at the time of the crash of course).

Dmitry Grigoryev
  • 26,688
  • 4
  • 44
  • 133
0

i pulled the plug and it worked, but my worry derived from the fact that the poweroff process includes unmounting all drives connected, and i had also heard that disconnecting while still mounted may corrupt the entire microsd card preventing further use.

  • 1
    It *may* but unless the system is very busy I think the consensus around here is that is *usually* will not. I've been using Pis for 8+ years, dunno how many times I've had to pull a plug, and I can only remember one obvious corruption event from that. So try not to do, but if you need to do it, try and do it when the card isn't being worked heavily (the green ACT led indicates SD card access). The next reboot may take quite a bit longer as the partitions will be scanned if not unmounted properly (and when possible corruption is repaired). – goldilocks Jan 17 '21 at 20:17
0

It is unclear whether your Question is a one-off to recover from a lockup or a general question.

As others have said the risk is low if the Pi is not active, but I choose to be safe.

I include dtoverlay=gpio-shutdown,gpio_pin=21 in config.txt on all my Pi.
This allows me to safely shutdown with a button connected to pins 39,40. Even if I don't use a button you can shutdown with a jumper.

See https://raspberrypi.stackexchange.com/a/117017/8697

Milliways
  • 54,718
  • 26
  • 92
  • 182