Unattended-Upgrades

如何停止/禁用無人值守升級自動啟動?

  • January 13, 2020

我最近在我的台式電腦上安裝了 Trisquel 8.0 LTS (Flidas),它在 Trisquel 7.0 上執行了 4 年。系統變得非常緩慢。當我檢查 RAM 和 CPU 使用率時,我發現 CPU 幾乎處於 100 % 我top調整看看出了什麼問題,發現它unattended-upgr正在消耗整個 CPU。

在此處輸入圖像描述

我試圖通過 PID 殺死它,sudo kill 1803但過了一段時間,它又自動啟動了。我知道無人值守升級旨在自動安裝重要的安全更新,但我需要禁用它自動啟動。

我怎麼做?

您需要按如下方式停止自動更新程序:

執行以下命令

sudo dpkg-reconfigure -plow unattended-upgrades

您將看到配置無人值守升級的提示:

在此處輸入圖像描述

選擇以禁用自動下載和​​安裝更新,然後按 Enter。

這將更新配置文件/etc/apt/apt.conf.d/20auto-upgrades,設置APT::Periodic::Unattended-Upgrade"0".

 $ sudo dpkg-reconfigure -plow unattended-upgrades
 Replacing config file /etc/apt/apt.conf.d/20auto-upgrades with new version
 $ cat /etc/apt/apt.conf.d/20auto-upgrades
 APT::Periodic::Update-Package-Lists "0";
 APT::Periodic::Unattended-Upgrade "0";

有關配置軟體包的更多資訊,請參閱man dpkg-reconfigure

--configure package...|-a|--pending
         Configure a package which has been unpacked but not yet  config‐
         ured.   If  -a  or  --pending  is  given instead of package, all
         unpacked but unconfigured packages are configured.

         Configuring consists of the following steps:

         1.  Unpack  the  conffiles, and at the same time back up the old
         conffiles, so that they can be restored if something goes wrong.

         2. Run postinst script, if provided by the package

dpkg-reconfigure - reconfigure an already installed package

  -pvalue, --priority=value
      Specify the minimum priority of question that will be displayed.
      dpkg-reconfigure normally shows low priority questions no matter
      what your default priority is. See debconf(7) for a list.

  -a, --all
      Reconfigure all installed packages that use debconf. Warning: this
      may take a long time.

--no-reload
          Prevent dpkg-reconfigure from reloading templates. Use with caution; this will prevent
          dpkg-reconfigure from repairing broken templates databases.  However, it may be useful
          in constrained environments where rewriting the templates database is expensive.

引用自:https://unix.stackexchange.com/questions/470709