Table des matières
3 billet(s) pour janvier 2026
| Notes rsh rcp | 2026/01/21 18:08 | Jean-Baptiste |
| Git - Duplication d'un dépôt | 2026/01/19 10:22 | Jean-Baptiste |
| Exemple simple de conf Nagios | 2026/01/14 10:07 | Jean-Baptiste |
KVM LibVirt
Voir :
Votre CPU gère t-il VT ou AMD-V ?
egrep --color '^flags.*(vmx |svm )' /proc/cpuinfo
Ou
apt-get install cpu-checker
kvm-ok
cat /sys/module/kvm_intel/parameters/nested cat /sys/module/kvm_amd/parameters/nested
Parfois il faut activer l'option dans le BIOS
# virt-host-validate ... LXC: Checking if device /sys/fs/fuse/connections exists : FAIL (Load the 'fuse' module to enable /proc/ overrides) echo fuse >> /etc/modules modprobe fuse
Sous RedHat désactiver le NetworkManager
systemctl stop NetworkManager systemctl disable NetworkManager
et ajouter la ligne suivante dans /etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/ifcfg-*
NM_CONTROLLED=no
Install
apt-get install --no-install-recommends qemu-kvm libvirt-clients libvirt-daemon-system
adduser jean libvirt
#adduser jean kvm
~/.bash_aliases
alias virsh="virsh -c qemu:///system"
ou
~/.bashrc
export LIBVIRT_DEFAULT_URI="qemu:///system"
virsh net-autostart default virsh net-start default
/etc/default/libvirt-guests
#ON_BOOT=ignore ON_BOOT=start #START_DELAY=0 START_DELAY=30 #PARALLEL_SHUTDOWN=0 PARALLEL_SHUTDOWN=1 #SHUTDOWN_TIMEOUT=300 SHUTDOWN_TIMEOUT=180
Pour virt-sysprep (après clonage de VM)
apt-get install libguestfs-tools
UEFI
apt-get install ovmf
Virt-install
Exemple :
virt-install \ --name vm1 \ --ram 512 \ --location=http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ \ --initrd-inject=/tmp/preseed.cfg \ --extra-args="console=ttyS0,115200n8 serial locale=fr_FR console-setup/ask_detect=false keyboard-configuration/layoutcode=fr hostname=virtual domain=unassigned-domain interface=auto" \ --vcpu=1 \ --vnc \ --vnclisten=0.0.0.0 \ --os-type=linux \ --os-variant=debianwheezy \ -w bridge=virbr0 \ -w bridge=br1 \ -w network=default \ --console pty,target_type=serial \ --disk format=qcow2,size=8,bus=virtio,path=/var/lib/libvirt/images/vm1.qcow2
#--connect qemu:///system #--location=http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/ \ #--noautoconsole \ #--autostart \ #--cdrom=/var/lib/libvirt/images/test.iso \
--extra-args ne marche que si --location est défini.
Réseaux
KVM Réseaux Bridge TUN
http://doc.fedora-fr.org/wiki/Discussion:Virtualisation_:_KVM,_Qemu,_libvirt_en_images
PCI Passthrough - IOMMU
Voir :
BIOS/UEFI
Première étape, faire un tour dans le BIOS/UEFI pour activer les choses suivantes :
VT-D (cas d’un CPU intel) AMD-Vi (cas d’un CPU AMD)
Pour vérifier :
# dmesg | grep -e "Directed I/O" [ 1.693161] DMAR: Intel(R) Virtualization Technology for Directed I/O
Pour du AMD :
dmesg | grep AMD-Vi
Dans le BIOS activer “SR-IOV” ?
# ls /sys/class/iommu/*/ /sys/class/iommu/dmar2/: devices intel-iommu power subsystem uevent /sys/class/iommu/dmar4/: devices intel-iommu power subsystem uevent /sys/class/iommu/dmar5/: devices intel-iommu power subsystem uevent /sys/class/iommu/dmar6/: devices intel-iommu power subsystem uevent /sys/class/iommu/dmar7/: devices intel-iommu power subsystem uevent
/etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau options nouveau modeset=0
/etc/default/grub
#GRUB_CMDLINE_LINUX_DEFAULT="modprobe.blacklist=nouveau modprobe.blacklist=nvidiafb" #GRUB_CMDLINE_LINUX="intel_iommu=on iommu=pt rd.driver.pre=vfio-pci video=efifb:off vfio_iommu_type1.allow_unsafe_interrupts=1" #GRUB_CMDLINE_LINUX="kvm_iommu=on iommu=pt" GRUB_CMDLINE_LINUX="intel_iommu=on iommu=pt pci-stub.ids=10de:1b81,10de:10f1 video=efifb:off"
update-grub
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf reboot dmesg | grep 'remapping'
Pour nvidia
echo "options kvm ignore_msrs=1 report_ignored_msrs=0" > /etc/modprobe.d/kvm.conf
# lspci -nn | grep -i nvidia 3b:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104GL [Quadro P5000] [10de:1bb0] (rev a1) 3b:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1) af:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104GL [Quadro P5000] [10de:1bb0] (rev a1) af:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1)
/etc/modprobe.d/vfio.conf
#options vfio-pci ids=10de:1bb0,10de:10f0 options vfio-pci ids=10de:1bb0 options vfio-pci disable_vga=1
echo 'vfio-pci' > /etc/modules-load.d/vfio-pci.conf update-initramfs -u
# dmesg |grep "Directed I/O" [ 1.705358] DMAR: Intel(R) Virtualization Technology for Directed I/O
#!/bin/bash shopt -s nullglob for g in /sys/kernel/iommu_groups/*; do echo "IOMMU Group ${g##*/}:" for d in $g/devices/*; do echo -e "\t$(lspci -nns ${d##*/})" done; done;
dmesg | grep -i vfio
# lspci -nnk |grep -i -A 2 nvidia
3b:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104GL [Quadro P5000] [10de:1bb0] (rev a1)
Subsystem: Dell GP104GL [Quadro P5000] [1028:11b2]
Kernel driver in use: vfio-pci
--
3b:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1)
Subsystem: Dell GP104 High Definition Audio Controller [1028:11b2]
Kernel driver in use: snd_hda_intel
--
af:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104GL [Quadro P5000] [10de:1bb0] (rev a1)
Subsystem: Dell GP104GL [Quadro P5000] [1028:11b2]
Kernel driver in use: vfio-pci
--
af:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1)
Subsystem: Dell GP104 High Definition Audio Controller [1028:11b2]
Kernel driver in use: snd_hda_intel
# echo "0000:3b:00.0" | tee /sys/bus/pci/drivers/vfio-pci/unbind 0000:3b:00.0 # echo "0000:3b:00.0" | tee /sys/bus/pci/drivers/vfio-pci/unbind 0000:3b:00.0 tee: /sys/bus/pci/drivers/vfio-pci/unbind: No such device
cd /sys/bus/pci/devices/0000\:3b\:00.0 echo 1 > rom cat rom > /tmp/gpu.rom echo 0 > rom
/etc/libvirt/qemu/vm1.xml
<hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x3b' slot='0x00' function='0x0'/> </source> <rom bar='on'/> <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/> </hostdev> <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0xaf' slot='0x00' function='0x0'/> </source> <rom bar='on'/> <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/> </hostdev>
Test de perf IO disque
Voir :
Voir :
- atop
- stress-ng
- iozone3
stress-ng --all 0 --maximize --aggressive
iostat -hx 5 iostat -xmt 1
Linux : tester les performances I/O
hdparm -t -T /dev/sda dd bs=8192 count=$((4096 * 128)) if=/dev/zero of=test conv=fdatasync bonnie++ -d /mnt -r 8000 -u toto
#time -p dd if=/dev/zero of=/tmp/test1.img bs=1M count=500 oflag=dsync #time -p dd if=/dev/zero of=/tmp/test1.img bs=500M count=1 oflag=dsync time -p dd if=/dev/zero of=/tmp/test1.img bs=8192 count=$((8192 * 64)) oflag=dsync
sudo apt-get install sysbench # --file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw} sysbench --test=fileio --file-test-mode=seqwr run sysbench --test=fileio --file-total-size=4G prepare sysbench --test=fileio --file-total-size=4G --file-test-mode=rndrd --max-time=5 run sysbench --test=fileio --file-total-size=4G --file-test-mode=rndwr --max-time=5 run sysbench --test=fileio --file-total-size=4G cleanup
Disk Read-Ahead
blockdev --report blockdev --getra /dev/sda blockdev --setra 256 /dev/sdc cat /sys/block/sda/queue/read_ahead_kb
fio
Source https://www.geekarea.fr/wordpress/?p=769
apt-get install fio
cat > plop.fio << EOF [global] bs=64k direct=1 rw=randrw ioengine=libaio iodepth=2 zonesize=256m zoneskip=2g write_bw_log=str [/dev/vdb] EOF fio plop.fio
Linux IO scheduler
# cat /sys/block/sda/queue/scheduler noop deadline [cfq]
/etc/default/grub
# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
IOWAIT
Téléphone portable Android connexion PC sous GNU/Linux
Voir aussi :
Notes adb
Voir :
Préreq :
- le mode debug USB doit être activé
- le debug doit être autorisé. Si pas le cas passez en “Photo transfer (PTP) mode”
Install
apt-get install android-tools-adb
Autre outils ?
apt-cache search android-tools
android-tools-adb - Android Debug Bridge CLI tool android-tools-fsutils - Android ext4 utilities with sparse support android-tools-fastboot - outil en ligne de commande pour le protocole Fastboot d'Android
Connexion
adb start-server
adb devices
lsusb
Bus 002 Device 005: ID 0e8d:201d MediaTek Inc
~/.android/adb_usb.ini
# 0xidVendorHere 0x0e8d
ou
export ADB_VENDOR_KEYS=0x0e8d
Redémarrage d'adb pour le prise en compte de la modif
adb start-server adb kill-server
Copie
adb push plop.txt /sdcard/
App
Dépôts alternatifs
Voir aussi :
Install de F-Droid un dépôt de Logiciel Libre
wget https://f-droid.org/FDroid.apk adb install FDroid.apk
Mise à jour
adb install -r cartes-gps-navigation-osmand.apk
Liste des applis installées
adb shell 'pm list packages -f'
Exemple sauvegarde
#adb backup -apk -shared -all -f backup.ab adb backup '-apk -shared -all -f backup.ab'
Tar du fichier de sauvegarde
tail -n +5 backup.ab |pigz -d -z > backup.tar dd if=backup.ab bs=24 skip=1 |pigz -d -z > backup.tar
Notes fastboot
Voir :
Prerequisites:
- unlocked bootloader
- adb and fastboot installed on your computer
adb reboot bootloader #fastboot flash recovery twrp-2.8.x.x-xxx.img fastboot flash system <ROM file here> fastboot reboot
Source : https://www.thecustomdroid.com/how-to-unlock-bootloader-on-huawei-devices/
adb reboot bootloader
fastboot devices
fastboot oem unlock 2155388422526005
fastboot getvar unlocked
fastboot reboot
Source : https://www.kingoapp.com/root-tutorials/how-to-unlock-bootloader-android-device.htm
apt-get install android-tools-fastboot fastboot devices fastboot oem unlock # Après confirmation sur le téléphone : fastboot reboot
Recovery Fastboot https://www.androidpit.com/forum/731450/wiko-sunny-how-to-get-twrp-recovery-installed
fastboot devices fastboot oem unlock fastboot flash recovery recovery.img fastbook
fastboot oem unlock < waiting for device >
Partage de fichier - montage lecteur
Partage MTP (Transfère de fichiers)
apt-get install mtp-tools jmtpfs mtpfs
avec interface graphique
apt-get install gmtp
mkdir ~/mnt/mtp/ jmtpfs ~/mnt/mtp/ rsync -ax /media/cdrom/ mnt/mtp/Carte\ SD/plop/ fusermount ~/mnt/mtp/
Partage PTP (Transfère de photos)
Pb
$ adb install cartes-gps-navigation-osmand.apk
4529 KB/s (18980364 bytes in 4.092s)
pkg: /data/local/tmp/cartes-gps-navigation-osmand.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]
$ adb install -r cartes-gps-navigation-osmand.apk
4861 KB/s (18980364 bytes in 3.812s)
pkg: /data/local/tmp/cartes-gps-navigation-osmand.apk
Success
Autres
Logs
adb logcat | grep $(adb shell ps | grep org.smssecure.smssecure | cut -c10-15)
logcat -C -b crash,system,main 'bash:S logcat:S mali_winsys:S *:I'
Droits appli
adb shell pm grant uk.co.richyhbm.monochromatic android.permission.WRITE_SECURE_SETTINGS
root access
https://f-droid.org/wiki/page/Should_I_root_my_device%3F
debian
https://www.debian-fr.org/t/debian-kit-debian-en-parallele-dandroid-sans-chroot/59967
Sécurité Sources inconnues Autoriser l'installation d'application issue de sources inconnues
wget http://download.clockworkmod.com/superuser/superuser.zip mkdir plop cd plop unzip ../superuser.zip adb kill-server
$ adb root adbd cannot run as root in production builds
Note root wiko
SuperSU TWRP ( Team Win Recovery Project)
wipe dalvik/cache
Changer son IMEI ? https://play.google.com/store/apps/details?id=com.cryptotel.chamelephon
adb shell getprop ro.build.version.release adb shell getprop |grep ro.build.version.release
Autres
Désinstaller une application système
adb shell pm uninstall -k --user 0 foundation.e.mail
Téléchargement
Source : https://www.debian.org/CD/http-ftp/#stable
Veuillez utiliser à la place un outil qui permet la reprise des téléchargements interrompus.
- Sous UNIX et GNU/Linux, vous pouvez utiliser aria2, wget ou curl ou HTTPie
wget -c URL
ou
curl -C - -L -O URL
Remplacer URL par l'adresse HTTP ou HTTPS
- Sous Windows, vous pouvez essayer Free Download Manager
- Sous Mac OS, vous pouvez essayer CocoaWget
Vous pouvez aussi consulter une comparaison de gestionnaires de téléchargement pour vous aider à choisir un programme qui vous convient.
