無人アップグレードはどのように開始され、スケジュールはどのように変更されますか?

無人アップグレードはどのように開始され、スケジュールはどのように変更されますか?

私のdebian-jessieで誰が無人アップグレードを始めたのか知りたいのですが:

  1. マイマニュアルページ

    DESCRIPTION
       This program can download and install security  upgrades  automatically
       and  unattended,  taking care to only install packages from the config‐
       ured APT source, and checking for dpkg prompts about configuration file
       changes. All output is logged to /var/log/unattended-upgrades.log.
       This  script  is  the backend for the APT::Periodic::Unattended-Upgrade
       option and designed to be run from cron (e.g. via /etc/cron.daily/apt).
    
  2. しかし、私のcrontabはcrontabコマンドを介して何も表示しません。

    @stefano:/etc/cron.daily$ crontab -l
    no crontab for stefano
    # crontab -l
    no crontab for root
    
  3. しかし、無人アップグレードはうまくいきます! (私の無人アップグレードログファイル):

    2017-02-05 12:42:42,835 INFO Initial blacklisted packages: 
    2017-02-05 12:42:42,866 INFO Initial whitelisted packages: 
    2017-02-05 12:42:42,868 INFO Starting unattended upgrades script
    2017-02-05 12:42:42,870 INFO Allowed origins are: ['o=Debian,n=jessie', 'o=Debian,n=jessie-updates', 'o=Debian,n=jessie-backports', 'origin=Debian,codename=jessie,label=Debian-Security']
    2017-02-05 12:43:15,848 INFO No packages found that can be upgraded unattended

スケジュールを変更したい場合は、どこで確認/修正する必要がありますか?

ベストアンサー1

Debian 9(stretch)とDebian 10(buster)の場合、無人アップグレードスケジュールは2つのステップで決まります。

  1. システムスケジューラ(例:systemdタイマーまたはcron / anacron)と
  2. APT::周期的な厚さ。

1つの低い周波数がもう1つの高い周波数をブロックするので、正しく設定されていることを確認してください。両方スピード。

1. システムスケジューラ

プロセスは、次の2つのシステムタイマーによって開始されます。

  • apt-daily.timerアップデートパッケージリスト(apt-get update)と
  • apt-daily-upgrade.timerアップグレードインストール(unattended-upgrade)。

(anacronジョブは/etc/cron.daily/apt-compatまだ存在しますが、systemdが検出されると終了します。systemdを使用していない場合は、計画の変更に関する他の回答またはanacronのドキュメントを参照してください。)

更新スケジュールを編集するには:

$ sudo systemctl edit apt-daily.timer

たとえば、次のように入力します/etc/systemd/system/apt-daily.timer.d/override.conf

[Timer]
OnCalendar=
OnCalendar=01:00
RandomizedDelaySec=15m

アップグレードスケジュールは同じです。

$ sudo systemctl edit apt-daily-upgrade.timer

[Timer]
OnCalendar=
OnCalendar=01:30
RandomizedDelaySec=0

作業内容を確認してください。

$ systemctl cat apt-daily{,-upgrade}.timer
$ systemctl --all list-timers apt-daily{,-upgrade}.timer

(一部抜粋Debian Wiki: 無人アップグレード.)

2. APT::定期的な厚さ

systemdタイマーを使用するか、anacronジョブをシステムスケジューラとして使用するかは、最終的に同じスクリプトを呼び出します。スクリプトは再実行する必要があるかどうかについて新しい2番目の決定を下しますが、今はAPT :: Periodicで設定された時間間隔に基づいています。通常、次のような設定があります/etc/apt/apt.conf.d/20auto-upgrades

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

私はいつも"1"ここの値がTrueまたはOnを意味すると思いましたが、実際には1日単位で表される実行間の最小間隔です。スクリプトが要求された操作が最後に実行されてから経過した時間が少ないと判断した場合は、いいえシステムスケジューラが必要とするかどうかにかかわらず、これを行います。

1.5以降のaptバージョン(Debian 10 Buster)の場合、APT :: Periodicの値をからに変更でき"1"ます"always"。これを一度実行すると、その時点からシステムスケジューラ(システムタイマーまたはanacron)と対話してスケジュールを変更できます。

上記の詳細を確認したり、1日に複数回実行するように無人アップグレードをスケジュールしたりするには、ここで私の答えを確認してください。毎日ではなく数時間ごとに無人アップグレードを実行する方法

おすすめ記事