0

Well I'm currently developing using pycharm and sencha command in Ubuntu. (as well as a dozen tabs open in chrome). However I notice that quite often my system just "crashes".

What happens is that for 1 second the screens gets really "laggy" (mouse jumps only about 2-3 times in that second). Then the system completely freezes and I notice that my hard drive is working constantly. In this state no key combination tends to work and everything is just frozen until I hard reset my laptop (hold power button).

This tends to happen semi regularly, as in once every few days. Key combinations to open the terminal also quit working during this failure. And I've also tried "waiting" but after around half an hour my laptop was still using the hard disk constantly (I can actually hear it and the light is on).

So how can I fix such a problem? Is there a "safe program" that can always be called to (like the blue screen windows gets to when pressing Ctrl+Alt+Delete in such a situation)? Can I troubleshoot this after it has happened?

Or even better: can I prevent it?

EDIT: on advice in the comments I tried magic sysrq to kill processes (or even reboot the system). However the laptop also fails to react to any such key combination. Also other buildin physical buttons like on the laptop stop working (like put screen to black, increase fan speed and disable wan antenna).

paul23
  • 343
  • That looks like you're running out of RAM, and the system starts dropping processes to HDD. You can prevent it by monitoring amount of free RAM (e.g. you could install an applet with that info on your panel), and it would be the same on Windows. As for "safety" keys-combination — you could enable and use Magic SysRq, to call OOM killer. – Hi-Angel Jul 23 '18 at 18:12
  • 1
  • @Hi-Angel I kind of know already that I'm running out of ram. Though I wonder why this can occur, just from browsing in chrome and leaving tabs open. -- On windows the tabs itself just become irresponsive but the system will stay responsive. (Or at least taskmanager stays responsive while the rest crashes). – paul23 Jul 24 '18 at 11:16
  • @paul23 every chromium tab weights usually around 100-300MiB (depends on what's opened). Since they're made as separate processes, you can actually see how much each takes e.g. in the output of smem -kc "name user pid pss". As for "on Windows they just become unresponsive" — well, I can only assume Chrome itself somehow monitors it there, but somehow not on GNU/Linux. Because Win has definitely the same problem. Near me resides a girl who works with Win10, has low RAM, and likes to open bunch of stuff — and the system locks up same way for her. BTW, you can also try disabling swap file. – Hi-Angel Jul 24 '18 at 11:24
  • @Hi-Angel So I have to "suck it up"? (I've lost quite a few times progress while developing due to no "last minute saving" of my data when ubuntu crashes like this, I kind of went to ubuntu as I heard it could prevent stability issues and the dataloss...). – paul23 Jul 24 '18 at 11:32
  • @paul23 off top of my head, I can suggest upgrading to latest kernel (e.g. ATM latest stable is 4.17.9), because there're ongoing optimizations for swap subsystem. Alternatively, you could try disabling swap altogether (e.g. sudo swapoff -a works till next reboot; you can check it at free's output), and see if OOM killer killing offending processes will work for you. – Hi-Angel Jul 24 '18 at 11:42
  • @paul23 BTW, I just remeber: you could also try using zram module. It basically uses part of RAM as a high-speed swap device with compression, and reportedly helps noticeably for PCs with low amount of memory. I think it's best to couple with latest kernel installation, so you would also profit from swap-subsystem optimizations. – Hi-Angel Jul 27 '18 at 07:05

1 Answers1

0

If your sysrq keys do not work anymore, you are as screwed as you could be. There is no other way out. You could try ssh'ing into the machine, in case the keyboard connection is broken.

For any other situation that is all but that severe I tend to use CTRL-ALT-F1 to bring up a text console. You can use this to login as user or as root (password will not be shown), and you can terminate processes (e.g. killall chromium), or restart services (e.g. sudo systemctl restart gdm). Other key combinations might depend on your desktop environment, but CTRL-ALT-F* should work in almost all GNU/Linux distributions.

Paul Hänsch
  • 3,197
  • @Oh yeah, ctrl+alt+f1 also doesn't bring up anything. I'm really just wondering how a user-level process can bring a kernel level feature "down". And besides that, can I find anywhere a log of such an event? Or debug it in any way? It seems to be happening more and more often, now happening about ever 3-4 hours. – paul23 Jul 24 '18 at 14:10
  • Usually a system can freeze up pretty badly on Out-Of-Memory conditions. Although key actions should still show a result if only after a few minutes. Check your RAM and Swap usage using htop. Try increasing swap, or maybe disabling swap (sudo swapoff -a if it is on a slow medium). Or check if the OOM killer is enabled in /etc/sysctl.conf – Paul Hänsch Jul 24 '18 at 14:18
  • There exist also things like user process and memory quotas, which can prevent a catastrophic system freeze. Although on a single user desktop computer it makes sense for distributions to set them lax by default. – Paul Hänsch Jul 24 '18 at 14:20
  • The disabling of swap seems to work (I guess that's also to be expected, since ubuntu is not installed on my ssd, the only thing that was unexpected is that linux doesn't notice this by itself and stops using the swap if it is too slow). – paul23 Aug 28 '18 at 12:27