Table des matières
- 2026:
- 2025:
13 billet(s) pour novembre 2026
| Réseaux - protocole QUIC mieux que TCP | 2026/11/17 21:26 | Jean-Baptiste |
| Notes conversion JSON YAML | 2026/11/13 11:16 | Jean-Baptiste |
| Git commit perdu | 2026/11/12 18:16 | Jean-Baptiste |
| Notes mojo lang | 2026/11/11 20:34 | Jean-Baptiste |
| Notes rust lang compilation | 2026/11/11 18:35 | Jean-Baptiste |
| Mémoire VSIZE VMSIZE SEGV lang C | 2026/11/11 15:59 | Jean-Baptiste |
| Ansible-navigator utilisation de ansible-vault | 2026/11/06 11:33 | Jean-Baptiste |
| Err Ansible - Module result deserialization failed No start of json char found | 2026/11/06 09:09 | Jean-Baptiste |
| Script Python conversion JSON vers CSV | 2026/11/06 08:14 | Jean-Baptiste |
| Filter Incoming IPv4 Packets Containing IP Options - cve-2026-98432 mitigation - Kernel TCP Use-After-Free | 2026/11/04 21:04 | Jean-Baptiste |
| Notes ZFS | 2026/11/03 18:04 | Jean-Baptiste |
| Diff image container | 2026/11/03 16:30 | Jean-Baptiste |
| Notes processus multi-thread | 2026/11/03 10:59 | Jean-Baptiste |
Notes SAN - Fiber Channel
# cat /sys/class/fc_host/host1/port_state Offline # cat /sys/class/fc_host/host2/port_state Online
Notes Samba Winbind Kerberos
Voir
- sssd
- nslcd
Debug
Check NTP and :
service samba restart service winbind restart cat /etc/nsswitch.conf net ads join --kerberos -U administrator -d 10
Pb
Kerberos
net ads info net ads status wbinfo -u wbinfo -g wbinfo -t wbinfo -m kinit administrator at UNILINEDOO.LOCAL klist -ke net ads testjoin id <user> getent passwd getent passwd DOMAIN/user getent group klist kdestroy
wbinfo -t
Solution :
- stop smbd, nmbd and winbindd (make sure they are really dead using ps. winbindd still lingered after I stopped the service)
- delete the samba from the PDC (using the Management Console)
- delete the secrets database (/var/lib/samba/secrets.tdb)
- join the domain again
- start the daemons again (smbd, nmbd and winbindd)
Notes rust lang
Voir aussi :
- V, Odin, Vale
sh rustup.sh --disable-sudo --prefix=opt/ export LD_LIBRARY_PATH=$PWD/opt/lib opt/bin/rustc --version export PATH=$PATH:$PWD/opt/bin
export RUST_BACKTRACE=1
Format
cargo fmt --verbose --check cargo fmt
Lint
cargo clippy
Langage
fn plop(n: u32) -> u32 { let ret: u32; if n > 5 { ret = 10; } else { ret = 20; }; return ret }
fn plop(n: u32) -> u32 { let ret = if n > 5 { 10u32 } else { 20u32 }; return ret }
Notes ruby capistrano
capshell peut être remplacé par clush (paquet clustershell), pour avoir un shell sur plusieurs serveurs
Création du paquage Capistrano (utilisable en userland)
Voir https://rvm.io/integration/capistrano/#gem
INSTALL DE RVM Ruby Version Manager
→ Voir https://rvm.io/
Prerequis
yum install libxslt-devel curl git patch gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel yum install ruby-libs # (a verifier !)
-Install
curl -L https://get.rvm.io | bash -s stable --ruby
INSTALL DE CAPISTRANO
~/.rvm/rubies/*/bin/gem install --user rvm-capistrano
SCRIPT DE LANCEMENT ~/bin/cap
#! /bin/bash CAP=$(echo /home/eib/.gem/ruby/*/bin/cap | tail -1) RUBY=$(echo /home/eib/.rvm/rubies/ruby-*/bin/ruby | tail -1) $RUBY $CAP $*
chmod +x ~/bin/cap
TEST DE CAPISTRANO
~/bin/cap shell
CONSCRUCTION DU PAQUET
find /home/eib/.gem /home/eib/.rvm/rubies/ruby-* /home/eib/.rvm/gems/ruby-* /home/eib/.rvm/environments /home/eib/.rvm/bin /home/eib/bin/cap -depth | cpio -ov --format=ustar | gzip >captistrano.tar.gz
NB : les répertoires nécessaires au paquet peuvent être trouvé à l'aide de “strace”.
Voir NOTES.
DEINSTALL
rm -rf ~/.rvm ~/.gem ~/bin/cap
NOTES http://henriksjokvist.net/archive/2012/2/deploying-with-rbenv-and-capistrano/
Commande utile :
Pour relancer la compilation de ruby :
rvm reinstall all --force
Pour trouver les repertoires nécessaires à la création du paquet
/bin/ls -ld $(strace -f -e trace=file cap 2>&1 | grep -v 'No such file or directory' | grep open | cut -d'"' -f2 | grep '/home/eib/.rvm/') | grep ^d|awk '{print $9}'
~/.rvm/bin/gem-ruby-2.0.0-p0 update
Notes rsync
CD / ISO
Source https://www.debian.org/CD/mirroring/
Veuillez utiliser au moins les options --times --links --hard-links --partial --block-size=8192. Cela conservera la date de dernière modification, les liens symboliques et durs et un bloc de 8192 octets (le plus adapté pour les images de CD) sera utilisé. Lorsque la date de dernière modification et la taille d'un fichier n'ont pas été modifiées, rsync ignore le fichier, aussi --times est réellement nécessaire
Machine distante vers machine distante
rsync -ax backup:/home/wiki wiki:/home/
The source and destination cannot both be remote.
ssh -A remotehostA rsync /remote/file/on/host/a remoteHostB:/destination/
Une autre solution consiste à utiliser SSHFS Mais les UID/GID ne sont pas préservés
Pb SSHFS Transport endpoint is not connected
fusermount -uz /data
/etc/fuse.conf
user_allow_other
sshfs -o allow_other,ro -o reconnect -o ServerAliveInterval=15 root@192.168.2.12:/var/www /data -p 12345 -C
Pour debug ajouter l'option -d
sshfs -d -o allow_other,ro -o reconnect -o ServerAliveInterval=15 root@192.168.2.12:/var/www /data -p 12345 -C
Gros fichiers avec plein de zéros, iso...
Voir l'option --sparse
-S, --sparse traite les fichiers à trous efficacement
$ ls -lsh total 22G 16K drwx------ 2 root root 16K août 9 10:42 lost+found 7,7G -rw-r--r-- 1 jibe jibe 120G août 9 11:18 VM152-SUPPMSM-V-clone.img 14G -rw-r--r-- 1 jibe jibe 14G févr. 24 09:15 VM152-SUPPMSM-V-clone.qcow2
Copie dossier
Ne pas oublier le barre oblique (slash) à la fin
rsync -ax /mnt/usb_disk/ /mnt/usb_disk2/
Utilisation de l'option --files-from
rsync -anv --files-from=push.lst / /tmp/plop/
rsync avec find
# rsync --files-from=<(find ~/DATA/ -type f -name '*.txt' -printf "%P\n") ~/DATA/ ~/DATA2/ # find ~/DATA/ -name '*.txt' -printf %P\\0 | rsync --files-from=- --from0 ~/DATA/ ~/DATA2/ cd ~/DATA/ find . -type f -name '*.txt' -exec rsync -av -R {} ~/DATA2/ \;
Diff - diffing
diff -r --exclude='.git' --exclude='.gitlab' projet_plop_fork/ projet_plop_orig/
Équivalent avec rsync
rsync -rcvn --itemize-changes --delete --exclude='.git' --exclude='.gitlab' projet_plop_fork/ projet_plop_orig/ | sed -s 's%^[^ ]\+ %%'
Droits
chmod - exemple cd iso9660
chmod \ F pour File \ D pour Directory
rsync -a -H --delete --chmod=Fu+rw,Du=rwx /mnt/iso /tmp/iso
Cependant dans le cas d'un ISO CD/DVD nous préférerons :
fakeroot rsync -a -H --delete /mnt/iso /tmp/iso
chown - exemple synchro dokuwiki
rsync -axP --chown=999:999 --exclude="cache" --exclude="tmp" --exclude="attic" --delete webapp:/home/wiki/data/* /home/wiki/data/
Options SSH
rsync -o StrictHostKeyChecking=no -o CheckHostIP=no #rsync -e "ssh -o StrictHostKeyChecking=no -o CheckHostIP=no"
Exclusion
Le chemin des fichiers à exclure est relatif au répertoire que l'on sauvegarde.
# FAUX rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded --exclude="/home/jean/tmp/" /home/jean/ /media/backup/ # Exclus tous les /tmp rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded --exclude="/tmp" /home/jean/ /media/backup/ # OK rsync --archive --verbose --stats --info=progress2 --delete --delete-excluded -filter="- /home/jean/tmp/" /home/jean/ /media/backup/
La racine “/” est relative au dossier racine qu'on sauvegarde
Source https://fortintam.com/blog/2010/03/18/le-parametre-exclude-de-rsync/
Exclure les fichiers cachés
rsync -ax --exclude=".*" --delete /source/ /dest/
Liste bande passante / ressources
Liste bande passante / ressources --bwlimit=KBps
/usr/bin/ionice -c2 -n7 rsync -axvn --bwlimit=20480 /home/jean/ backup1:/data/bck1/home/jean/ # systemd-run -p IOWeight=10 rsync -axvn --bwlimit=20480 /home/jean/ backup1:/data/bck1/home/jean/
Voir aussi
renice +19 -p $$ >/dev/null 2>&1 ionice -c3 -p $$ >/dev/null 2>&1
ntop -A sudo /etc/init.d/ntop start
Rsync en mode daemon
Voir :
Man Fr (old)
Man recent
Activation
/etc/default/rsync
RSYNC_ENABLE=true
systemctl enable --now rsync systemctl status rsync
rsync rsync://pub@localhost/
Exemple de fichier de conf
/etc/rsyncd.conf
uid = swift gid = swift log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid reverse lookup = false [account] max connections = 2 path = /srv/node read only = false lock file = /var/lock/account.lock [container] max connections = 4 path = /srv/node read only = false lock file = /var/lock/container.lock [object] max connections = 8 path = /srv/node read only = false lock file = /var/lock/object.lock
Autres
Installeur Debian Calamares
Running ("rsync", "-aHAXr", "--filter=-x trusted.overlay.*", "--exclude", "/proc/", "--exclude", "/sys/", "--exclude", "/dev/", "--exclude", "/run/", "--exclude", "/run/udev/", "--exclude", "/sys/firmware/efi/efivars/", "--progress", "/tmp/tmpqf5n2jx1/filesystem/", "/tmp/calamares-root-z6v29hnx")
Hack
--rsync-path="sudo rsync" --rsync-path="cd /foo; rsync"
Pb
Pb de taille
Source : https://sanitarium.net/rsyncfaq/#differentsizes
rsync -ax --delete ne fait pas forcément le sparce, et ne préserve pas les hardlinks
Pour vérifier que la copie fait bien la même taille
#echo `find . -type f -ls | awk '{print $7 "+"}'`0 | bc echo `find /media/Disk1/ -type f -ls | awk '{print $7 "+"}'`0 | bc echo `find /media/Disk2/ -type f -ls | awk '{print $7 "+"}'`0 | bc
rsync --delete -v -axHSc /media/Disk1/ /media/Disk2/
| Option | Description |
|---|---|
| -c | skip based on checksum, not mod-time & size |
| -H | preserve hard links |
| -S\ --sparse | handle sparse files efficiently |
Pb : failed to set times on / No such file or directory
sshfs SRV_DEST:/var/www/ /home/jean/mnt/SRV_DEST rsync -ax --bwlimit=20480 SRV_SRC01:/var/www/www.acme.fr/ /home/jean/mnt/SRV_DEST/www.acme.fr/
rsync: failed to set times on "/home/jean/mnt/SRV_DEST/www.acme.fr/htdocs/current": No such file or directory (2)
Solution : Tester avec l'option -J ou -O
rsync -ax -J --bwlimit=20480 SRV_SRC01:/var/www/www.acme.fr/ /home/jean/mnt/SRV_DEST/www.acme.fr/
Pb clef USB sync
Sur clef USB le système peut bufferiser beaucoup trop. La copie se met en pause un certain temps puis reprend. Si on interrompt le rsync le “sync” mais énormément de temps. Pendant tous ce temps il n'est pas possible de démonter la clef USB
Dans ce cas il est possible d'utiliser l'option --fsync
Note : sur du FAT il est possible d'utiliser --modify-window=1
