0

My Lubuntu is wirking exscellent, even when I open Opera, but in a while, may be 30 mins, may be earlier it becomes stucked completely, mouse isn't moving and I can't even open a terminal Alt+Ctrl+F2 sometimes. I don't see any logic in that, because after that I reboot the computer and opera and libreoffice work normally. Also when the computer is running slowly the fan begin to work hard, so some process is on, but I cant catch it. I swithched off the autoupdate. But nothing helps. What could be the preferences for Linux to avoid this?

free -h:

             total        occupied        free      total  buf./time.   available
Memory       2,8Gi       1,7Gi       160Mi       198Mi       956Mi       718Mi
Swap:          0B          0B          0B

vm.swappiness=60

top:

op - 23:26:15 up  7:10,  1 user,  load average: 0,75, 1,19, 1,39
Tasks: 193 total,   1 running, 192 sleeping,   0 stopped,   0 zombie
%Cpu(s): 22,6 us,  8,0 sy,  0,0 ni, 67,6 id,  1,7 wa,  0,0 hi,  0,0 si,  0,0 st
МиБ Mem :   2833,9 total,    152,5 free,   1721,7 used,    959,7 buff/cache
МиБ Swap:      0,0 total,      0,0 free,      0,0 used.    714,9 avail Mem
PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND  

53780 hydronik 20 0 350188 90924 61388 S 32,9 3,1 22:14.48 code
53805 hydronik 20 0 900604 184116 44600 S 12,6 6,3 12:30.27 code
689 root 20 0 802932 98824 46576 S 10,3 3,4 8:27.60 Xorg
111501 hydronik 20 0 592112 56236 45176 S 3,0 1,9 0:02.11 qterminal
87267 hydronik 20 0 599424 57004 44500 S 2,7 2,0 0:44.77 qps
130268 hydronik 20 0 11924 3664 3144 R 0,7 0,1 0:00.12 top
387 root 20 0 8296 5040 1908 S 0,3 0,2 0:05.00 haveged
892 hydronik 20 0 267836 15692 11260 S 0,3 0,5 0:01.55 lxqt-session
991 hydronik 20 0 977844 75424 25072 S 0,3 2,6 0:18.73 lxqt-panel
1180 hydronik 20 0 283588 20292 13556 S 0,3 0,7 0:01.10 lxqt-powermanag
54130 hydronik 20 0 11,7g 151724 35180 S 0,3 5,2 3:25.64 code
81541 hydronik 20 0 675244 37900 26532 S 0,3 1,3 0:04.07 featherpad
111230 root 20 0 0 0 0 I 0,3 0,0 0:00.49 kworker/u4:8-phy0
111522 hydronik 20 0 536236 169896 120564 S 0,3 5,9 0:10.76 opera
1 root 20 0 167572 8320 5304 S 0,0 0,3 0:02.09 systemd
2 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kthreadd
3 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 rcu_par_gp
6 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 kworker/0:0H-kblockd
8 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 mm_percpu_wq
9 root 20 0 0 0 0 S 0,0 0,0 0:00.89 ksoftirqd/0
10 root 20 0 0 0 0 I 0,0 0,0 0:05.55 rcu_sched
11 root rt 0 0 0 0 S 0,0 0,0 0:00.20 migration/0

/etc/fstab: static file system information.

Use 'blkid' to print the universally unique identifier for a device;

this may

be used with UUID= as a more robust way to name devices that works

even if

disks are added and removed. See fstab(5).

<file system> <mount point> <type> <options> <dump>

<pass> UUID=b2d3ce06-03b1-4251-adbf-bd143dd8a213 / ext4 defaults 0 1 /swapfile none swap sw 0 0

  • Keep system monitor opened when you use Opera or Libreoffice. Keep checking if any process consumes a high amount of memory. – Archisman Panigrahi Sep 10 '20 at 14:41
  • Edit your question and show me free -h and sysctl vm.swappiness and top. Start comments to me with @heynnema or I'll miss them. – heynnema Sep 10 '20 at 14:55
  • @heynnema, here you are – Nikolay Yasinskiy Sep 10 '20 at 20:28
  • Your problem is you have no swap. Edit your question again and show me grep -i swap /etc/fstab. Also please show me the complete top output. Thanks. – heynnema Sep 10 '20 at 20:33
  • After answering my previous comment, please see my initial answer, and if it solves the problem(s), please remember to accept it by clicking on the checkmark icon that appears just to the left of my answer. Thanks! – heynnema Sep 10 '20 at 20:46
  • @heynnema, grep -i swap /etc/fstab give nothing.. nothing is written in terminal after that – Nikolay Yasinskiy Sep 10 '20 at 21:00
  • That's good. Go ahead and do my answer. – heynnema Sep 10 '20 at 21:04
  • FYI: Most users of Lubuntu don't want swap, having enough RAM to not require it (and using SSDs that wear out via swap use). I'm like you with limited RAM and benefit from it. Lubuntu 18.04 LTS and earlier defaulted to using swap by default, it's manual on later/modern releases, as it's now what most users want. – guiverc Sep 10 '20 at 21:16
  • @guiverc With only 3G RAM, you do want/need swap. ALL computers need swap. Modern SSDs DON'T wear out because of swap... they now use "wear leveling" to prevent that. You contradict yourself... as your first line says "most users don't want swap"... and your last line says "it's now what most users want". Please clarify. – heynnema Sep 10 '20 at 21:38
  • Most users now want no swap on Lubuntu, and only want swap if they manually add it themselves (ie. wanting no swap the default). (Me I add it, turns out I'm in the minority) – guiverc Sep 10 '20 at 21:40
  • @guiverc But... as you can see... the OPs symptoms are classic swap issues. – heynnema Sep 10 '20 at 21:41
  • @guiverc That's funny... Lubuntu would normally be installed on low RAM machines, and if no swap is indeed the default, users are destined to have these kinds of problems. Are you sure about your comment? – heynnema Sep 10 '20 at 21:44
  • @guiverc, you are right indeed – Nikolay Yasinskiy Sep 10 '20 at 21:46
  • We've had lots of swap issues/queries, esp. on 20.04 because users needed swap; I have posted https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04 many times on many pages just on this site but also others (we're adding a section to our manual but things take time). Most users are on modern hardware it turns out with 16GB ram or more; see https://lubuntu.me/taking-a-new-direction/ FYI: For future readers, I still QA test on 2GB ram for amd64 (1GB boxes for x86/i386); we test on older hardware too but most users have loads of RAM & disliked us using swap – guiverc Sep 10 '20 at 21:49
  • 1
    @guiverc Good article on digitalocean... the only thing I would change would be to change from using fallocate to using dd, as in my example, and change the notation about SSD wear. See man mkswap and man swapon. "Neither is use of  fallocate(1)  on     file  systems  that support preallocated files, such as XFS or ext4, or     on copy-on-write filesystems like btrfs.   It  is  recommended  to  use     dd(1)  and  /dev/zero in these cases." – heynnema Sep 10 '20 at 21:56
  • Thank you @heynnema !! I'll redirect here now anyway (until our manual page is ready anyway); as I prefer linking to an official Ubuntu site (this is Ubuntu affiliated) – guiverc Sep 10 '20 at 22:01

1 Answers1

3

swap

You have no swap. This is what's causing your slow downs and freezes.

free -h

             total        occupied        free      total  buf./time.   available
Memory       2,8Gi       1,7Gi       160Mi       198Mi       956Mi       718Mi
Swap:          0B          0B          0B

Let's create a 4G /swapfile.

Note: Incorrect use of the dd command can cause data loss. Suggest copy/paste.

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile # set proper file protections sudo mkswap /swapfile # init /swapfile sudo swapon /swapfile # turn on swap free -h # confirm 3G RAM and 4G swap

Edit /etc/fstab.

sudo -H gedit /etc/fstab

Confirm/add this line in /etc/fstab... and confirm no other “swap” lines...

/swapfile    none    swap    sw      0   0

reboot                    # reboot and verify operation
heynnema
  • 70,711
  • like that?

    /etc/fstab: static file system information.

    Use 'blkid' to print the universally unique identifier for a device; this may

    be used with UUID= as a more robust way to name devices that works even if

    disks are added and removed. See fstab(5).

    UUID=b2d3ce06-03b1-4251-adbf-bd143dd8a213 / ext4 defaults 0 1 /swapfile none swap sw 0 0

    – Nikolay Yasinskiy Sep 10 '20 at 21:20
  • what UUID should I write before this line? – Nikolay Yasinskiy Sep 10 '20 at 21:24
  • @NikolayYasinskiy It's very difficult to read complicated text when placed into comments. Better to edit your question with that data, and then I can review it for you. No UUID is used with the /swapfile line. Use it exactly as I show it. – heynnema Sep 10 '20 at 21:25
  • previous line contains UUID=b2d3ce06-03b1-4251-adbf-bd143dd8a213 / – Nikolay Yasinskiy Sep 10 '20 at 21:27
  • I make a new line and copy just you have written earlier, right? – Nikolay Yasinskiy Sep 10 '20 at 21:27
  • @NikolayYasinskiy The existing line should have more stuff in it. Yes, newline, and add the /swapfile line. After the edit, put a copy into your question and I'll review it for you. – heynnema Sep 10 '20 at 21:29
  • I edited, please look through it – Nikolay Yasinskiy Sep 10 '20 at 21:33
  • @NikolayYasinskiy Looks fine. Before rebooting, type free -h and confirm 2.8G RAM memory, and 4G swap. Repeat after rebooting. – heynnema Sep 10 '20 at 21:35
  • Thank you! free -h shows correct amounts of memory. You helped me a lot. – Nikolay Yasinskiy Sep 10 '20 at 21:46
  • Please don't suggest others to run graphical applications with sudo. I know that the flag -H in the "sudo -H gedit" stabilises behavior of the HOME var and therefore is supposed to mitigate the most common problems caused by Gedit run as root, but it is a bad practice to give people this advice. Someone will try to use it in a similar use case, but some important unnoticed difference in the use case will (for example) break a bootloader by changing ownership of /etc/grub.d/ – Paolo42 Sep 10 '20 at 23:05
  • @Paolo Recommending a familiar GUI editor like gedit is a lot easier than trying to train a new user about nano/pico/vi/vim/etc. In my case example, sudo -H gedit /etc/fstab should be totally safe, and doesn't effect /etc/grub.d at all. Can you give specific examples for your position? – heynnema Sep 10 '20 at 23:15
  • In this case, as far as I can tell, sudo -H gedit completely safe. Also, I know a guy who started running GUIs as root to know what happens 10 years ago, and nothing bad ever happened. But there is another guy who wanted to change the boot up image and found intructions that said sudo gedit /etc/grub.d/ something. Since it was the first command he ran, it screwed the ownership of this config directories and caused weird problems hard to diagnose. There's nothing wrong about your advice, but there is no resoning about why it is safe particularly in this case, and why the -H flag matters. – Paolo42 Sep 12 '20 at 17:20
  • 1
    @Paolo The guy who used sudo gedit /etc/grub.d/something caused his own problem. Regarding "no resoning about why it is safe particularly in this case", it's because the ~/.*authority don't get changed to root:root ownership and cause a login loop, and other files/directories don't get munged. – heynnema Sep 12 '20 at 17:25