PC that won't shut down...
Solved
Hello,
I have an old Lenovo Thinkcentre PC with 1.7 GB of RAM, a 4-core CPU, Linux Mint 19 installed, and upon startup, the RAM usage is about 32%.
While connected to CCM, the RAM usage has already risen to 59%. If I open a second tab to browse another site simultaneously, the Swap starts to be used and increases progressively with the opening of other tabs. All of this is certainly normal.
After a while browsing different sites, the Swap usage can reach 5%, 10%, 20%, or more.
When I close the various tabs to shut down the PC, the RAM usage decreases but the Swap doesn't empty, and the PC doesn't want to shut down normally. I have to turn it off manually.
I suspect that it's the use of Swap that prevents the PC from shutting down normally, because if the Swap is at 0, the PC shuts down!
However, I'm not certain that the cause of the issue is the Swap, as this problem is recent (2 months). Indeed, I have always used this PC while browsing multiple sites at the same time, with perhaps some slowdowns sometimes, but the PC has always shut down normally...
The 4-core CPU seems to be functioning normally.
Does anyone see a solution? Thank you.
Configuration: Linux / Firefox 91.0
I have an old Lenovo Thinkcentre PC with 1.7 GB of RAM, a 4-core CPU, Linux Mint 19 installed, and upon startup, the RAM usage is about 32%.
While connected to CCM, the RAM usage has already risen to 59%. If I open a second tab to browse another site simultaneously, the Swap starts to be used and increases progressively with the opening of other tabs. All of this is certainly normal.
After a while browsing different sites, the Swap usage can reach 5%, 10%, 20%, or more.
When I close the various tabs to shut down the PC, the RAM usage decreases but the Swap doesn't empty, and the PC doesn't want to shut down normally. I have to turn it off manually.
I suspect that it's the use of Swap that prevents the PC from shutting down normally, because if the Swap is at 0, the PC shuts down!
However, I'm not certain that the cause of the issue is the Swap, as this problem is recent (2 months). Indeed, I have always used this PC while browsing multiple sites at the same time, with perhaps some slowdowns sometimes, but the PC has always shut down normally...
The 4-core CPU seems to be functioning normally.
Does anyone see a solution? Thank you.
Configuration: Linux / Firefox 91.0
4 answers
quentin2121
Posted messages
9063
Registration date
Status
Member
Last intervention
Ambassadeur
1 312
Hello,
Is the swap space significant enough at the hard drive storage level, at least 10%? Have you allocated enough space for it?
--
“Take your chance, hold onto your happiness and go towards your risk. By looking at you, they will get used to it.” René Char
Is the swap space significant enough at the hard drive storage level, at least 10%? Have you allocated enough space for it?
--
“Take your chance, hold onto your happiness and go towards your risk. By looking at you, they will get used to it.” René Char
Hello,
If the system easily resorts to swap, it's because by default, swap starts to trigger as soon as 40% of RAM is in use. So nothing unusual. In your case, you just need to raise the swap trigger threshold for it to be used less.
See here:
https://doc.ubuntu-fr.org/swap#ameliorer_l_utilisation_du_fichier_d_echange_swap
Personally, I don't see a connection between the use of swap and the halt blockage. I think there's rather a running task that doesn't stop normally, and as long as it's not completed, the shutdown is stuck.
Try stopping it in command mode by typing
If the system easily resorts to swap, it's because by default, swap starts to trigger as soon as 40% of RAM is in use. So nothing unusual. In your case, you just need to raise the swap trigger threshold for it to be used less.
See here:
https://doc.ubuntu-fr.org/swap#ameliorer_l_utilisation_du_fichier_d_echange_swap
Personally, I don't see a connection between the use of swap and the halt blockage. I think there's rather a running task that doesn't stop normally, and as long as it's not completed, the shutdown is stuck.
Try stopping it in command mode by typing
sudo shutdown nowin the terminal and see if there is any message that appears. Otherwise, you will need to analyze the logs to understand what is happening.
Ok, thanks jns55
Yes, currently I'm only on CCM, using 53% of RAM, 1% swap. So the swap does kick in quite early indeed.
But the problem may not be related to swap usage, as I have always seen it load gradually while browsing multiple sites and the PC has always shut down normally (for years now).
So it’s more likely a task that is running in the background, which I cannot see, as the CPU drops almost to 0 when I close all tabs.
Okay, I will try sudo shutdown now in the terminal and see what happens.
Thanks jns55
Yes, currently I'm only on CCM, using 53% of RAM, 1% swap. So the swap does kick in quite early indeed.
But the problem may not be related to swap usage, as I have always seen it load gradually while browsing multiple sites and the PC has always shut down normally (for years now).
So it’s more likely a task that is running in the background, which I cannot see, as the CPU drops almost to 0 when I close all tabs.
Okay, I will try sudo shutdown now in the terminal and see what happens.
Thanks jns55
Well,
I tried sudo shutdown now in the terminal, but the PC does not turn off ...
When I close all the browser tabs, the CPU drops to 0 (or almost ...), the RAM goes down to about 32% (as much as when the PC starts up), but the swap remains loaded. It only clears when the PC is turned off.
However, if I'm not online, the swap stays at 0 and the PC shuts down normally.
Maybe I need to install more RAM or a lighter distribution than Mint?
It's frustrating because this old PC with little RAM and a 4-core CPU is fast and works very well ...
I tried sudo shutdown now in the terminal, but the PC does not turn off ...
When I close all the browser tabs, the CPU drops to 0 (or almost ...), the RAM goes down to about 32% (as much as when the PC starts up), but the swap remains loaded. It only clears when the PC is turned off.
However, if I'm not online, the swap stays at 0 and the PC shuts down normally.
Maybe I need to install more RAM or a lighter distribution than Mint?
It's frustrating because this old PC with little RAM and a 4-core CPU is fast and works very well ...
The fact that the swap remains loaded doesn't seem abnormal to me: why empty the swap if we don't need it?
Try doing the same thing from a live session with your installation live USB to see if the behavior is the same.
You can also temporarily disable the graphical boot/shutdown (plymouth) by editing grub at boot (press E when the grub menu is displayed) and removing the words quiet and splash from the boot options.
Normally, the boot and shutdown messages should be displayed, and you will be able to see on which line the shutdown is stalling.
Try doing the same thing from a live session with your installation live USB to see if the behavior is the same.
You can also temporarily disable the graphical boot/shutdown (plymouth) by editing grub at boot (press E when the grub menu is displayed) and removing the words quiet and splash from the boot options.
Normally, the boot and shutdown messages should be displayed, and you will be able to see on which line the shutdown is stalling.
You can already modify the swap trigger threshold.
By default, it is set to 40, which means that the system starts using it as soon as 40% of the RAM is used. By setting it to 90 or 95, the swap should only be triggered as a last resort.
https://doc.ubuntu-fr.org/swap#ameliorer_l_utilisation_du_fichier_d_echange_swap
You can also use a kernel option that is not enabled by default: Zram, which compresses data in RAM.
https://doc.ubuntu-fr.org/zram
It's true that adding more RAM is the best solution, but it's not always possible.
By default, it is set to 40, which means that the system starts using it as soon as 40% of the RAM is used. By setting it to 90 or 95, the swap should only be triggered as a last resort.
https://doc.ubuntu-fr.org/swap#ameliorer_l_utilisation_du_fichier_d_echange_swap
You can also use a kernel option that is not enabled by default: Zram, which compresses data in RAM.
https://doc.ubuntu-fr.org/zram
It's true that adding more RAM is the best solution, but it's not always possible.
Hello,
When you shut down your PC, do you see lines indicating the services that are being shut down? If so, what is the last line displayed?
If these messages do not show up, try using a key combination (ctrl alt f1, ctrl alt f2 ... ctrl alt f10) to see if anything appears. Otherwise, try again but by disabling the graphical mode by logging in text mode (ctrl alt f1) and running the following commands:
It might be interesting to check the logs (
Good luck
When you shut down your PC, do you see lines indicating the services that are being shut down? If so, what is the last line displayed?
If these messages do not show up, try using a key combination (ctrl alt f1, ctrl alt f2 ... ctrl alt f10) to see if anything appears. Otherwise, try again but by disabling the graphical mode by logging in text mode (ctrl alt f1) and running the following commands:
sudo /etc/init.d/*dm stop
sudo shutdown now
It might be interesting to check the logs (
sudo gedit /var/log/messages) to see if there is a suspicious error message at the times when you try to shut down your PC, which could help clarify things...
Good luck
I would like to switch to Text Mode to see the services that shut down when the PC is turned off, and to see the last line displayed (which I assume is the one that's blocking ...)
It's one of the consoles in text mode (probably ctrl alt f1, maybe ctrl alt f10)
I would then like to be able to return to Graphical Mode (apparently it's with ctrl alt F8?)
No, it's usually ctrl alt f7.
Am I in the right place? I feel like I'm not ...
Did you launch
What does
Good luck.
It's one of the consoles in text mode (probably ctrl alt f1, maybe ctrl alt f10)
I would then like to be able to return to Graphical Mode (apparently it's with ctrl alt F8?)
No, it's usually ctrl alt f7.
Am I in the right place? I feel like I'm not ...
Did you launch
sudo nano /var/log/messages?
What does
ls -lsh /var/log/messagesgive you?
Good luck.
1)2) [...]
Actually, the file /var/log/messages is empty, which is strange. It's probably
I can't involve CCM with just my problem...
As you wish, but it honestly doesn't bother us to "mobilize"; otherwise we wouldn't be responding :p
In any case, if the problem is bothering you but you don't want to get too technical, a simple solution could be just to reinstall your Linux (save your important documents to another medium).
Good luck
Actually, the file /var/log/messages is empty, which is strange. It's probably
/etc/rsyslog.confthat is misconfigured...
I can't involve CCM with just my problem...
As you wish, but it honestly doesn't bother us to "mobilize"; otherwise we wouldn't be responding :p
In any case, if the problem is bothering you but you don't want to get too technical, a simple solution could be just to reinstall your Linux (save your important documents to another medium).
Good luck
Hello,
The fact that your PC is swapping is not unusual, but if it happens frequently, it does give an impression of slowness.
Swapping is triggered when you run low on RAM, and your PC doesn't have much of it, so that's not very surprising. There are two solutions for this: either you buy a RAM stick, or you switch to lighter software and a lighter graphical environment (for example,
Next, if you want to know why your PC is swapping, you need to look at what is consuming memory. You probably have something like a task manager (likely
I don't really see what the percentages you mention refer to. Generally, it's the system that decides whether or not it needs to resort to swap, and personally, I've never adjusted anything in particular. The only important parameter is the size of the swap (traditionally, twice the size of your RAM, without exceeding 4GiB, as beyond that it's unnecessary).
As for the technique: I try to explain the main points of the commands I type out, but know that under Linux, all commands are documented. So if you're wondering what the command
I wish you good luck with your future Linux installation. Don't hesitate to opt for a rather lightweight distribution (maybe
Good luck!
The fact that your PC is swapping is not unusual, but if it happens frequently, it does give an impression of slowness.
Swapping is triggered when you run low on RAM, and your PC doesn't have much of it, so that's not very surprising. There are two solutions for this: either you buy a RAM stick, or you switch to lighter software and a lighter graphical environment (for example,
lightwminstead of
gnome). You can also see if it runs better with another browser (personally, I use
chromium, which I find lighter and better than
firefox).
Next, if you want to know why your PC is swapping, you need to look at what is consuming memory. You probably have something like a task manager (likely
gnome-system-monitor?) that would help you better understand which programs are using too much memory.
I don't really see what the percentages you mention refer to. Generally, it's the system that decides whether or not it needs to resort to swap, and personally, I've never adjusted anything in particular. The only important parameter is the size of the swap (traditionally, twice the size of your RAM, without exceeding 4GiB, as beyond that it's unnecessary).
As for the technique: I try to explain the main points of the commands I type out, but know that under Linux, all commands are documented. So if you're wondering what the command
lsdoes, you can type
man ls(and you will get the meanings of the different options). Also, be aware that on forums, people often guide others through the command lines (although it's often possible to manage through the graphical interface) because it allows copying and pasting the results, bypassing the graphical interface used. It's a bit like learning a new language; at first, you learn the basic commands and gradually enrich your vocabulary (and it takes years before being "fluent").
I wish you good luck with your future Linux installation. Don't hesitate to opt for a rather lightweight distribution (maybe
xubuntu?) if the problems persist.
Good luck!
Hello,
back here for the same problem: when the Swap loads during browsing, the PC no longer shuts down normally; I have to do it manually.
As mentioned above, I added 2 GB of RAM to this PC (now there are 4 GB of RAM), and I also raised the Swap activation threshold to 70% (cat /proc/sys/vm/swappiness = 30).
It is true that the Swap triggers a bit later now, but in any case, well before 70% RAM usage! It triggers at 50%. And from the moment the Swap is loaded (2% or 5% ...), the PC takes a long time to shut down or doesn’t shut down at all using the normal procedure. I have to do it manually.
So the problem I described here in September 2021 remains essentially the same. And it's very annoying because this PC is a bit old but super fast (4 cores).
sudo shutdown now in the terminal does nothing. The PC does not shut down.
So, as discussed earlier with jns55, " I think there is a running task that does not stop normally, and as long as it is not finished, the shutdown is blocked ".
What to do? Thank you.
In fact, I don't understand what's going on: right now I have 7 tabs open, so I'm on 7 different sites, the Swap started at 50% RAM usage, and it's loading very little! Barely 1 MB.
Whereas usually, if I open more than 2 tabs (or even with just 2 tabs open), the Swap, for example, loads 250 MB and the PC no longer shuts down normally...
So there is suddenly an improvement today! Maybe it's due to the updates performed 2 hours ago (Linux kernel and others ...)?
I don't know...
back here for the same problem: when the Swap loads during browsing, the PC no longer shuts down normally; I have to do it manually.
As mentioned above, I added 2 GB of RAM to this PC (now there are 4 GB of RAM), and I also raised the Swap activation threshold to 70% (cat /proc/sys/vm/swappiness = 30).
It is true that the Swap triggers a bit later now, but in any case, well before 70% RAM usage! It triggers at 50%. And from the moment the Swap is loaded (2% or 5% ...), the PC takes a long time to shut down or doesn’t shut down at all using the normal procedure. I have to do it manually.
So the problem I described here in September 2021 remains essentially the same. And it's very annoying because this PC is a bit old but super fast (4 cores).
sudo shutdown now in the terminal does nothing. The PC does not shut down.
So, as discussed earlier with jns55, " I think there is a running task that does not stop normally, and as long as it is not finished, the shutdown is blocked ".
What to do? Thank you.
In fact, I don't understand what's going on: right now I have 7 tabs open, so I'm on 7 different sites, the Swap started at 50% RAM usage, and it's loading very little! Barely 1 MB.
Whereas usually, if I open more than 2 tabs (or even with just 2 tabs open), the Swap, for example, loads 250 MB and the PC no longer shuts down normally...
So there is suddenly an improvement today! Maybe it's due to the updates performed 2 hours ago (Linux kernel and others ...)?
I don't know...
I think, as jns55 mentioned earlier, that "there is a task running, which prevents the PC from shutting down".
Because before, this PC always worked very well for years with 2 GB of RAM (1.7 GB usable). It always shut down normally and quickly. That is no longer the case since September 2021... Something has happened to this PC...
Because before, this PC always worked very well for years with 2 GB of RAM (1.7 GB usable). It always shut down normally and quickly. That is no longer the case since September 2021... Something has happened to this PC...
The hard drive is 264 GB and the Swap is 2 GB.
The Swap volume is created automatically at the installation of Mint 19.
I'm going to try to do that in the sheet music, without making any mistakes if possible ... ! :)