Table des matières
- 2026:
- 2025:
8 billet(s) pour mars 2026
| Notes conteneurs oras artifact OCI | 2026/03/23 21:13 | Jean-Baptiste |
| Notes podman secret | 2026/03/23 15:10 | Jean-Baptiste |
| Notes ansible podman | 2026/03/23 14:08 | Jean-Baptiste |
| Notes podman volume | 2026/03/23 14:00 | Jean-Baptiste |
| Find list - Trouver des fichiers à partir d'une liste | 2026/03/18 14:32 | Jean-Baptiste |
| AWX inventaire vault | 2026/03/17 18:04 | Jean-Baptiste |
| AWX - Configuration git en local (sans serveur web) | 2026/03/05 16:24 | Jean-Baptiste |
| OpenSMTP | 2026/03/03 16:58 | Jean-Baptiste |
SystemD mount relancer un unit failed avec un Timer
Voir : https://github.com/SSSD/sssd/issues/5074
At boot SystemD type “mount” failed for CIFS when uid is ldap account, because sssd not ready (be started)
Erreur
bad option uid="jean"
Problème avec mount.cifs avec l'option uid= quand le uid n'est pas un uid mais un username. Le username est sur LDAP et le service sssd n'est pas prêt.
Nous faisons un montage réseau CIFS avec pour options : uid=jean. Hors jean est un compte LDAP. Il est préférable d'utiliser les UID, mais dans mon cas j'ai une contrainte d'entreprise.
Le problème se produit au boot. L'Unit SystemD mnt-plop.mount est bien lancée, mais presque en même temps que sssd.service et le LDAP n'est pas encore fonctionnel.
Et donc le montage réseau échoue.
# journalctl -u mnt-plop.mount -u sssd -b -- Logs begin at Sat 2023-02-18 14:07:02 CET, end at Wed 2023-03-08 19:46:26 CET. -- Mar 08 19:45:55 srv01 systemd[1]: Starting System Security Services Daemon... Mar 08 19:45:55 srv01 sssd[1367]: Starting up Mar 08 19:45:55 srv01 sssd_be[1439]: Starting up Mar 08 19:45:56 srv01 sssd_sudo[1501]: Starting up Mar 08 19:45:56 srv01 sssd_nss[1499]: Starting up Mar 08 19:45:56 srv01 sssd_pam[1500]: Starting up Mar 08 19:45:56 srv01 systemd[1]: Started System Security Services Daemon. Mar 08 19:45:56 srv01 systemd[1]: Mounting Partage... Mar 08 19:45:56 srv01 mount[1606]: bad option uid="jean" Mar 08 19:45:56 srv01 systemd[1]: mnt-plop.mount: Mount process exited, code=exited status=1 Mar 08 19:45:56 srv01 systemd[1]: mnt-plop.mount: Failed with result 'exit-code'. Mar 08 19:45:56 srv01 systemd[1]: Failed to mount Partage. Mar 08 19:45:57 srv01 sssd_be[1439]: Backend is online
Pour les montages NAS je préconise de faire systématiquement un Unit automount, mais autre contrainte d'entreprise, je dois trouver une solution sans automount.
/etc/systemd/system/mnt-plop.mount
[Unit] Description=Partage [Mount] What=//127.0.0.1/shared Type=cifs Options=noexec,nosuid,nodev,rw,port=445,uid=jean,gid=jean,file_mode=0644,dir_mode=0755,noperm,credentials=/root/.cifs_plop Where=/mnt/plop ForceUnmount=yes DirectoryMode=755 [Install] WantedBy=remote-fs.target
systemctl stop sssd sss_cache -E rm /var/lib/sss/db/* -f reboot
# systemctl status /mnt/plop
● mnt-plop.mount - Partage
Loaded: loaded (/etc/systemd/system/mnt-plop.mount; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2023-03-08 19:54:45 CET; 36s ago
Where: /mnt/plop
What: //127.0.0.1/shared
Mar 08 19:54:45 srv01 systemd[1]: Mounting Partage...
Mar 08 19:54:45 srv01 mount[1574]: bad option uid="jean"
Mar 08 19:54:45 srv01 systemd[1]: mnt-plop.mount: Mount process exited, code=exited status=1
Mar 08 19:54:45 srv01 systemd[1]: mnt-plop.mount: Failed with result 'exit-code'.
Mar 08 19:54:45 srv01 systemd[1]: Failed to mount Partage.
Solution
/etc/systemd/system/mnt-plop.timer
[Unit] Description=Partage Requires=sssd.service After=sssd.service Conflicts=mnt-plop.mount [Timer] OnBootSec=15 Unit=mnt-plop.mount RemainAfterElapse=False [Install] WantedBy=timers.target
systemctl daemon-reload
systemctl enable mnt-plop.timer
Avec un Timer ça fonctionne bien, mais à la condition que le Unit mnt-plop.mount soit disable. En effet si il est enable, il échoue, et le Timer SystemD n'essaie même pas de le relancer.
L'astuce consiste à l'arrêter avant !
C'est grâce à l'option :
[Unit] Conflicts=mnt-plop.mount
En contournement nous avons le choix parmi les possibilités suivantes :
- Utiliser des UID/GID numériques à la place des usernames/groupnames
- Créer un Unit de type automount
- Activer le cache sssd
- Utiliser un Unit SystemD de type Service ou de type Timer comme illustré dans cet exemple.
NB : il existe aussi l'option sss_master_map_wait pour le paquet autofs, mais ça n'a pas d'interêt puisque ça fonctionne très bien avec un automount SystemD classique sans paramètre particulier.
SystemD mode recovery single mode linux kernel param
Parametre Kernel
systemd.unit=rescue.targetsystemd.debug-shell=1systemd.unit=emergency.target
pour allez dans le tty8 ou tty9
ce qui revient à
systemctl enable debug-shell.service
Avec init=/bin/bash (à l'ancienne)
Dans le grub, ligne commençant par linux
init=/bin/bash
mount -n -o remount,rw / passwd reboot -f
rd.break
kernel param rd.break Si SeLinux : ajouter : enforcing=0
Exemple :
rd.break enforcing=0
Puis
loadkeys fr chroot /sysroot
Sur RedHat
rd.break \ ? enforcing=0
mount -o remount,rw /sysroot chroot /sysroot passwd touch /.autorelabel # ou alors (plus rapide) : load_policy -i #puis restorecon -Rv /etc
Alternative à touch /.autorelabel
- Remove rhgb quiet using the backspace key.
- You can change “ro” to “rw” in this grub line to avoid having to do a remount (shown below).
- IMPORTANT Add to the kernel line:
rd.break enforcing=0NOTE: you might have to make “console=tty0” above as well depending if it's virtual or not. - Press Ctrl x to resume the boot process. NOTE: If you did not change “ro” to “rw” above, make sure to remount the /sysroot partition as shown below.
mount –o remount,rw /sysroot chroot /sysroot passwd root
- Type exit twice to continue the boot process
- Log in, open a terminal and enter the root account.
restorecon -v /etc/shadow setenforce 1 ; getenforce
Se passer de Flash player
Pour les vidéo
(à l'époque beaucoup de vidéo nécessitaient Flash player)
Un solution ?
apt-get install browser-plugin-vlc
livestreamer :
- Dailymotion
- Livestream
- Twitch
- UStream
- YouTube Live
clive / cclive unplug Viewtube / Linterna Magica
rtmpdump remplacé par curl ?
yt-dlp (youtube-dl)
sudo apt-get install yt-dlp
youtube-dl http://rg3.github.io/youtube-dl/download.html
python3 -m pip install --user --upgrade youtube_dl
Pb yt-dlp
Err yt-dlp ERROR: unable to open for writing: [Errno 36] File name too long:
Solution
yt-dlp -o "%(id)s.%(ext)s" "https://twitter.com/JuliaDavisNews/status/1574860347697205262"
Pour les images vectorielles
- Gnash
Systemd lancer un script à l'arrêt
Source : http://unix.stackexchange.com/questions/39226/how-to-run-a-script-with-systemd-right-before-shutdown
/etc/systemd/system/jbshutdown.service
[Unit] Description=Exec before shutdown [Service] Type=oneshot RemainAfterExit=true ExecStart=/bin/true ExecStop=/root/bin/shutdown.sh [Install] WantedBy=multi-user.target
chmod +x /root/bin/shutdown.sh systemctl enable jbshutdown.service systemctl start jbshutdown.service
Le lien symbolique suivant sera crée : /etc/systemd/system/multi-user.target.wants/jbshutdown.service
Systemd journalctl journal logs
Requête sur les logs, chercher et trouver
Trouver les logs entres deux dates
journalctl --since "2016-10-18 06:50" --until "2016-10-18 09:00" journalctl --since yesterday -p err
Par service et/ou par PID
journalctl -u pacemaker.service --since "2017-02-24 16:00" -p warning journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=28097 + _SYSTEMD_UNIT=dbus.service
Voir aussi
ps -f -p 28097 systemctl status 28097 # Par PPID ps -f --ppid 1
Erreur au boot
journalctl -b -p err
tailf
# dmesg -l warn journalctl -f -p warning
Ouvrir un fichier spécifique
journalctl --file /tmp/plop.journal
Filtrer les logs json
journalctl -u nginx -o json-pretty |jq '. |select(.SYSLOG_IDENTIFIER=="plop")
Les commandes sudo
# journalctl -b -t sudo -p 5 -u session-*.scope Sep 12 08:19:01 vmdeb01 sudo[601]: admin : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/bash
Options sur le forme
Arguments :
--no-pager-f: tail -f
Configuration
Rendre persistant journalctl
Source : https://geekeries.de-labrusse.fr/?p=3189
Par défaut journalctl affiche uniquement les logs du dernier boot
# journalctl --boot=-1 Failed to look up boot -1: Cannot assign requested address
Pour avoir les logs persistant :
/etc/systemd/journald.conf
[Journal] #Storage=auto Storage=persistent Compress=yes #SystemMaxUse= SystemMaxUse=250M #ForwardToSyslog=yes
mkdir /var/log/journal systemd-tmpfiles --create --prefix /var/log/journal systemctl restart systemd-journald
Journalctl et container
Source : https://docs.docker.com/engine/logging/drivers/journald/
| CONTAINER_ID | The container ID truncated to 12 characters. |
| CONTAINER_ID_FULL | The full 64-character container ID. |
| CONTAINER_NAME | The container name at the time it was started. If you use docker rename to rename a container, the new name isn't reflected in the journal entries. |
| CONTAINER_TAG, SYSLOG_IDENTIFIER | The container tag ( log tag option documentation). |
| CONTAINER_PARTIAL_MESSAGE | A field that flags log integrity. Improve logging of long log lines. |
| IMAGE_NAME | The name of the container image. |
Retrieve log messages with journalctl
Use the journalctl command to retrieve log messages. You can apply filter expressions to limit the retrieved messages to those associated with a specific container:
sudo journalctl CONTAINER_NAME=webserver
You can use additional filters to further limit the messages retrieved. The -b flag only retrieves messages generated since the last system boot:
sudo journalctl -b CONTAINER_NAME=webserver
The -o flag specifies the format for the retrieved log messages. Use -o json to return the log messages in JSON format.
sudo journalctl -o json CONTAINER_NAME=webserver
View logs for a container with a TTY enabled
If TTY is enabled on a container you may see [10B blob data] in the output when retrieving log messages. The reason for that is that \r is appended to the end of the line and journalctl doesn't strip it automatically unless --all is set:
sudo journalctl -b CONTAINER_NAME=webserver --all
Journalctl container et Python
Retrieve log messages with the journal API This example uses the systemd Python module to retrieve container logs:
import systemd.journal reader = systemd.journal.Reader() reader.add_match('CONTAINER_NAME=web') for msg in reader: print '{CONTAINER_ID_FULL}: {MESSAGE}'.format(**msg)
Autres
/etc/systemd/journald.conf
[Journal] RateLimitInterval=10s RateLimitBurst=6000
Pb
Pb plus de logs avec journalctl ni dans /var/log/message
/var/log/message vide ?
# journalctl No journal files were found. -- No entries --
Solution
systemctl restart systemd-journald systemctl restart rsyslog.service
