This commit is contained in:
kyodev 2018-01-23 19:33:29 +01:00
parent 0188ce8319
commit daa671ce50
1 changed files with 25 additions and 133 deletions

View File

@ -4,21 +4,21 @@
<https://wiki.debian.org/UnattendedUpgrades>
le programme est **unattended-upgrade**, l'orthographe est un s final est parfois utilisée, mais ce n'est
qu'un lien sur /usr/bin/unattended-upgrade
le man est unattended-upgrade
le paquet comporte un S final :(
le fichier de config comporte un S final
le programme est **unattended-upgrade**, l'orthographe avec un s final est un lien sur /usr/bin/unattended-upgrade
le man est unattended-upgrade, le paquet et le fichier de config comporte un S final :(
## installation
```shell
apt install unattended-upgrades
```
normalement, depuis debian9 stretch, unattended-upgrade est installé par défaut (mais pas forcément activé?)
## configuration
`/etc/apt/apt.conf.d/50unattended-upgrades`
`xdg-open /etc/apt/apt.conf.d/50unattended-upgrades`
extrait config, exemple:
```text
@ -64,6 +64,7 @@ Unattended-Upgrade::Automatic-Reboot-WithUsers "false";
Unattended-Upgrade::SyslogEnable "true";
```
## test
simuler pour test, visualisation des erreurs, pas d'ugrade réel
@ -72,126 +73,48 @@ simuler pour test, visualisation des erreurs, pas d'ugrade réel
unattended-upgrade -d
```
## activation
```shell
apt-config dump | grep -i 'APT::Periodic::Unattended-Upgrade'
```
```text
APT::Periodic::Unattended-Upgrade "1";
```
si **1** ou **true**, unattended-upgrade est activé, au besoin:
```shell
dpkg-reconfigure -plow unattended-upgrades
```
(plow = priority low)
cela crée et configure le fichier `/etc/apt/apt.conf.d/20auto-upgrades` avec les lignes permettant la mise
à jour automatique:
cela configurera le fichier `/etc/apt/apt.conf.d/20auto-upgrades` avec la ligne permettant la mise à jour automatique:
```text
// apt ugrade
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
```
les options APT::Periodic configurent les actions périodiques du script
/usr/lib/apt/apt.systemd.daily
dans les anciennes config(?), ces options pouvaient être mises dans /etc/apt/apt.conf.d/02periodic
pour les anciennes config(?), ces options peuvent être mises dans /etc/apt/apt.conf.d/02periodic
## ///\\\ FIN INSTALLATION ///\\\ ###
## options configs APT
```text
APT::Periodic::Enable "1";
// Enable the update/upgrade script (0=disable)
APT::Periodic::BackupArchiveInterval "0";
// Backup after n-days if archive contents changed.(0=disable)
APT::Periodic::BackupLevel "3";
// Backup level.(0=disable), 1 is invalid.
Dir::Cache::Backup "backup/";
// Set periodic package backup directory
APT::Archives::MaxAge "0"; (old, deprecated)
APT::Periodic::MaxAge "0"; (new)
// Set maximum allowed age of a cache package file. If a cache
// package file is older it is deleted (0=disable)
APT::Archives::MinAge "2"; (old, deprecated)
APT::Periodic::MinAge "2"; (new)
// Set minimum age of a package file. If a file is younger it
// will not be deleted (0=disable). Useful to prevent races
// and to keep backups of the packages for emergency.
APT::Archives::MaxSize "0"; (old, deprecated)
APT::Periodic::MaxSize "0"; (new)
// Set maximum size of the cache in MB (0=disable). If the cache
// is bigger, cached package files are deleted until the size
// requirement is met (the oldest packages will be deleted first).
APT::Periodic::Update-Package-Lists "0";
// Do "apt-get update" automatically every n-days (0=disable)
APT::Periodic::Download-Upgradeable-Packages "0";
// Do "apt-get upgrade --download-only" every n-days (0=disable)
APT::Periodic::Download-Upgradeable-Packages-Debdelta "1";
// Use debdelta-upgrade to download updates if available (0=disable)
APT::Periodic::Unattended-Upgrade "0";
// Run the "unattended-upgrade" upgrade script every n-days (0=disabled)
// Requires the package "unattended-upgrades" and will write
// a log in /var/log/unattended-upgrades
APT::Periodic::AutocleanInterval "0";
// Do "apt-get autoclean" every n-days (0=disable)
APT::Periodic::CleanInterval "0";
// Do "apt-get clean" every n-days (0=disable)
APT::Periodic::Verbose "0";
// Send report mail to root
// 0: no report (or null string)
// 1: progress report (actually any string)
// 2: + command outputs (remove -qq, remove 2>/dev/null, add -d)
// 3: + trace on
```
## config apt du système
```shell
apt-config dump | less
apt-config dump | grep 'APT::Periodic::Enable'
```
PB stretch 9.2?? (à confirmer)
* pas de fichier /etc/apt/apt.conf.d/02periodic
* donc pas de APT::Periodic::Enable "1";
* défaut: APT::Periodic "";
* pas de `APT::Periodic::Enable "1";` configuré par défaut (dans stable & testing)
```shell
apt-config dump | grep 'APT::Periodic'
```
* PAS de valeur APT::Periodic::Enable "1";
mais:
```shell
AutoAptEnable=1
AutoAptEnable="n/a"
eval $(apt-config shell AutoAptEnable APT::Periodic::Enable)
[ $? ] && echo ok || echo KO
ok
echo $AutoAptEnable
1
n/a
```
Testing
* unattended-upgrades est installé avec gnome
* /etc/apt/apt.conf.d/20auto-upgrades existant
* /etc/apt/apt.conf.d/50unattended-upgrades existant
* pas de APT::Periodic::Enable "1";
## suivi
@ -202,34 +125,3 @@ fichier logs:
/var/log/dpkg.log
```
## système
```shell
systemctl status apt-daily
systemctl status apt-daily.timer
```
script, actions périodiques:
/usr/lib/apt/apt.systemd.daily
Remarque:
le timer de systemd est crade, l'intervalle entre deux lancements de apt-daily peut varier entre 3h et 10h
```shell
systemctl list-timers | grep apt-dailysystemctl status apt-daily.timer
```
```text
apt-daily.timer apt-daily.service
apt-daily-upgrade.timer apt-daily-upgrade.service
```
kesako ce up**gr**ade service??
a voir:
/lib/systemd/system/
/etc/systemd/system/
A Faire:
basculer le script en cron.daily plus net et précis
A voir:
/etc/cron.daily/apt-compat