1

My Raspberry Pi 3 B is only connected via Ethernet to the network and running a couple of server tasks, among them an HTML web server (nginx PostgreSQL Typo3). This was working perfectly fine for about three months of continuous operation when suddenly the site would no longer respond from any external client (dyndns is set up and the router firewall config wasn't changed). I tried to SSH into the server and simply restarting it a couple of times, but it would be extremely slow. When SSHing (that itself usually took 10 minutes) and doing some basic apt-get update; apt-get upgrade, it would literally take minutes to read the package list, and then even longer to download and install everything. My internet is about 50MB up 20MB down, but the package download speeds are more than 20x slower than on any other Linux machine in the network (including WSL Debian on my Desktop). I couldn't work on the issue for some months and came back to it now. I used the terminal directly via keyboard & monitor, and basic (silly) tasks like man cat take so long I don't even know how long exactly. During boot I also noticed that the network connection (WiFi for now, as I had to move the RPi from its usual location near a switch) takes two minutes to initialize, although my router usually has no issues like this (even though it is an older model).

I am really confused. The internet does not help: If my SD card is slow, it should have been slow from the start. If my internet/local network is slow, other devices would notice that too, which they don't. Yes, the web server never was the fastest thing in the world, with commonly 10-20s of wait time on uncached pages, but at literally tens of minutes (if the browser doesn't time out), something seems to be wrong. I tried to disable wait on network but that shouldn't make a difference to performance after boot, especially to non-networking applications like the aforementioned man. The only applications/scripts I can get to run quickly are neofetch, lolcat and the other welcome screen scripts, uname (also with sudo), echo, ls, cat and sometimes sudo raspi-config (randomly decides to also hang). Which also means that I cannot basically do anything.

Just if you were wondering, there is no GUI on this Raspberry Pi, which in turn should rather make it faster.

Any help would be appreciated, especially because I'd need to copy a bunch of database internals and special files if I wanted to reinstall an image.

2 Answers2

4

It's possible - even likely perhaps - that your SD card is nearing end-of-life.

There are several things you should do:

  1. Make a backup asap. A step-by-step was posted here in a recent answer.

    If your system is "jammed up", and you're unable to run the image-backup utility, it will be quicker/easier to remove the SD card, and "duplicate" it. You'll need to shutdown your RPi, remove the SD card, and use another system for this. There are numerous "how-tos" posted online for Linux, Mac and Windows hosts... if you want a specific recommendation, let us know what OS you want to use. For Linux/Debian, dd is a reasonable approach.

  2. You can run fsck on your SD card to check & repair any issues with the file system. Another step-by-step procedure was posted recently.

  3. You can run a "speed test" on your SD card: A package called agnostics is available through RPi's apt repository:

$ sudo apt-get update
...
$ sudo apt-get upgrade 
...
$ sudo apt-get install agnostics
...

There was an article on the RPi website about agnostics recently.

Seamus
  • 18,728
  • 2
  • 27
  • 57
  • Will try this probably on the weekend, but sounds like a good solution. Yes, the main issue is that I basically can't run anything on the system without it locking up, so thanks for directing me to some cloning instructions. – kleines Filmröllchen Jan 26 '21 at 09:34
  • @kleinesfilmröllchen: Good luck; drop another comment if you hit snags on the cloning. – Seamus Jan 26 '21 at 09:38
  • The copied and fsck-ed filesystem is defective and multiple systemd services fail to execute, including getty and whatever the logon manager is. I'll try re-cloning and not fscking – kleines Filmröllchen Jan 30 '21 at 20:50
  • @kleinesfilmröllchen: Are you writing the *copied & fsck-ed* file system to a fresh, new SD card, or is this the same card you're trying? – Seamus Jan 31 '21 at 23:49
  • It's a "new" SD card that I copy to and fsck in-place. It's not technically new but still functional – kleines Filmröllchen Feb 01 '21 at 20:19
  • @kleinesfilmröllchen: If my answer & `fsck` have helped your issue, then I am very happy about that. But I do want to say that `fsck` is **not** a [panacea](https://en.wikipedia.org/wiki/Panacea) - it will not arrest the ["wearout" mechanism that's at work continuously in flash memory devices](https://www.electronics-notes.com/articles/electronic_components/semiconductor-ic-memory/flash-wear-levelling-reliability-lifetime.php). You may also find [this answer](https://raspberrypi.stackexchange.com/a/73664/83790) informative. Please advise if you have further questions. – Seamus Feb 01 '21 at 21:58
1

Have you checked your logs to make sure you are not getting errors from the SD card? An SD card is (unfortunately) prone to getting damaged when writing to it too much. If you've been sending all of your logs to the local filesystem, it might have simply gotten corrupted. Are you seeing any errors in /var/log/messages?

dwaler
  • 36
  • 5
  • Meant to answer yesterday but got busy with other work. I had some trouble getting the /var/log/messages file to read on other Linux systems because it's a root owned file. I successfully managed to run `sudo chmod a+rwx` on it but have yet to try if I can read it. – kleines Filmröllchen Jan 26 '21 at 09:32
  • 1
    @kleinesfilmröllchen: Changing files permissions in the logs is not the way to do this. Can't you used `sudo`?? – Seamus Jan 26 '21 at 21:44