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 Answers 2

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.

6
  • 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. Commented Jan 26, 2021 at 9:34
  • @kleinesfilmröllchen: Good luck; drop another comment if you hit snags on the cloning.
    – Seamus
    Commented Jan 26, 2021 at 9: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 Commented Jan 30, 2021 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
    Commented Jan 31, 2021 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 Commented Feb 1, 2021 at 20:19
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?

2
  • 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. Commented Jan 26, 2021 at 9:32
  • 1
    @kleinesfilmröllchen: Changing files permissions in the logs is not the way to do this. Can't you used sudo??
    – Seamus
    Commented Jan 26, 2021 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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