我的终端响应很慢,很差,如何解决?

我的终端响应很慢,很差,如何解决?

问题是我的终端不再好用了。终端上的输入非常糟糕,而且每次我按下一个键时,每个命令都没有响应。有时命令运行但没有结束,但是当我按下回车键时,提示符就会返回,如果我认为命令应该执行的话。

因此,我已经采取了各种措施来解决我的问题,但仍然没有弄清楚问题是什么。

# System up to date and some software repaired and missing packages reinstalled.
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install --reinstall gnome-software gsettings-desktop-schemas gconf2
sudo apt-get install -f

我检查日志,发现一些错误,并用上述命令清除了它。

sudo journalctl -x

没有任何配置文件的终端问题仍然存在。

env -i bash --noprofile --norc

export TERM=xterm
export TERM=linux
export TERM=xterm-256color

# The exports needed if they do not there htop or ranger would not run.
# Debugging is also not shows up errors.
bash -x
# Result is alright - no errors found
sudo smartctl -t short /dev/sda
sudo smartctl -l selftest /dev/sda

这些应用程序绝对不再好用。程序输出的刷新只能通过按键来实现。

tmux
htop
ranger
apt-get
etc.

如果它对我的问题很重要,那就是我的快照列表。

snap list --all
Name Version
bare 1.0
chromium 123.0.6312.86
chromium-ffmpeg 0.1
core 16-2.61.2
core18 20231027
core20 20240111
core22 20240111
cups 2.4.7-3
docker 24.0.5
firefox 124.0.1-1
gnome-3-26-1604 3.26.0.20221130
gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67
gnome-3-34-1804 0+git.3556cb3
gnome-3-38-2004 0+git.efb213a
gnome-42-2204 0+git.510a601
gnome-system-monitor 45.0
gtk-common-themes 0.1-81-g442e511
hunspell-dictionaries-1-7-2004 1.7-20.04+pkg-6fd6
mesa-core20 21.2.6
snap-store 41.3-77-g7dc86c8
snapd-desktop-integration 0.9

我下载了最新的 Ubuntu 22.04.4 Desktop iso 并制作了一个 Live-USB。在实时系统中不存在此问题。

那么。我遗漏了什么错误?或者我忘记检查什么了?

答案1

问题的解决方案:

来自的有用提示:也许最近的问答中的一些内容会有所帮助: Ubuntu 22.04.4 终端上的输入延迟钢铁司机

提示: 但修复后,系统变得很糟糕。我的意思是,apt-get install 无法再安装或删除任何程序,因为软件包发生了变化!

# Ubuntu package assistent says call these command.
# But do not it otherwise, it will removing gdm gnome-desktop etc.
# Than the desktop enviroment is gone - unbeliveable I saw that - I sayed NO!
sudo apt-get --fix-broken install

# To come back into normal state follow below "Undo the script with these commands:"
# This is a save way to come back into a working system with apt-get!

问题是 mutter 包:

  • ii libmutter-10-0:am​​d64 42.9-0ubuntu7 amd64
  • ii mutter-common 42.9-0ubuntu7 全部

用这些替换后,终端工作正常:

  • 你好 libmutter-10-0:am​​d64 42.0-3ubuntu2 amd64
  • ii mutter-common 42.0-3ubuntu2 全部

使用以下命令撤消脚本:

sudo apt-mark unhold $(apt-mark showhold)
sudo apt-get install --reinstall mutter-common libmutter-10-0

来自评论的脚本在这里稍有变化:

# I modified the script a little bit, 
# because there was some changed need, 
# otherwise Ubuntu 22.04.4 would cry like a baby because wrong version.
# 
# Important after running the script - A restart of the OS is needed!
# 
# Skript begins - I run it in a bash-Shell
arch=$(dpkg --print-architecture) # one of amd64 arm64 armhf ppc64el riscv64 s390x

ubuntuVersion=$(grep -i "distrib_release" /etc/lsb-release | cut -sd '=' -f2)

version=""
package=""

if [[ "${ubuntuVersion}" = "23.10" ]]; then
    # Ubuntu 23.10
    version="45.0-3ubuntu3"
    package="13-0"
fi

if [[ "${ubuntuVersion}" = "23.04" ]]; then
    # Ubuntu 23.04
    if [[ "${arch}" = "amd64" ]]; then
        version="44.3-0ubuntu1.1" # only amd64
    else
        version="44.0-2ubuntu4" # other archs
    fi
    package="12-0"
fi

if [[ "${ubuntuVersion}" = "22.04" ]]; then
    # Ubuntu 22.04
    version="42.0-3ubuntu2"
    package="10-0"
fi

if [[ -z "${package}" || -z "${version}" ]]; then
    echo "Error - Package or Version not set"
    exit 1
fi

if [[ -n "$( dpkg -l | grep 'mutter' | grep ''${version}'' )" ]]; then
    # Found older version and replace it with the new one
    echo libmutter-${package} install | sudo dpkg --set-selections
    echo libmutter-common install | sudo dpkg --set-selections

    # Reinstall the newer packages of the mutter package
    if [ "${package}" != "10-0" ]; then
      echo libmutter-common-bin install | sudo dpkg --set-selections
      sudo apt-get install --reinstall mutter-common libmutter-10-0 libmutter-common-bin
    else
      sudo apt-get install --reinstall mutter-common libmutter-10-0
    fi

else
    # Replace the newer version with the older ones
    wget http://se.archive.ubuntu.com/ubuntu/pool/main/m/mutter/libmutter-${package}_${version}_$arch.deb
    wget http://se.archive.ubuntu.com/ubuntu/pool/main/m/mutter/mutter-common_${version}_all.deb
    if [ "${package}" != "10-0" ]; then
      wget http://se.archive.ubuntu.com/ubuntu/pool/main/m/mutter/mutter-common-bin_${version}_$arch.deb
    fi

    sudo dpkg -i *mutter*.deb

    echo libmutter-${package} hold | sudo dpkg --set-selections
    echo libmutter-common hold | sudo dpkg --set-selections
    if [ "${package}" != "10-0" ]; then
      echo libmutter-common-bin hold | sudo dpkg --set-selections
    fi
fi
# Skript ends

相关内容