当我锁定我的电脑时,风扇变得非常嘈杂,好像有某种流氓进程

jir*_*lav 5 cpu-load gnome-terminal lock-screen gnome-session

我锁定 PC 的那一刻,风扇变得非常嘈杂,这意味着幕后必须有某种 CPU/GPU 负载。

我告诉自己,我需要知道是什么进程在执行此操作,因此我使用topand制作了这个审计脚本awk,它基本上将*.csv文件名作为输入,并且每隔 10 个最苛刻的进程就会写入其中。

#!/bin/bash

SLEEP_SECS=1

DESTFILE="$1"
if ! [[ "${DESTFILE}" =~ \.csv$ ]]; then
        echo "Please provide name of a destination .csv file!"
        exit 1
fi

if ! test -f "${DESTFILE}"; then
        echo "Seconds;PID;User;% CPU;Process Name" > "${DESTFILE}" || exit $?
fi

while true; do
        top -b -o %CPU -n1 | \
                tail -n +8 | \
                head -10 | \
                awk '{print systime() ";" $1 ";" $2 ";" $9 ";" $12}' \
                >> "${DESTFILE}" || exit $?
        echo -n .
        sleep "${SLEEP_SECS}"
done
Run Code Online (Sandbox Code Playgroud)

所以我启动了脚本并锁定了我的屏幕,粉丝们真的很吵,我等了一会儿,重新登录,粉丝们安静了(好像他们知道我不希望他们在我什么都不做的时候吵闹)使用 PC :D ),我查看了进程,使用此命令获得了超过 50% 的 CPU 使用率:

gawk --use-lc-numeric -F';' '{if($4 > 50) {print $0}}' cpu-audit.csv
Run Code Online (Sandbox Code Playgroud)

这是我发现的:

# The header wasn't there OFC, I'm including it just for the convenience
  Seconds ; PID;  User  ;% CPU;Process Name
1566804437;2496;jirislav;106,7;gnome-shell
1566804438;2496;jirislav;106,7;gnome-shell
1566804439;2496;jirislav;100,0;gnome-shell
1566804440;2496;jirislav;100,0;gnome-shell
1566804442;2496;jirislav;93,8;gnome-shell
1566804443;2496;jirislav;100,0;gnome-shell
1566804444;2496;jirislav;100,0;gnome-shell
1566804445;2496;jirislav;100,0;gnome-shell
1566804446;2496;jirislav;106,7;gnome-shell
1566804449;2496;jirislav;131,2;gnome-shell
1566804449;17446;jirislav;68,8;nautilus
Run Code Online (Sandbox Code Playgroud)

多么令人惊讶,gnome-shell需要这么多资源?什么……?!我什至不使用它,我terminator一直在使用它。好的,所以我使用 运行了终端审计ps,但它没有像以前那样检测到使用情况top,为什么不呢?我什至列出了所有的子进程:

$ while true; do ps fu --ppid 2496 --pid 2496; sleep 1; done
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
jirislav  2496  7.3  2.2 2949284 357176 tty2   Rl+  08:49   3:02 /usr/bin/gnome-shell
jirislav  2522  0.7  0.0 322108  8800 tty2     Sl   08:49   0:18  \_ ibus-daemon --xim --panel disable
jirislav  3239  1.2  0.4 855328 67956 tty2     Sl+  08:49   0:30  \_ /usr/bin/python3 /usr/bin/terminato
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
jirislav  2496  7.3  2.2 2949284 356820 tty2   Sl+  08:49   3:02 /usr/bin/gnome-shell
jirislav  2522  0.7  0.0 322108  8800 tty2     Sl   08:49   0:18  \_ ibus-daemon --xim --panel disable
jirislav  3239  1.2  0.4 855328 67956 tty2     Sl+  08:49   0:30  \_ /usr/bin/python3 /usr/bin/terminato
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
jirislav  2496  7.3  2.2 2949284 356820 tty2   Rl+  08:49   3:03 /usr/bin/gnome-shell
jirislav  2522  0.7  0.0 322108  8800 tty2     Sl   08:49   0:18  \_ ibus-daemon --xim --panel disable
jirislav  3239  1.2  0.4 855328 67956 tty2     Sl+  08:49   0:30  \_ /usr/bin/python3 /usr/bin/terminato
Run Code Online (Sandbox Code Playgroud)

我说够了,让我们卸载gnome-shell,我什至不使用它,为什么不经我同意就让它消耗资源并运行嘈杂的风扇?..然后它击中了我,gnome-shell不能在不卸载的情况下卸载ubuntu-desktop- 让我们搁置为什么存在这种奇怪的依赖的问题,这没有意义(它可以使用任何其他终端) - 我徘徊的事情是 -我的会话被锁定时 Ubuntu 在做什么,我可以关闭它吗?

开会的时候真的很不方便。

笔记:

我知道问题Ubuntu 18.04 gnome-shell high CPU usage,但没有一个建议的解决方案有效(我什至不希望它们起作用,因为问题是我的问题是gnome-shell只有在我锁定 PC 时才使用太多资源 - 而不是当我按照链接问题的描述使用它时)

小智 1

我有同样的问题。看起来这是nVidia 驱动程序的一个错误。我安装了最新的开源 nVidia 驱动程序后,问题就消失了:

sudo apt install nvidia-driver-455
Run Code Online (Sandbox Code Playgroud)