Hello,
systemctl enable tmp.mount
permettait de monter tmp en tmpfs via systemd
Depuis peu, sous Sid, cela ne marche plus :
“Failed to execute operation: No such file or directory”
La commande permettait de créer un symlink de /etc/systemd/system/local-fs.target.wants/tmp.mount à /lib/systemd/system/tmp.mount
Or j’ai vérifié il n’y a plus tmp.mount dans /etc/systemd/system/local-fs.target.wants/
La raison se trouve dans ce changelog :
[quote]systemd (220-6) unstable; urgency=medium
- Stop installing tmp.mount by default; there are still situations where it
becomes active through dependencies from other units, which is surprising,
hides existing data in /tmp during runtime, and it isn’t safe to have a
tmpfs /tmp on every install scenario. (Closes: #783509)- d/rules: Ship tmp.mount in /usr/share/systemd/ instead of
/lib/systemd/systemd. - systemd.postinst: When tmp.mount already was enabled, install tmp.mount
into /etc and keep it enabled. - systemd.postinst: When enabling tmp.mount because of RAMTMP=yes, copy it
from /usr/share. - Drop Don-t-mount-tmp-as-tmpfs-by-default.patch and
PrivateTmp-shouldn-t-require-tmpfs.patch, not necessary any more.[/quote]
- d/rules: Ship tmp.mount in /usr/share/systemd/ instead of
Et en effet :
$ locate tmp.mount
/usr/share/systemd/tmp.mount
Du coup, il faut d’abord faire à présent :
mv /usr/share/systemd/tmp.mount /etc/systemd/system/
Puis :
systemctl enable tmp.mount
–
Récapitulatif
-
À partir de Debian 7.0 Wheezy, /var/lock et /var/run sont montés en mémoire vive par défaut.
-
À partir de Debian 8.0 Jessie, c’est systemd qui va permettre de monter /tmp en mémoire vive, avec la commande « systemctl enable tmp.mount ». La commande « sudo df -k | grep tmpfs » vous permet ensuite, après un redémarrage, de vérifier que ces changements ont bien été pris en compte.
-
À partir de Debian 9.0 Stretch, et plus précisément dû à systemd 220-6, il faut préalablement rapatrier le fichier tmp.mount de /usr/share/systemd/ vers /etc/systemd/system/ grâce à la commande « sudo mv /usr/share/systemd/tmp.mount /etc/systemd/system/ ». Vous pourrez ensuite valablement exécuter la commande « systemctl enable tmp.mount », et, après un redémarrage, vérifier avec la commande « sudo df -k | grep tmpfs » la bonne réalisation de l’opération.