Edit 1: The freezing just happened and I was able recover from it. Log(syslog) from the freezing until 'now': https://ufile.io/ivred
Edit 2: It seems a bug/problem with GDM3. I'll try Xubuntu.
Edit 3: Now I'm using Xubuntu. The problem still happens, but a lot less often. So.. it is indeed a memory issue.
I'm currently using Ubuntu 18.10 Live CD since my HD died. I did some customizations to my LiveCD mainly towards memory consumption, because I have only 4GB of RAM.
When my free memory goes below 100MB, my pendrive LED starts to blink like crazy and the system freezes letting me time to just get out of GUI interface (Ctrl+Alt+f1...f12) and reboot(Ctrl+Alt+Del) or, sometimes to close Google Chrome with sudo killall chrome
.
So I created a very simple script to clean the system cache and close Google Chrome. Closing Chrome out of the blue like that is fine, since it asks you to recover the tabs when it wasn't closed properly.
The question: It works like a charm 95% of the time. I don't know if my script is too simple or there is another reason for this intermittent freezing since I can't check the log, because of the need of reboot. Is there a more efficient way to do that? Am I doing it wrong?
Obs.: I have another script to clean the cache that runs every 15 minutes. Since I created those scripts I am able to use my LiveCD every day with almost no freezing. Maybe 1 per day.. Before that I had to reboot every 30-40min, because I use the Chrome with several tabs.
My script:
#!/bin/bash
while true ; do
free=`free -m | grep Mem | awk '{print $4}'`
if [ "$free" -gt 0 ]
then
if [ $free -le 120 ]; #When my memory consuptiom goes below 120MB do the commands below.
then
if pgrep -x "chrome" > /dev/null
then
sudo killall -9 chrome
sudo su xubuntu
/usr/bin/google-chrome-stable --password-store=basic --aggressive-cache-discard --aggressive-tab-discard
else
echo "Stopped"
fi
sudo sysctl -w vm.drop_caches=3
sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
fi
fi & sleep 1; done
swapoff -a
. – Ipor Sircer Nov 24 '18 at 17:21--mem-pressure-system-reserved-kb=XXX
,--aggressive-cache-discard
,--aggressive-tab-discard
, etc... 4gb is fairly enough to run chrom[e|ium] nowadays. My chromium nevers eats more than 2.6gb in any conditions (even with 50+ opened tabs). – Ipor Sircer Nov 24 '18 at 18:23