Raspberry Pi is suddnely very slow for 10 minutes

Hello,

I am relatively new to Raspberry Pi but have many years of experience in IT.

I am using a Raspberry Pi 4, Model B with 4Gb RAM to drive a series of LEDS and some other things for a project. It has all been working well. Yesterday when I powered up the Pi is was incredibly slow. I connect via VNC and it could barely paint the screen, Responses to mouse clocks were also very slow. I rebooted and it was the same. Finally I tried to connect via ssh and this seemed to work OK. The I reconnected via VNC and it was back up to normal speed and worked reliably for the rest of the day. This morning it did something similar.

It seemed to me that the processor was being consumed by something, but I have changed nothing. I wondered if anyone has any suggestions please.

John

2 Likes

Hi John,

Welcome to the forum :slight_smile:
Were you able to identify any tasks running on the Pi that seemed to be using an abnormal amount of CPU load?
My first reaction would be to view tasks via the terminal with htop and see if anything looked off there.

2 Likes

Hi John,

Just to add to Trent’s comments, there’s a small chance that whatever is chewing up your Pi’s power is also heating it up (leading to throttling and hence more slowdowns)
vcgencmd measure_temp can be run in the terminal to check your temperature.

What power supply are you using? Undervoltage is common in non-official supplies, and can cause throttling and slowdown in the worst of cases.

I’ve also seen similar symptoms from a dying microSD card, where the device is constantly waiting for the uSD card to respond, but it doesn’t do so in a timely manner. I’d test your Pi with a spare card if you have one, or boot from USB if you don’t.

Keen to get your Pi back in shape!
-James

3 Likes

Thanks - I will have a look. It just seems intermittent.

Another question you may be able to answer. I have a Python program which uses espeak and musicalbeeps. All works fine. When I use crontab to start it at boot time there is no sound?

Regards

John

1 Like

Hi John,

My suspicion is that it is running your script before some audio stack or device is ready to accept it. You might have more luck running it after login.

  • Create a script file, e.g. named my_file.sh , in the /etc/profile.d/ directory.
  • Put #!/bin/bash as the first line.
  • Write whatever command(s) you want to be executed immediately after logging in
  • Mark your file as executable: chmod +x /etc/profile.d/my_file.sh

-James

1 Like

Thanks. I will check the temp. I am using the standard pi 4 power supply. I just tried swapping the SD cards (I have another pi 4) and it still seems to be having trouble, so not the card.

Thanks

John

1 Like

Thanks

John

Hi John,

Good, we can at least rule out the SD card! We’ll help you get to the bottom of this. Let us know once you’ve tried those other commands.

1 Like

The temperature is 44.8

2 Likes

Hi John,

Hmm, seems we can rule that out too. Give us a look at your htop output, keen to see what’s causing this!

-James

1 Like

HI

I have just swapped my two raspberry pi 4’s. I have replaced the one that was playing up with another one using the SD card from the first one. The one that was playing up is mounted on another board. When I removed it I noticed that the mounting poles did not fully align with the holes so the border was under a bit of stress, perhaps bowing the board - not sure how much. When I mounted the replacement one I only used three of the pegs so that it is not under stress.

The result: The project is now all working again, no noticeable delays. The board I removed now seems to be running fine on the bench. Is it possible that the physical stress was causing the problem? I hope I have not permanently damaged the board?

I look forward to your response.

Thanks

John

1 Like

Hi John,

Hardware playing up due to physical strain or accidental bridging of components is far too tricky for me to hazard a guess into. If you were to re-install the original board as the second one is now, do you think the result would change?
Hard to say if there will be lasting effects as we don’t know 100% the cause of the problem.

Thanks for this. That worked with sound - but it started up more than once. it is playing sounds and so that is not so good. I am just thinking if there is way that it can check if it is already running and, if so, not start again?

thanks

John

Thanks. I will have a bit more of play with it. When using the graphical desk top should I expect some delays sometimes - slow screen painting, sometimes typing is delayed a little?

Thanks

John

2 Likes

Hi John,

Depends how you have VNC setup, over the cloud mine typically have a delay of >300ms but connected locally they are a lot closer to real time. The screen isnt updated at the full frame rate that the HDMI would output to save network traffic, this forum topic talks about the windows version: performance - Why is VNC on Windows so slow? - Super User

2 Likes

HI James,

Thanks very much for this. I had to do a little more work. First, it now checks if the program is already running and doesn’t start it again. Second it runs the program in background using an ampersand.

All working!

3 Likes

my op its a power problem change out your supply…
if your booting of a usb device find its serial or um…unit number
lsusb
will tell you
add storage quirks to the cmd file at the start of it… browse storage quirks for the rpi…

1 Like

Thank so m ugh for the help. Since I swapped the boards so far it seems to be working fine. I suspect the board was being stressed physically. We will see!

1 Like

Further to this matter, I started having trouble again. The problem manifests itself as very slow typing and screen painting. I am using VNC on a headless Raspberry pi. I noticed one time when it almost stopped that iot was having trouble connecting to the wifi. I recently installed a new mesh system which does both 2.5 and 5 and has one ssid for these. I just tried to changing to my old 2.4 network and so far it has worked perfectly. Does anyone know if there is a problem with having the same ssid for 2.4 and 5 on a RP - it looked like to was connected to the 5? Also does anyone know if there is a problem with mesh systems?

Hi John, I use an Unifi AP which provides both 2.4 and 5 GHz in each SSID. Don’t have any issues connecting VNC (Pi Zero on 2.4 GHz or Pi4 on 5GHz/wired) or SSH over wifi (2.4GHz Pi Zero) from Pi4 (wired). Mine is not a mesh system though.

May be try playing with channel widths and beam forming. Also check if you have any cordless phones in between or close by to the wifi router. Also, if there is any channel bonding, it might reduce the Tx/Rx rate in the nearby channels.

Also, check if both the Pi and the VNC terminal are connected to 5GHz. If one of them is on 2.4 and the other is on 5 GHz, the communication will be limited to max of 2.4GHz, which will be slower than the usual.

1 Like