无人值守升级无法启动且 /etc/cron.daily/apt 缺失

无人值守升级无法启动且 /etc/cron.daily/apt 缺失

使用 Xubuntu 16.04,我为所有软件包设置了自动更新。但是,无人值守升级无法启动,并且 /etc/cron.daily/apt 丢失。如何修复此问题?

下面是我用来静默启用自动更新的步骤:

我的更新设置:tous les jours = 每天 télécharger et installer automatiquement = 自动下载并安装

在此处输入图片描述

然后,使用终端:

sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades #Yes for questions

#edit /etc/apt/apt.conf.d/50unattended-upgrades :
Unattended-Upgrade::Allowed-Origins {
        "${distro_id} ${distro_codename}-security";
        "${distro_id} ${distro_codename}-updates";
//      "${distro_id} ${distro_codename}-proposed";
//      "${distro_id} ${distro_codename}-backports";
"LP-PPA-webupd8team-sublime-text-3:xenial";
};

#edit /etc/apt/apt.conf.d/10periodic :
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

# edit /etc/apt/apt.conf.d/20auto-upgrades :
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

#restart cron and anacron :
sudo service anacron stop
sudo service cron stop
sudo rm -rf /var/run/unattend* /var/run/cron* /var/run/anacron*
sudo rm -rf /var/lib/apt/periodic/*
sudo service cron start
sudo anacron -fn

我得到了软件包可以升级的信息:

$ sudo apt update
[...]
Lecture des informations d'état... Fait
41 packages can be upgraded. Run 'apt list --upgradable' to see them.

sudo unattended-upgrades --dry-run –debug曾经模拟过静默更新,结果很好,一切都更新了“不是真的”。真正的问题是自动更新没有默默启动。一个月以来我每天都检查日志,但 /var/log/unattended-upgrades/unattended-upgrades.log 中仍然没有更新

经过调查,我认为根本原因是缺少 /etc/cron.daily/apt。

$ dpkg --search /etc/cron.daily/apt
dpkg-query: no path matches /etc/cron.daily/apt
$ ls /etc/cron.daily
0anacron    bsdmainutils  logrotate  passwd                  upstart
apport      dpkg          man-db     popularity-contest
apt-compat  fstrim        mlocate    update-notifier-common

如何修复此问题以便静默启动无人值守升级?

链接:

https://help.ubuntu.com/community/AutomaticSecurityUpdates#Using_the_.22unattended-upgrades.22_package

https://help.ubuntu.com/lts/serverguide/automatic-updates.html

如何启用自动更新?

如何为任何存储库启用静默自动更新?

相关内容