91

I installed 18.04 from 17.04 (passing briefly through 17.10, didn't test it and jumped to 18.04) and I am experiencing a high cpu usage on gnome-shell, it takes almost all available CPU time:

$ top

top - 06:23:01 up 40 min,  3 users,  load average: 3,30, 2,85, 2,09
Tareas: 249 total,   1 ejecutar,  195 hibernar,    0 detener,    0 zombie
%Cpu(s): 24,4 usuario,  3,8 sist,  0,0 adecuado, 71,4 inact,  0,2 en espera,  0,0 hardw int,  0,3 softw int,  0,0 robar tiempo
KiB Mem :  8059572 total,  3489680 libre,  2041520 usado,  2528372 búfer/caché
KiB Intercambio:  9868284 total,  9868284 libre,        0 usado.  5901376 dispon Mem 

PID USUARIO   PR  NI    VIRT    RES    SHR S  %CPU %MEM     HORA+ ORDEN                                                                                                                                  
23946 lealore   20   0 4043344 454724  98808 S  89,1  5,6   5:37.02 gnome-shell                                                                                                                            
24598 root     -51   0       0      0      0 S  30,0  0,0   1:43.28 kidle_inject/2                                                                                                                         
24596 root     -51   0       0      0      0 S  29,8  0,0   1:43.73 kidle_inject/0                                                                                                                         
24597 root     -51   0       0      0      0 S  29,8  0,0   1:43.56 kidle_inject/1                                                                                                                         
24599 root     -51   0       0      0      0 S  29,4  0,0   1:43.16 kidle_inject/3                                                                                                                         
23769 root      20   0  936456 168344  69492 S   3,0  2,1   0:12.22 Xorg                                                                                                                                   
24154 lealore   20   0  657992  25260  19100 S   1,4  0,3   0:04.05 indicator-multi                                                                                                                        
23900 lealore   20   0   51196   5724   3932 S   0,7  0,1   0:02.29 dbus-daemon                                                                                                                            
24659 lealore   20   0  741896  41592  30524 S   0,4  0,5   0:01.01 gnome-terminal-                                                                                                                        
  265 root      19  -1  167208  56740  55524 S   0,2  0,7   0:02.97 systemd-journal                                                                                                                        

I first used nvidia drivers, then I switched to intel graphics, and still the same behavior. It only stops when switching to Unity shell, but for some reason in Unity I have no sound (!). I saw several reports here and on Reddit, but none provided a solution, not even a clue of what it might be happening. I have no other gnome-shell extension than those that comes with a default 18.04 install, if any.

$ inxi -F
System:    Host: lealore Kernel: 4.15.0-20-generic x86_64 bits: 64 Desktop: Gnome 3.28.1
           Distro: Ubuntu 18.04 LTS
Machine:   Device: desktop Mobo: MSI model: H61M-P20 (G3) (MS-7788) v: 1.0 serial: N/A
           BIOS: American Megatrends v: V1.3 date: 01/04/2012
CPU:       Quad core Intel Core i5-2310 (-MCP-) cache: 6144 KB
           clock speeds: max: 3200 MHz 1: 1596 MHz 2: 1596 MHz 3: 1596 MHz 4: 1596 MHz
Graphics:  Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller
           Display Server: x11 (X.Org 1.19.6 ) drivers: vesa (unloaded: modesetting,fbdev)
           Resolution: 1920x1200@0.00hz
           OpenGL: renderer: llvmpipe (LLVM 6.0, 256 bits) version: 3.3 Mesa 18.0.0-rc5
Audio:     Card Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.15.0-20-generic
Network:   Card: Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller driver: r8169
           IF: eth0 state: up speed: 100 Mbps duplex: full mac: 8c:89:a5:a1:ea:02
Drives:    HDD Total Size: 1820.4GB (65.9% used)
           ID-1: /dev/sda model: WDC_WD5000AAKX size: 500.1GB
           ID-2: /dev/sdb model: WDC_WD10EZEX size: 1000.2GB
           ID-3: /dev/sdc model: WDC_WD3200AAJS size: 320.1GB
Partition: ID-1: / size: 23G used: 16G (70%) fs: ext4 dev: /dev/sda1
           ID-2: /home size: 427G used: 217G (54%) fs: ext4 dev: /dev/sda5
           ID-3: swap-1 size: 10.11GB used: 0.00GB (0%) fs: swap dev: /dev/sda6
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 94.0C mobo: 27.8C
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 251 Uptime: 36 min Memory: 2268.7/7870.7MB Client: Shell (bash) inxi: 2.3.56 
Pablo Bianchi
  • 15,657
Leandro
  • 1,045
  • 2
    If you are using GNOME extensions, try disabling them all and check. – pomsky May 15 '18 at 09:54
  • 1
    I am not using gnome extensions, not installed by me in any case, perhaps Ubuntu has some to emulate Unity? – Leandro May 15 '18 at 13:08
  • 1
    I'm seeing the same issue on my Elitebook 820 G3, gnome-shell regularly spikes the CPU -- currenly 201% in top. – retorquere May 15 '18 at 15:44
  • 1
    Same problem on Lenovo Thinkpad x240 .. 16.04 was much more responsive than 18.04. kill -9 seems to help by resetting it, but that's not a viable long-term solution. – Levon May 24 '18 at 10:27
  • 1
    Same on Dell XPS13 – Yuri Astrakhan May 25 '18 at 21:13
  • @Leandro did you manage to find a solution to this? – Per Aug 05 '18 at 18:03
  • Same on Dell XPS13 – Philippe Delteil Sep 11 '18 at 03:56
  • I have this problem when I'm running Ubuntu 18.04 on Hyper-V (Win10-1803). After a while (a few hours) even with no use at all, GS starts using very high CPU. I need to restart GS by then. Weird. – gorlok Oct 03 '18 at 14:43
  • Same on ASUS UX550V (Ubuntu 18.04 with latest updates) – Andriy Plokhotnyuk Nov 24 '18 at 10:49
  • Not sure if it is also related to your issue, if your high cpu usage is also happened accompanied with the mouse moving issue. It maybe the Elan120 high cpu usage related issue, Bug #1778087. After disable the touchpad in the BIOS, there is no Elan120 running in the back and the cpu usage of genome-shell goes down to 0.7-1.0%, if there is nothing moving, and up to 6%, if I moving mouse around. – 家豪許 Feb 02 '19 at 20:25
  • in my case , it happened when i was using Timer on "Clocks" on ubuntu 18.04 – kommradHomer Apr 16 '20 at 11:13
  • same issue here (ubuntu 18.04 with latest updates). ryzen 3700x, 32gb ram and nvidia rtx 2070 super. – Soutzikevich Aug 15 '20 at 09:29
  • Just one of the possible causes: I had a forgotten minicom serial monitor running in the background in one of the several terminal windows. Closing that brought the gnome-shell process to normal CPU consumption levels. – Passiday Nov 13 '22 at 19:04

9 Answers9

48

My problem has been solved by disabling clock seconds. Maybe it has problem with anything with fast refresh rate.

gsettings set org.gnome.desktop.interface clock-show-seconds false
Pablo Bianchi
  • 15,657
  • 4
    +1 for "fast refresh rate". Because it happens with system-monitor plugin too: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1773959 – lashgar Oct 02 '18 at 19:38
  • This solved my problem. It was Byobu status bar (refreshed every 5 seconds). – lashgar Oct 02 '18 at 20:00
  • 5
    I think this correlates more with mouse movement for me... Still verifying. But to turn off the seconds: gsettings set org.gnome.desktop.interface clock-show-seconds false – fattire Oct 29 '18 at 18:26
  • @lashgar Byobu status refresh rate AFAIK is not related to gnome shell and its plugins (like system-monitor). Let us check by telling where did you change byobu status refresh rate. – Pablo Bianchi Jan 14 '19 at 19:49
  • I tried this but it did not change anything. Ubuntu 18.04 gnome-shell still hangs from time to time. My solution is to sudo killall -9 gnome-shell. However, this is not ideal. I would like to find a solution for it. – desmond13 May 26 '20 at 11:53
  • 1
    Disable the time, it fixed it ! and appearantly most voters agree that it is caused by clock seconds – abc Oct 15 '20 at 03:02
  • 1
    Since >30 people agree that this solved their issue: Is there a bug report? – Joe Eifert Feb 19 '21 at 10:46
  • 1
    works on 20.04 thanks! – Aleksandar Pavić Mar 16 '23 at 10:50
39

For what it's worth, I was seeing sluggish behavior after running an application like pyCharm then closing it. In my case, closing pyCharm then clicking the power button looking icon in GNOME 3 in the upper right-hand corner took about seven seconds for the dialog box to come up.

I ended up pressing Alt + F2 then once the command box showed typing r then pressing enter. This restarted GNOME and everything was snappy after that.

Pablo Bianchi
  • 15,657
Frito
  • 491
  • 4
  • 5
  • 4
    Thank you for posting this! It helped me on 20.04, now a single screen update takes ~200ms instead of 1500ms. – akwky May 11 '20 at 15:10
  • 3
    Thanks for the Alt+F2 -> r tip. – AlikElzin-kilaka Jul 17 '20 at 03:21
  • 2
    Awesome, me too, was using pycharm or any intellij idea was tossing my laptop cpu to become high. even after exiting the application. but this is a life saver. Wanted to explain a bit further on Frito's answer. The alt+F2 brings the execute/run command box in gnome. The r command is respawn or repeat command, which in this case relaunches the gnome-shell. You dont loose any of your open applications, which was something I was afraid of. – melchi Aug 25 '20 at 14:42
  • Can anyone explain why this happens? The applications are closed, they shouldn't affect my system anymore. – Joe Eifert Feb 19 '21 at 10:52
  • Oh wow. My system was also very sluggish after running IntelliJ Idea continuously for a couple days, and Alt+F2 -> r worked like a charm! It didn't close any apps just like @melchi said, which is pretty neat. It seems as though for some reason there's residual cpu usage after you run a heavy app like that – kyay10 Mar 01 '21 at 22:15
  • thanks I think this maybe with combination of seconds issue has cleared things up and now all is fast again – javagirl Sep 17 '21 at 16:48
  • Thanks. This helped me. Had an Ubuntu 18.04 that "stalled" for ~1 secs, every ~10 secs. E.g. scrolling though a web-page was a pain. Typing text was a pain. It just froze fairly shortly, but every often. Now it works like a charm. – Per Steffensen Dec 05 '21 at 20:58
  • this fixed the high CPU for me in ubuntu 21.10. thanks! – Daniel Pinyol May 20 '22 at 07:56
18

While animations are nice and eye-catchy, after awhile they might be annoying. To disable animations first install Gnome Tweaks:

sudo apt install gnome-tweaks

Then launch tool either from command line by running

gnome-tweaks

or by using dash and searching for Tweak.

gnome-tweaks was previously known as gnome-tweak-tool. Try that if you are using an older version than 18.04.

On the first tab Appearance there is a toggle switch Animations.

screenshot

That's it!

Source: How to disable animations in Ubuntu 17.10 or 18.04?

Pablo Bianchi
  • 15,657
  • 13
    Did not change gnome-shell cpu usage on my system. – lashgar Oct 02 '18 at 19:40
  • 1
    With gsettings set org.gnome.desktop.interface clock-show-seconds false, I got a message:
    GLib-GIO-Message: 17:22:50.456: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
    

    But with gnome-tweaks, under Top Bar, I turned off showing seconds. This helped reduce the high CPU usage of gnome-shell on my 18.04 system.

    – Nicolas Rouquette Jul 04 '19 at 00:31
  • @NicolasRouquette your comment is helpful, thanks! – Denis Trofimov Dec 05 '19 at 15:43
  • I tried this but it did not change anything. Ubuntu 18.04 gnome-shell still hangs from time to time. My solution is to sudo killall -9 gnome-shell. However, this is not ideal. I would like to find a solution to it. – desmond13 May 26 '20 at 11:54
  • 2
    20.04 here, turning off clock seconds had no long-lasting effect, if any at all. – Hannu Nov 08 '20 at 08:10
18

There appears to be a relevant issue in GNOME with fixes pending. I'm seeing moderately high (30-40%) CPU usage even just moving the mouse around, and these optimizations will supposedly address that:

Unfortunately, as GNOME 3.30.2 is already released, these fixes likely won't make it until 3.32 is released around next March. Given the impact of this issue, I hope the maintainers will consider another hotfix release of the 3.30 series! (@Daniel van Vugt)


Additional references:

Jimmy He
  • 280
  • It still says 3.28 on 18.04 now and I often see a 30% usage... – Alexis Wilke Apr 13 '20 at 15:01
  • Thanks to this answer, I managed to figure this out (kind of). I have a dual screen setup. One monitor is 60Hz and the main monitor is 75Hz refresh rates. When I move the mouse cursor from one monitor to the other, the gnome-shell spikes up CPU usage, (up to 80% on a ryzen 3700X). I will update when I find a fix. I tried setting 60Hz on both monitors, but we'll see. – Soutzikevich Aug 15 '20 at 09:49
  • 1
    Yes, setting the refresh rate of the main monitor to 60hz (was 75Hz+ before) solves the issue partially. On idle mouse cursor, gnome-shell is at 0.3% CPU usage and when moving the cursor around, as much as I tried, it maxed out at 16-17%. This is a HUGE improvement from the previous 80% CPU Usage. Thank you @Jimmy He – Soutzikevich Aug 15 '20 at 09:56
  • 2
    I'm on gnome 3.36 and still had it so not, they haven't solved this :) – javagirl Sep 17 '21 at 16:49
12

What helped me was running ubuntu-drivers autoinstall - seems it may have been the problem with nvidia drivers in my case.

2

Just chiming in to tell my case, Dell XPS 13, Ubuntu 18.04 - it's the wireless mouse!

  • Wireless Bluetooth mouse via USB C adapter: high CPU usage when mouse pointer is moving around (20-30% on all 8 threads!), sometimes gets stuck on it even when mouse activity ceases.
  • Touchpad: no issues!
2

Apparently I had another application for monitoring my system called System Load Indicator which had a few graphs on my status bar.

Disabling it stopped the spike in CPU usage.

Zanna
  • 70,465
Rking
  • 51
1

Running Ubuntu 18.04.1 in VirtualBox 6.0.2 on a Windows 10 Pro 1809 host, gnome-shell CPU usage was vastly improved (especially at rest) by selecting the "VMSVGA" controller in settings. GNOME Shell 3.28.3

0

Just my personal experience, not sure if related: After install ibus-pinyin (IM), the problem is gone

Jianyu
  • 101