Unattended-upgrades comment ça marche

Tags: #<Tag:0x00007f4e5f1f2958>
ls -la /etc/systemd/system/
total 76
drwxr-xr-x 19 root root 4096 29 avril 15:59 .
drwxr-xr-x  5 root root 4096 15 nov.  15:55 ..
drwxr-xr-x  2 root root 4096 15 mars   2024 bluetooth.target.wants
lrwxrwxrwx  1 root root   42 15 mars   2024 dbus-fi.w1.wpa_supplicant1.service -> /lib/systemd/system/wpa_supplicant.service
lrwxrwxrwx  1 root root   37 15 mars   2024 dbus-org.bluez.service -> /lib/systemd/system/bluetooth.service
lrwxrwxrwx  1 root root   40 15 mars   2024 dbus-org.freedesktop.Avahi.service -> /lib/systemd/system/avahi-daemon.service
lrwxrwxrwx  1 root root   40 15 mars   2024 dbus-org.freedesktop.ModemManager1.service -> /lib/systemd/system/ModemManager.service
lrwxrwxrwx  1 root root   53 15 mars   2024 dbus-org.freedesktop.nm-dispatcher.service -> /lib/systemd/system/NetworkManager-dispatcher.service
lrwxrwxrwx  1 root root   45 15 mars   2024 dbus-org.freedesktop.timesync1.service -> /lib/systemd/system/systemd-timesyncd.service
lrwxrwxrwx  1 root root   35 24 oct.   2025 display-manager.service -> /lib/systemd/system/lightdm.service
drwxr-xr-x  2 root root 4096 15 mars   2024 getty.target.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 graphical.target.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 hibernate.target.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 hybrid-sleep.target.wants
drwxr-xr-x  2 root root 4096 25 avril 16:15 multi-user.target.wants
drwxr-xr-x  2 root root 4096 15 mars   2024 network-online.target.wants
drwxr-xr-x  2 root root 4096 15 mars   2024 printer.target.wants
drwxr-xr-x  2 root root 4096 15 mars   2024 sockets.target.wants
lrwxrwxrwx  1 root root   31 15 mars   2024 sshd.service -> /lib/systemd/system/ssh.service
drwxr-xr-x  2 root root 4096 24 oct.   2025 sshd.service.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 sshd@.service.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 ssh.service.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 ssh.socket.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 suspend.target.wants
drwxr-xr-x  2 root root 4096 24 oct.   2025 suspend-then-hibernate.target.wants
drwxr-xr-x  2 root root 4096 15 mars   2024 sysinit.target.wants
drwxr-xr-x  2 root root 4096 29 avril 15:40 timers.target.wants

Quand tu fais tu édites le fichier en question tu enregsitres les modifications ?

Sur un système non modifier il me semble que l’éditeur est nano il faut faire ctrl +x et O pour oui :wink:

Lorsque tu édites le fichier .timer au moment ou tu enregistres il te créer le fameux fichier d’override.conf et tu te retrouve donc avec l’arborescence que j’ai partagé :wink:

Oui.

C’est ce qui ne semble pas fonctionner chez moi. Pourtant quand j’utilise systemctl edit apt-daily.timer, que je modifie le fichier, au moment d’enregistrer il me dit bien :

Écrire dans un fichier: /etc/systemd/system/apt-daily.timer.d/.#override.conf15fd539ec5cf7ad2

Sauf que quand je reviens au prompt j’ai :

# systemctl edit apt-daily.timer
/etc/systemd/system/apt-daily.timer.d/override.conf: after editing, new contents are empty, not writing file.

je l’ai pas précisé mais l’édition se fait soit avec root soit à l’aide de sudo, si c’est bien ce que tu fait alors là grand mystère.

J’édite en root.

su -

et

echo $EDITOR

Pour tester :

EDITOR=/bin/nano systemctl edit apt-daily.timer

Tu lui colles ce que tu veux mettre et tu enregistres :crossed_fingers:

Pareil…

EDITOR=/bin/nano systemctl edit apt-daily.timer
/etc/systemd/system/apt-daily.timer.d/override.conf: after editing, new contents are empty, not writing file.

Bon ben j’ai trouvé. Quand j’édite avec systemctl edit apt-daily.timer il est écrit ceci dans le fichier :

### Editing /etc/systemd/system/apt-daily.timer.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

### Edits below this comment will be discarded


### /usr/lib/systemd/system/apt-daily.timer
# [Unit]
# Description=Daily apt download activities
# 
# [Timer]
# OnCalendar=*-*-* 6,17:30
# RandomizedDelaySec=600
# Persistent=true
# 
# [Install]

Ce qui signifie qu’il faut que j’édite le fichier comme ceci pour que mon fichier override soit créé et ne soit pas vide.

### Editing /etc/systemd/system/apt-daily.timer.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

### /usr/lib/systemd/system/apt-daily.timer
# [Unit]
# Description=Daily apt download activities
# 
# [Timer]
# OnCalendar=*-*-* 6,20:44
# RandomizedDelaySec=0
# Persistent=true
# 
# [Install]
# WantedBy=timers.target

### Edits below this comment will be discarded


### /usr/lib/systemd/system/apt-daily.timer
# [Unit]
# Description=Daily apt download activities
# 
# [Timer]
# OnCalendar=*-*-* 6,17:30
# RandomizedDelaySec=600
# Persistent=true
# 
# [Install]

Maintenant y’a plus qu’à voir si ça marche mais au moins ça c’est résolu.

N’oublie pas de cocher en bas de ton message.

Oui et non parce que j’ai rencontré ce problème en cherchant la réponse à mon premier problème qui est de régler l’heure des mises à jour avec Unattended Upgrades. Ce n’est pas le problème initial.

En tout cas pour le moment toujours rien dans les log après un nouvel essai. J’ai vérifié, les fichiers override.conf sont bien renseignés avec les heures auxquelles je veux que les mises à jour automatiques soient faites mais rien ne se passe. Y’a quelque chose qui cloche là-dedans…

Je comprends pas tout est commenté :face_with_raised_eyebrow:

Et un simple cron? une seule ligne, root, une commande apt et c’est joué :slight_smile:

Ah oui, j’ai oublié… Je recommence et je dé-commente comme ça :

### Editing /etc/systemd/system/apt-daily.timer.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

### /usr/lib/systemd/system/apt-daily.timer
# [Unit]
# Description=Daily apt download activities
# 
 [Timer]
 OnCalendar=*-*-* 6,21:05
 RandomizedDelaySec=0
 Persistent=true
# 
# [Install]
# WantedBy=timers.target

### Edits below this comment will be discarded

Est-ce que c’est suffisant ou bien il faut tout dé-commenter ?

de [Unit] jusqu’à WantedBy

Et pas besoin de lancer ?

systemctl daemon-reload && systemctl restart apt-daily-upgrade.timer && systemctl restart apt-daily.timer

il n’y a pas besoin du reste juste ce que l’on doit override … comme ce que j’avais remonté plus haut finalement :confused:

Non par contre pour la prise en compte des override il faut impérativement recharger les timer.