Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:debian:10:junior:l116 [2022/04/29 16:11] adminelearning:workbooks:debian:10:junior:l116 [2024/10/15 14:20] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
 +
 +Version : **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
Ligne 19: Ligne 21:
         * La Commande LILO         * La Commande LILO
         * Codes Erreur de LILO         * Codes Erreur de LILO
-      * GRUB 2 sous Debian 8+      * GRUB 2
         * Le fichier /boot/grub2/device.map         * Le fichier /boot/grub2/device.map
         * Le fichier /etc/default/grub         * Le fichier /etc/default/grub
         * Les fichiers du répertoire /etc/grub.d         * Les fichiers du répertoire /etc/grub.d
-        * Configurer l'Authentification 
         * Modifier la Configuration de GRUB 2 en Ligne de Commande         * Modifier la Configuration de GRUB 2 en Ligne de Commande
       * Gestionnaires de Démarrages Alternatifs       * Gestionnaires de Démarrages Alternatifs
Ligne 34: Ligne 35:
           * PXELINUX           * PXELINUX
         * Isodhpfx         * Isodhpfx
-    * Initramfs sous Debian 8 +    * Initramfs 
-      * Examiner l'image existante +      * LAB #1 - Travailler avec Initramfs 
-      * Le script init +        * 1.1 - Examiner l'image existante 
-      * La Commande mkinitramfs+        1.2 - La Commande mkinitramfs
     * Processus de Démarrage du Noyau Linux     * Processus de Démarrage du Noyau Linux
-    * Processus Init +    * systemd 
-    * Démarrer Debian 6 avec SysVinit +      * LAB #2 - La Commande systemctl 
-      * Niveaux d'exécution sous Debian 6 +      * LAB #3 - Fichiers de Configuration 
-      * Inittab +        3.1 - Fichiers de Configuration par Défaut 
-      Scripts de Démarrage +        * 3.2 - Surchargement des Fichiers par Défaut 
-        * Le script rc.S sous Debian 6 +        3.3 - Les Fichiers d'Unités 
-      Répertoire init.d +      * LAB #4 - La Commande systemd-analyze 
-      * Linux Standard Base +      LAB #5 - Les Cibles 
-        Codes Retour Standardisés +        * 5.1 - Contrôler les dépendances d'une Cible 
-        * Scripts +        * 5.2 - La Cible par Défaut 
-      * Répertoires rcx.d +      * LAB #- Gestion des Services 
-        * rc.local +        6.1 - Gestion des Instances Uniques 
-      * La Commande chkconfig +        6.2 Gestion d'Instances Multiples 
-      * La Commande update-rc.d sous Debian +        6.3 - Interdire la Modification du Statut d'un Service
-    Démarrer Debian 8 avec systemd +
-      La Commande systemctl +
-      * Fichiers de Configuration +
-      * Système de Démarrage +
-      * La Commande systemd-analyze +
-      Gestion des Services+
     * Arrêt Système du Système     * Arrêt Système du Système
       * La Commande shutdown       * La Commande shutdown
Ligne 173: Ligne 168:
 </WRAP> </WRAP>
  
-====GRUB 2 sous Debian 8====+====GRUB 2====
  
 GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, notamment GRUB 2 sait utiliser des partitions RAID et LVM. GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, notamment GRUB 2 sait utiliser des partitions RAID et LVM.
Ligne 192: Ligne 187:
  
 <code> <code>
-root@debian8:~# cat /boot/grub/grub.cfg+root@debian11:~# cat /boot/grub/grub.cfg
 # #
 # DO NOT EDIT THIS FILE # DO NOT EDIT THIS FILE
Ligne 257: Ligne 252:
 set root='hd0,msdos1' set root='hd0,msdos1'
 if [ x$feature_platform_search_hint = xy ]; then if [ x$feature_platform_search_hint = xy ]; then
-  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b+  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e
 else else
-  search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b+  search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e
 fi fi
     font="/usr/share/grub/unicode.pf2"     font="/usr/share/grub/unicode.pf2"
Ligne 274: Ligne 269:
 terminal_output gfxterm terminal_output gfxterm
 if [ "${recordfail}" = 1 ] ; then if [ "${recordfail}" = 1 ] ; then
-  set timeout=-1+  set timeout=30
 else else
   if [ x$feature_timeout_style = xy ] ; then   if [ x$feature_timeout_style = xy ] ; then
Ligne 292: Ligne 287:
 set root='hd0,msdos1' set root='hd0,msdos1'
 if [ x$feature_platform_search_hint = xy ]; then if [ x$feature_platform_search_hint = xy ]; then
-  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b+  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e
 else else
-  search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b+  search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e
 fi fi
 insmod png insmod png
-if background_image /usr/share/images/desktop-base/lines-grub.png; then+if background_image /usr/share/desktop-base/homeworld-theme/grub/grub-4x3.png; then
   set color_normal=white/black   set color_normal=white/black
   set color_highlight=black/white   set color_highlight=black/white
Ligne 308: Ligne 303:
 ### BEGIN /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/10_linux ###
 function gfxmode { function gfxmode {
- set gfxpayload="${1}"+        set gfxpayload="${1}"
 } }
 set linux_gfx_mode= set linux_gfx_mode=
 export linux_gfx_mode export linux_gfx_mode
-menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0fc7a234-259a-416b-b674-51eedfb1823b' { +menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9887a74f-a680-4bde-8f04-db5ae9ea186e' { 
- load_video +        load_video 
- insmod gzio +        insmod gzio 
- if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi +        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi 
- insmod part_msdos +        insmod part_msdos 
- insmod ext2 +        insmod ext2 
- set root='hd0,msdos1' +        set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then +        if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e 
- else +        else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +          search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e 
- fi +        fi 
- echo 'Loading Linux 3.16.0-4-686-pae ...' +        echo    'Loading Linux 5.10.0-13-amd64 ...' 
- linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro initrd=/install/gtk/initrd.gz quiet +        linux   /boot/vmlinuz-5.10.0-13-amd64 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro  quiet 
- echo 'Loading initial ramdisk ...' +        echo    'Loading initial ramdisk ...' 
- initrd /boot/initrd.img-3.16.0-4-686-pae+        initrd  /boot/initrd.img-5.10.0-13-amd64
 } }
-submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-0fc7a234-259a-416b-b674-51eedfb1823b' { +submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-9887a74f-a680-4bde-8f04-db5ae9ea186e' { 
- menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-686-pae-advanced-0fc7a234-259a-416b-b674-51eedfb1823b' { +        menuentry 'Debian GNU/Linux, with Linux 5.10.0-13-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-13-amd64-advanced-9887a74f-a680-4bde-8f04-db5ae9ea186e' { 
- load_video +                load_video 
- insmod gzio +                insmod gzio 
- if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi +                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi 
- insmod part_msdos +                insmod part_msdos 
- insmod ext2 +                insmod ext2 
- set root='hd0,msdos1' +                set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then +                if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e 
- else +                else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +                  search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e 
- fi +                fi 
- echo 'Loading Linux 3.16.0-4-686-pae ...' +                echo    'Loading Linux 5.10.0-13-amd64 ...' 
- linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro initrd=/install/gtk/initrd.gz quiet +                linux   /boot/vmlinuz-5.10.0-13-amd64 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro  quiet 
- echo 'Loading initial ramdisk ...' +                echo    'Loading initial ramdisk ...' 
- initrd /boot/initrd.img-3.16.0-4-686-pae +                initrd  /boot/initrd.img-5.10.0-13-amd64 
-+        
- menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-686-pae-recovery-0fc7a234-259a-416b-b674-51eedfb1823b' { +        menuentry 'Debian GNU/Linux, with Linux 5.10.0-13-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-13-amd64-recovery-9887a74f-a680-4bde-8f04-db5ae9ea186e' { 
- load_video +                load_video 
- insmod gzio +                insmod gzio 
- if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi +                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi 
- insmod part_msdos +                insmod part_msdos 
- insmod ext2 +                insmod ext2 
- set root='hd0,msdos1' +                set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then +                if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e 
- else +                else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +                  search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e 
- fi +                fi 
- echo 'Loading Linux 3.16.0-4-686-pae ...' +                echo    'Loading Linux 5.10.0-13-amd64 ...' 
- linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro single initrd=/install/gtk/initrd.gz +                linux   /boot/vmlinuz-5.10.0-13-amd64 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro single  
- echo 'Loading initial ramdisk ...' +                echo    'Loading initial ramdisk ...' 
- initrd /boot/initrd.img-3.16.0-4-686-pae +                initrd  /boot/initrd.img-5.10.0-13-amd64 
-+        }
- menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-586' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-586-advanced-0fc7a234-259a-416b-b674-51eedfb1823b'+
- load_video +
- insmod gzio +
- if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi +
- insmod part_msdos +
- insmod ext2 +
- set root='hd0,msdos1' +
- if [ x$feature_platform_search_hint = xy ]; then +
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +
- else +
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +
- fi +
- echo 'Loading Linux 3.16.0-4-586 ...' +
- linux /boot/vmlinuz-3.16.0-4-586 root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro initrd=/install/gtk/initrd.gz quiet +
- echo 'Loading initial ramdisk ...' +
- initrd /boot/initrd.img-3.16.0-4-586 +
-+
- menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-586 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-586-recovery-0fc7a234-259a-416b-b674-51eedfb1823b'+
- load_video +
- insmod gzio +
- if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi +
- insmod part_msdos +
- insmod ext2 +
- set root='hd0,msdos1' +
- if [ x$feature_platform_search_hint = xy ]; then +
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +
- else +
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +
- fi +
- echo 'Loading Linux 3.16.0-4-586 ...' +
- linux /boot/vmlinuz-3.16.0-4-586 root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro single initrd=/install/gtk/initrd.gz +
- echo 'Loading initial ramdisk ...' +
- initrd /boot/initrd.img-3.16.0-4-586 +
- }+
 } }
  
Ligne 405: Ligne 366:
  
 ### END /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ###
- 
-### BEGIN /etc/grub.d/20_memtest86+ ### 
-menuentry "Memory test (memtest86+)" { 
- insmod part_msdos 
- insmod ext2 
- set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b 
- else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b 
- fi 
- linux16 /boot/memtest86+.bin 
-} 
-menuentry "Memory test (memtest86+, serial console 115200)" { 
- insmod part_msdos 
- insmod ext2 
- set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b 
- else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b 
- fi 
- linux16 /boot/memtest86+.bin console=ttyS0,115200n8 
-} 
-menuentry "Memory test (memtest86+, experimental multiboot)" { 
- insmod part_msdos 
- insmod ext2 
- set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b 
- else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b 
- fi 
- multiboot /boot/memtest86+_multiboot.bin 
-} 
-menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" { 
- insmod part_msdos 
- insmod ext2 
- set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b 
- else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b 
- fi 
- multiboot /boot/memtest86+_multiboot.bin console=ttyS0,115200n8 
-} 
-### END /etc/grub.d/20_memtest86+ ### 
  
 ### BEGIN /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/30_os-prober ###
Ligne 472: Ligne 386:
 fi fi
 ### END /etc/grub.d/41_custom ### ### END /etc/grub.d/41_custom ###
- 
 </code> </code>
  
Ligne 490: Ligne 403:
   * grub-mkconfig -o /boot/edi/EFI/debian/grub.cfg   * grub-mkconfig -o /boot/edi/EFI/debian/grub.cfg
  
-Lors de l'exécution de la commande **update-grub** ou **grub-mkconfig**, plusieurs fichiers sont lus :+Lors de l'exécution de la commande **grub-mkconfig**, plusieurs fichiers sont lus :
  
 ===Le fichier /boot/grub2/device.map=== ===Le fichier /boot/grub2/device.map===
  
 <code> <code>
-root@debian8:~# cat /boot/grub/device.map+root@debian11:~# cat /boot/grub/device.map
 cat: /boot/grub/device.map: No such file or directory cat: /boot/grub/device.map: No such file or directory
-root@debian8:~# which grub-mkdevicemap +root@debian11:~# grub-mkdevicemap 
-/usr/sbin/grub-mkdevicemap +root@debian11:~# cat /boot/grub/device.map 
-root@debian8:~# grub-mkdevicemap +(hd0)   /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2 
-root@debian8:~# cat /boot/grub/device.map +(hd1)   /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0 
-(hd0) /dev/disk/by-id/ata-VBOX_HARDDISK_VB823e2981-6120fc97+(hd2)   /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1 
 +(hd3)   /dev/disk/by-id/lvm-pv-uuid-1JO10Q-CM90-tKxI-OsM6-0vbe-3eDG-S10H6d 
 +(hd4)   /dev/disk/by-id/lvm-pv-uuid-GEkOIP-S7ce-8S1G-K0TX-ocxE-Ud6y-IY3fOZ 
 +(hd5)   /dev/disk/by-id/lvm-pv-uuid-J7UiEX-m983-j1fp-rU7x-TuCh-MFKh-s1O5M0
 </code> </code>
  
Ligne 509: Ligne 425:
  
 <code> <code>
-root@debian8:~# cat /etc/default/grub+root@debian11:~# cat /etc/default/grub
 # If you change this file, run 'update-grub' afterwards to update # If you change this file, run 'update-grub' afterwards to update
 # /boot/grub/grub.cfg. # /boot/grub/grub.cfg.
Ligne 519: Ligne 435:
 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
 GRUB_CMDLINE_LINUX_DEFAULT="quiet" GRUB_CMDLINE_LINUX_DEFAULT="quiet"
-GRUB_CMDLINE_LINUX="initrd=/install/gtk/initrd.gz"+GRUB_CMDLINE_LINUX=""
  
 # Uncomment to enable BadRAM filtering, modify to suit your needs # Uncomment to enable BadRAM filtering, modify to suit your needs
Ligne 545: Ligne 461:
  
 <WRAP center round important> <WRAP center round important>
-**Important** : Notez que toute modification de ce fichier nécessite l'exécution de la commande **grub-mkconfig** / **update-grub** sous Debian pour que les modifications soient prises en compte.+**Important** : Notez que toute modification de ce fichier nécessite l'exécution de la commande **grub-mkconfig** pour que les modifications soient prises en compte.
 </WRAP> </WRAP>
  
-Dans ce fichier les directives sont :+Dans ce fichier les directives les plus importantes sont :
  
 ^  Directive  ^ Description ^ ^  Directive  ^ Description ^
Ligne 556: Ligne 472:
 | GRUB_CMDLINE_LINUX_DEFAULT | Paramètres passés au noyau lors d'un démarrage normal (Hors donc le mode secours) | | GRUB_CMDLINE_LINUX_DEFAULT | Paramètres passés au noyau lors d'un démarrage normal (Hors donc le mode secours) |
 | GRUB_CMDLINE_LINUX | Paramètres passés au noyau peu importe le type de démarrage | | GRUB_CMDLINE_LINUX | Paramètres passés au noyau peu importe le type de démarrage |
 +| GRUB_BADRAM | Permet de spécifier de la mémoire défaillante |
 | GRUB_TERMINAL | Si non commentée, cette directive désactive le démarrage graphique | | GRUB_TERMINAL | Si non commentée, cette directive désactive le démarrage graphique |
 | GRUB_GFXMODE | Indique la résolution utilisée lors d'un démarrage graphique | | GRUB_GFXMODE | Indique la résolution utilisée lors d'un démarrage graphique |
Ligne 561: Ligne 478:
 | GRUB_DISABLE_LINUX_RECOVERY | Si **true**, cette directive empêche la génération des entrées en mode **recovery** | | GRUB_DISABLE_LINUX_RECOVERY | Si **true**, cette directive empêche la génération des entrées en mode **recovery** |
 | GRUB_INIT_TUNE | Permet d'obtenir un beep au démarrage de GRUB 2 | | GRUB_INIT_TUNE | Permet d'obtenir un beep au démarrage de GRUB 2 |
-| GRUB_BADRAM | Permet de spécifier de la mémoire défaillante | 
  
 ===Les fichiers du répertoire /etc/grub.d=== ===Les fichiers du répertoire /etc/grub.d===
Ligne 568: Ligne 484:
  
 <code> <code>
-root@debian8:~# ls -l /etc/grub.d +root@debian11:~# ls -l /etc/grub.d 
-total 76 +total 80 
--rwxr-xr-x 1 root root  9424 Mar 23  2015 00_header +-rwxr-xr-x 1 root root 10046 Jul 11  2021 00_header 
--rwxr-xr-x 1 root root  6058 Mar 23  2015 05_debian_theme +-rwxr-xr-x 1 root root  6260 Jul 11  2021 05_debian_theme 
--rwxr-xr-x 1 root root 12261 Mar 23  2015 10_linux +-rwxr-xr-x 1 root root 13664 Jul 11  2021 10_linux 
--rwxr-xr-x 1 root root 11082 Mar 23  2015 20_linux_xen +-rwxr-xr-x 1 root root 13726 Jul 11  2021 20_linux_xen 
--rwxr-xr-x 1 root root  1570 Sep 10  2014 20_memtest86+ +-rwxr-xr-x 1 root root 12059 Jul 11  2021 30_os-prober 
--rwxr-xr-x 1 root root 11692 Mar 23  2015 30_os-prober +-rwxr-xr-x 1 root root  1416 Jul 11  2021 30_uefi-firmware 
--rwxr-xr-x 1 root root  1416 Mar 23  2015 30_uefi-firmware +-rwxr-xr-x 1 root root   214 Jul 11  2021 40_custom 
--rwxr-xr-x 1 root root   214 Mar 23  2015 40_custom +-rwxr-xr-x 1 root root   216 Jul 11  2021 41_custom 
--rwxr-xr-x 1 root root   216 Mar 23  2015 41_custom +-rw-r--r-- 1 root root   483 Jul 11  2021 README
--rw-r--r-- 1 root root   483 Mar 23  2015 README+
 </code> </code>
  
Ligne 588: Ligne 503:
   * **Les fichiers /etc/grub.d/40_custom et /etc/grub.d/41_custom**,   * **Les fichiers /etc/grub.d/40_custom et /etc/grub.d/41_custom**,
     * Ces deux fichiers sont fournis en tant que modèles à personnaliser.     * Ces deux fichiers sont fournis en tant que modèles à personnaliser.
- 
-===Configurer l'Authentification=== 
- 
-Pour configurer l'authentification sous GRUB 2, il faut créer le fichier **/etc/grub.d/01_users** : 
- 
-<code> 
-root@debian8:~# touch /etc/grub.d/01_users 
-root@debian8:~# chmod 755 /etc/grub.d/01_users 
-</code> 
- 
-Créez deux mots de passe hashés au format **[[https://fr.wikipedia.org/wiki/PBKDF2|PBKDF2]]** en utilisant la commande la commande **grub-mkpasswd-pbkdf2** sous Debian : 
- 
-<code> 
-root@debian8:~# grub-mkpasswd-pbkdf2 
-Enter password: pass123 
-Reenter password: pass123 
-PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.270AE83E768097679495D221C76D2052E6493B7787E374A7BF6EFFC93E375427866E34C75E668778FAF795B19E38FAA5C864A86F1372ECBC1E559E546AF11D71.64C6E790267D3B9B84CF4DFA062A64ECAB4C8831AA80D5FA210C6886C4B1ED96155D66B0A90F4C6FC32CE59D8FE67E0A465E829E39E3B1BAE180C31C547BBABE 
-</code> 
- 
-Editez le fichier **/etc/grub.d/01_users** ainsi : 
- 
-<file txt /etc/grub.d/01_users> 
-#!/bin/sh -e 
-cat <<EOF 
-set superusers="root" 
-password_pbkdf2 root 
-grub.pbkdf2.sha512.10000.270AE83E768097679495D221C76D2052E6493B7787E374A7BF6EFFC93E375427866E34C75E668778FAF795B19E38FAA5C864A86F1372ECBC1E559E546AF11D71.64C6E790267D3B9B84CF4DFA062A64ECAB4C8831AA80D5FA210C6886C4B1ED96155D66B0A90F4C6FC32CE59D8FE67E0A465E829E39E3B1BAE180C31C547BBABE 
-EOF 
-</file> 
- 
-Il est aussi possible d'utiliser des mots de passe non cryptés. Modifiez donc le fichier **/etc/grub.d/01_users** ainsi : 
- 
-<file txt /etc/grub.d/01_users> 
-#!/bin/sh -e 
-cat <<EOF 
-set superusers="root" 
-password root fenestros 
-EOF 
-</file> 
- 
-Lancez la commande **grub-mkconfig -o /boot/grub/grub.cfg** : 
- 
-<code> 
-root@debian8:~# grub-mkconfig -o /boot/grub/grub.cfg 
-Generating grub configuration file ... 
-Found background image: /usr/share/images/desktop-base/desktop-grub.png 
-Found linux image: /boot/vmlinuz-3.16.0-4-686-pae 
-Found initrd image: /boot/initrd.img-3.16.0-4-686-pae 
-Found linux image: /boot/vmlinuz-3.16.0-4-586 
-Found initrd image: /boot/initrd.img-3.16.0-4-586 
-Found memtest86+ image: /boot/memtest86+.bin 
-Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin 
-done 
-</code> 
- 
-<WRAP center round todo> 
-**A faire** : Redémarrez votre VM. Constatez que GRUB 2 demande un nom d'utilisateur ainsi qu'un mot de passe. Attention, le clavier est en QWERTY ( pass123 = pqss&é“ ). 
-</WRAP> 
  
 ===Modifier la Configuration de GRUB 2 en Ligne de Commande=== ===Modifier la Configuration de GRUB 2 en Ligne de Commande===
Ligne 703: Ligne 560:
 Un Charger de Démarrage hybride, appelé **isodhpfx.bin**, qui peut être chargé sur un disque **ou** une clef USB. Le fichier isodhpfx.bin est créé avec le programme **xorriso**. Un Charger de Démarrage hybride, appelé **isodhpfx.bin**, qui peut être chargé sur un disque **ou** une clef USB. Le fichier isodhpfx.bin est créé avec le programme **xorriso**.
  
-=====Initramfs sous Debian 8=====+=====Initramfs=====
  
 Le fichier Initramfs //%%INITial Ram File System%%// est une image d'un système minimal initialisée au démarrage du système. Le fichier Initramfs //%%INITial Ram File System%%// est une image d'un système minimal initialisée au démarrage du système.
  
-====Examiner l'image existante====+====LAB #1 - Travailler avec Initramfs==== 
 + 
 +===1.1 - Examiner l'image existante===
  
 Pour examiner une image initramfs, il convient d'abord de la copier vers /tmp et de la décompresser : Pour examiner une image initramfs, il convient d'abord de la copier vers /tmp et de la décompresser :
  
 <code> <code>
-root@debian8:~# cp /boot/initrd.img-3.16.0-4-686-pae /tmp/custom.gz +root@debian11:~# cp /boot/initrd.img-5.10.0-13-amd64 /tmp/custom.gz 
-root@debian8:~# gunzip /tmp/custom.gz+root@debian11:~# gunzip /tmp/custom.gz 
 </code> </code>
  
Ligne 719: Ligne 578:
  
 <code> <code>
-root@debian8:~# cd /tmp +root@debian11:~# cd /tmp 
-root@debian8:/tmp# mkdir initrd +root@debian11:/tmp# mkdir initrd 
-root@debian8:/tmp# cd initrd +root@debian11:/tmp# cd initrd 
-root@debian8:/tmp/initrd# cpio -idvB < ../custom +root@debian11:/tmp/initrd# cpio -idvB < ../custom
-+
-sbin +
-sbin/fsck +
-sbin/logsave +
-sbin/dmsetup +
-sbin/e2fsck +
-sbin/blkid +
-sbin/mount.fuse +
-sbin/plymouthd +
-sbin/fsck.ext4 +
-sbin/mount.ntfs +
-sbin/udevadm +
-sbin/modprobe +
-sbin/mount.ntfs-3g +
-sbin/sulogin+
 ... ...
-conf +var 
-conf/arch.conf +var/cache 
-conf/conf.d +var/cache/fontconfig 
-conf/conf.d/resume +var/cache/fontconfig/2cf0bf67-ac23-47f4-9d76-913901374fea-le64.cache-7 
-conf/initramfs.conf +var/cache/fontconfig/42771ecd-ce02-464a-8263-bedea4e63b34-le64.cache-7 
-10250 blocks+var/cache/fontconfig/CACHEDIR.TAG 
 +var/cache/fontconfig/ce5f225d-fe60-43b7-ad9d-497d8ccce03f-le64.cache-7 
 +var/cache/fontconfig/f8222393-3a24-44e9-bff6-c3f977041ad4-le64.cache-7 
 +31991 blocks
 </code> </code>
  
Ligne 750: Ligne 597:
  
 <code> <code>
-root@debian8:/tmp/initrd# apt-get install tree +root@debian11:/tmp/initrd# apt-get -y install tree
-Reading package lists... Done +
-Building dependency tree        +
-Reading state information... Done +
-The following NEW packages will be installed: +
-  tree +
-0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +
-Need to get 47.9 kB of archives. +
-After this operation, 137 kB of additional disk space will be used. +
-Get:1 http://ftp.fr.debian.org/debian/ jessie/main tree i386 1.7.0-3 [47.9 kB] +
-Fetched 47.9 kB in 0s (263 kB/s) +
-Selecting previously unselected package tree. +
-(Reading database ... 167512 files and directories currently installed.) +
-Preparing to unpack .../archives/tree_1.7.0-3_i386.deb ... +
-Unpacking tree (1.7.0-3) ... +
-Processing triggers for man-db (2.7.0.2-5) ... +
-Setting up tree (1.7.0-3) ...+
 </code> </code>
  
Ligne 772: Ligne 603:
  
 <code> <code>
-root@debian8:/tmp/initrd# tree | more+root@debian11:/tmp/initrd# tree | more
 . .
-├── bin +├── bin -> usr/bin 
-│   ├── [ +├── conf 
-│   ├── [[ +│   ├── arch.conf 
-│   ├── ar +│   ├── conf.d 
-│   ├── ash +│   │   └── resume 
-│   ├── awk +│   └── initramfs.conf 
-│   ├── basename +├── cryptroot 
-│   ├── bunzip2 +│   └── crypttab 
-│   ├── busybox +├── etc 
-│   ├── bzcat +│   ├── console-setup 
-│   ├── bzip2 +│   │   ├── cached_UTF-8_del.kmap 
-│   ├── cal +│   │   └── null 
-│   ├── cat +│   ├── default 
-│   ├── chgrp +│   │   └── keyboard 
-│   ├── chmod +│   ├── fonts 
-│   ├── chown +│   │   ├── conf.d 
-│   ├── chroot +│   │   │   └── 60-latin.conf 
-│   ├── chvt +│   │   └── fonts.conf 
-│   ├── clear +│   ├── fstab 
-│   ├── cmp +│   ├── ld.so.cache 
-│   ├── cp +│   ├── ld.so.conf 
-│   ├── cpio +│   ├── ld.so.conf.d 
-│   ├── cttyhack +│   │   ├── libc.conf 
-│   ├── cut +│   │   └── x86_64-linux-gnu.conf 
-│   ├── date +│   ├── lvm 
-│   ├── dc +│   │   ├── archive 
-│   ├── dd +│   │   │   ├── vg0_00000-267942700.vg 
-│   ├── deallocvt +│   │   │   ├── vg0_00001-854434220.vg 
-│   ├── df +│   │   │   ├── vg0_00002-520659205.vg 
-│   ├── diff+│   │   │   ├── vg0_00003-1606608177.vg 
 +│   │   │   ├── vg0_00004-458787361.vg 
 +│   │   │   ├── vg0_00005-1786773709.vg 
 +│   │   │   ├── vg0_00006-196117920.vg 
 +│   │   │   ├── vg0_00007-2024993792.vg 
 +│   │   │   ├── vg0_00008-297779072.vg 
 +│   │   │   ├── vg0_00009-1557237202.vg 
 +│   │   │   ├── vg0_00010-550024633.vg 
 +│   │   │   ├── vg0_00011-155655591.vg 
 +│   │   │   └── vg0_00012-1101644815.vg 
 +│   │   ├── backup 
 +│   │   │   └── vg0 
 +│   │   ├── lvm.conf 
 +│   │   ├── lvmlocal.conf 
 +│   │   └── profile 
 +│   │       ├── cache-mq.profile 
 +│   │       ├── cache-smq.profile 
 +│   │       ├── command_profile_template.profile 
 +│   │       ├── lvmdbusd.profile 
 +│   │       ├── metadata_profile_template.profile 
 +│   │       ├── thin-generic.profile 
 +│   │       ├── thin-performance.profile 
 +│   │       └── vdo-small.profile 
 +│   ├── modprobe.d 
 +│   ├── motd 
 +│   ├── mtab -> /proc/mounts 
 +│   ├── nsswitch.conf 
 +│   ├── os-release
 --More-- --More--
 +[q]
 </code> </code>
  
Ligne 810: Ligne 669:
  
 <code> <code>
-root@debian8:/tmp/initrd# ls -l +root@debian11:/tmp/initrd# ls -l 
-total 44 +total 36 
-drwxr-xr-x root root 4096 Oct 29 16:17 bin +lrwxrwxrwx  1 root root    7 Apr 30 11:02 bin -> usr/bin 
-drwxr-xr-x root root 4096 Oct 29 16:17 conf +drwxr-xr-x  root root 4096 Apr 30 11:02 conf 
-drwxr-xr-x root root 4096 Oct 29 16:17 etc +drwxr-xr-x  root root 4096 Apr 30 11:02 cryptroot 
--rwxr-xr-x 1 root root 7057 Oct 29 16:17 init +drwxr-xr-x 10 root root 4096 Apr 30 11:02 etc 
-drwxr-xr-x 8 root root 4096 Oct 29 16:17 lib +-rwxr-xr-x  1 root root 6301 Apr 30 11:02 init 
-drwxr-xr-x 2 root root 4096 Oct 29 16:17 run +lrwxrwxrwx root root    7 Apr 30 11:02 lib -> usr/lib 
-drwxr-xr-x 2 root root 4096 Oct 29 16:17 sbin +lrwxrwxrwx  1 root root    9 Apr 30 11:02 lib32 -> usr/lib32 
-drwxr-xr-x root root 4096 Oct 29 16:17 scripts +lrwxrwxrwx  1 root root    9 Apr 30 11:02 lib64 -> usr/lib64 
-drwxr-xr-x root root 4096 Oct 29 16:17 usr +lrwxrwxrwx root root   10 Apr 30 11:02 libx32 -> usr/libx32 
-drwxr-xr-x 3 root root 4096 Oct 29 16:17 var+drwxr-xr-x  2 root root 4096 Apr 30 11:02 run 
 +lrwxrwxrwx  1 root root    8 Apr 30 11:02 sbin -> usr/sbin 
 +drwxr-xr-x 10 root root 4096 Apr 30 11:02 scripts 
 +drwxr-xr-x 10 root root 4096 Apr 30 11:02 usr 
 +drwxr-xr-x  3 root root 4096 Apr 30 11:02 var
 </code> </code>
- 
-====Le script init==== 
  
 Le script **init** est lancé lors du chargement de l'image : Le script **init** est lancé lors du chargement de l'image :
  
 <code> <code>
--rwxr-xr-x 1 root root 7057 Oct 29 16:17 init+root@debian11:/tmp/initrd# more init 
 +#!/bin/sh 
 + 
 +# Default PATH differs between shells, and is not automatically exported 
 +# by klibc dash.  Make it consistent. 
 +export PATH=/sbin:/usr/sbin:/bin:/usr/bin 
 + 
 +-d /dev ] || mkdir -m 0755 /dev 
 +-d /root ] || mkdir -m 0700 /root 
 +[ -d /sys ] || mkdir /sys 
 +[ -d /proc ] || mkdir /proc 
 +[ -d /tmp ] || mkdir /tmp 
 +mkdir -p /var/lock 
 +mount -t sysfs -o nodev,noexec,nosuid sysfs /sys 
 +mount -t proc -o nodev,noexec,nosuid proc /proc 
 + 
 +# shellcheck disable=SC2013 
 +for x in $(cat /proc/cmdline); do 
 +        case $x in 
 +        initramfs.clear) 
 +                clear 
 +                ;; 
 +        quiet) 
 +                quiet=y 
 +                ;; 
 +        esac 
 +done 
 + 
 +if [ "$quiet" != "y" ]; then 
 +        quiet=n 
 +        echo "Loading, please wait..." 
 +fi 
 +export quiet 
 + 
 +# Note that this only becomes /dev on the real filesystem if udev's scripts 
 +# are used; which they will be, but it's worth pointing out 
 +mount -t devtmpfs -o nosuid,mode=0755 udev /dev 
 +mkdir /dev/pts 
 +mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true 
 + 
 +# Export the dpkg architecture 
 +export DPKG_ARCH= 
 +. /conf/arch.conf 
 + 
 +# Set modprobe env 
 +export MODPROBE_OPTIONS="-qb" 
 + 
 +# Export relevant variables 
 +export ROOT= 
 +export ROOTDELAY= 
 +export ROOTFLAGS= 
 +export ROOTFSTYPE= 
 +export IP= 
 +export DEVICE= 
 +export BOOT= 
 +export BOOTIF= 
 +export UBIMTD= 
 +export break= 
 +export init=/sbin/init 
 +--More--(19%)
 </code> </code>
  
Ligne 836: Ligne 756:
 </WRAP> </WRAP>
  
-====La commande mkinitramfs====+===1.2 - La commande mkinitramfs===
  
 La commande **mkinitramfs** permet de créer facilement une image initramfs. Les options de la commande sont : La commande **mkinitramfs** permet de créer facilement une image initramfs. Les options de la commande sont :
Ligne 842: Ligne 762:
 Le fichier de configuration de mkinitramfs est **/etc/initramfs-tools/modules**. Editez ce fichier pour spécifier des modules noyau supplémentaires à inclure dans le fichier image générée : Le fichier de configuration de mkinitramfs est **/etc/initramfs-tools/modules**. Editez ce fichier pour spécifier des modules noyau supplémentaires à inclure dans le fichier image générée :
  
-<file>+<code> 
 +root@debian11:/tmp/initrd# vi /etc/initramfs-tools/modules 
 +root@debian11:/tmp/initrd# cat /etc/initramfs-tools/modules
 # List of modules that you want to include in your initramfs. # List of modules that you want to include in your initramfs.
 # They will be loaded at boot time in the order below. # They will be loaded at boot time in the order below.
Ligne 862: Ligne 784:
 scsi_mod scsi_mod
 sd_mod sd_mod
-</file>+</code>
  
 Exécutez maintenant la commande suivante afin de générer le fichier **usbinitramfs** : Exécutez maintenant la commande suivante afin de générer le fichier **usbinitramfs** :
  
 <code> <code>
-root@debian8:/tmp/initrd# mkinitramfs -o usbinitramfs-`uname -r`.img+root@debian11:/tmp/initrd# mkinitramfs -o usbinitramfs-`uname -r`.img
 </code> </code>
  
Ligne 873: Ligne 795:
  
 <code> <code>
-root@debian8:/tmp/initrd# ls -l /tmp/initrd/usbinitramfs-3.16.0-4-686-pae.img  +root@debian11:/tmp/initrd# ls -l /tmp/initrd/usbinitramfs-5.10.0-13-amd64.img  
--rw-r--r-- 1 root root 21454339 Oct 29 16:35 /tmp/initrd/usbinitramfs-3.16.0-4-686-pae.img+-rw-r--r-- 1 root root 47695493 Apr 30 11:12 /tmp/initrd/usbinitramfs-5.10.0-13-amd64.img
 </code> </code>
  
Ligne 880: Ligne 802:
  
 <code> <code>
-root@debian8:/tmp/initrd# mv usbinitramfs-3.16.0-4-686-pae.img /boot+root@debian11:/tmp/initrd# mv usbinitramfs-5.10.0-13-amd64.img /boot
 </code> </code>
  
 Créez maintenant le fichier **/etc/grub.d/09_usbdebian** : Créez maintenant le fichier **/etc/grub.d/09_usbdebian** :
  
-<file>+<code> 
 +root@debian11:/tmp/initrd# vi /etc/grub.d/09_usbdebian 
 +root@debian11:/tmp/initrd# cat /etc/grub.d/09_usbdebian
 #!/bin/sh -e #!/bin/sh -e
 cat << EOF cat << EOF
-menuentry 'Debian GNU/Linux et usbinitramfs' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0fc7a234-259a-416b-b674-51eedfb1823b' { +menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9887a74f-a680-4bde-8f04-db5ae9ea186e' { 
- load_video +        load_video 
- insmod gzio +        insmod gzio 
- if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi +        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi 
- insmod part_msdos +        insmod part_msdos 
- insmod ext2 +        insmod ext2 
- set root='hd0,msdos1' +        set root='hd0,msdos1' 
- if [ x$feature_platform_search_hint = xy ]; then +        if [ x$feature_platform_search_hint = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e 
- else +        else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +          search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e 
- fi +        fi 
- echo 'Loading Linux 3.16.0-4-686-pae ...' +        echo    'Loading Linux 5.10.0-13-amd64 ...' 
- linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro initrd=/install/gtk/initrd.gz quiet +        linux   /boot/vmlinuz-5.10.0-13-amd64 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro  quiet 
- echo 'Loading initial ramdisk ...' +        echo    'Loading initial ramdisk ...' 
- initrd /boot/usbinitramfs-3.16.0-4-686-pae.img+        initrd  /boot/usbinitramfs-5.10.0-13-amd64.img
 } }
 EOF EOF
-</file>+</code>
  
 Rendez ce fichier exécutable : Rendez ce fichier exécutable :
  
 <code> <code>
-root@debian8:/tmp/initrd# chmod +x /etc/grub.d/09_usbdebian+root@debian11:/tmp/initrd# chmod +x /etc/grub.d/09_usbdebian
 </code> </code>
- 
-Avant de continuer, supprimer le fichier **/etc/grub.d/01_users** et éditez le contenu du fichier **/etc/grub.d/40_custom** ainsi : 
- 
-<file> 
-#!/bin/sh 
-exec tail -n +3 $0 
-# This file provides an easy way to add custom menu entries.  Simply type the 
-# menu entries you want to add after this comment.  Be careful not to change 
-# the 'exec tail' line above. 
-</file> 
  
 Mettez à jour grub afin que celui-ci prend en compte le nouveau fichier : Mettez à jour grub afin que celui-ci prend en compte le nouveau fichier :
  
 <code> <code>
-root@debian8:/tmp/initrd# update-grub+root@debian11:/tmp/initrd# grub-mkconfig -o /boot/grub/grub.cfg
 Generating grub configuration file ... Generating grub configuration file ...
 Found background image: /usr/share/images/desktop-base/desktop-grub.png Found background image: /usr/share/images/desktop-base/desktop-grub.png
-Found linux image: /boot/vmlinuz-3.16.0-4-686-pae +Found linux image: /boot/vmlinuz-5.10.0-13-amd64 
-Found initrd image: /boot/initrd.img-3.16.0-4-686-pae +Found initrd image: /boot/initrd.img-5.10.0-13-amd64
-Found linux image: /boot/vmlinuz-3.16.0-4-586 +
-Found initrd image: /boot/initrd.img-3.16.0-4-586 +
-Found memtest86+ image: /boot/memtest86+.bin +
-Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin+
 done done
 </code> </code>
- 
-<WRAP center round important> 
-**Important** : Notez l'utilisation de la commande **update-grub** en lieu et place de la commande **grub-mkconfig -o /boot/grub/grub.cfg**. 
-</WRAP> 
  
 Controlez le fichier /boot/grub/grub.cfg : Controlez le fichier /boot/grub/grub.cfg :
Ligne 947: Ligne 853:
 <file> <file>
 ... ...
 +### END /etc/grub.d/05_debian_theme ###
 +
 ### BEGIN /etc/grub.d/09_usbdebian ### ### BEGIN /etc/grub.d/09_usbdebian ###
-menuentry 'Debian GNU/Linux et usbinitramfs' --class debian --class gnu-linux --class gnu --class os  'gnulinux-simple-0fc7a234-259a-416b-b674-51eedfb1823b' { +menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os  'gnulinux-simple-9887a74f-a680-4bde-8f04-db5ae9ea186e' { 
- load_video +        load_video 
- insmod gzio +        insmod gzio 
- if [ x = xxen ]; then insmod xzio; insmod lzopio; fi +        if [ x = xxen ]; then insmod xzio; insmod lzopio; fi 
- insmod part_msdos +        insmod part_msdos 
- insmod ext2 +        insmod ext2 
- set root='hd0,msdos1' +        set root='hd0,msdos1' 
- if [ x = xy ]; then +        if [ x = xy ]; then 
-   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  0fc7a234-259a-416b-b674-51eedfb1823b +          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  9887a74f-a680-4bde-8f04-db5ae9ea186e 
- else +        else 
-   search --no-floppy --fs-uuid --set=root 0fc7a234-259a-416b-b674-51eedfb1823b +          search --no-floppy --fs-uuid --set=root 9887a74f-a680-4bde-8f04-db5ae9ea186e 
- fi +        fi 
- echo 'Loading Linux 3.16.0-4-686-pae ...' +        echo    'Loading Linux 5.10.0-13-amd64 ...' 
- linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=0fc7a234-259a-416b-b674-51eedfb1823b ro initrd=/install/gtk/initrd.gz quiet +        linux   /boot/vmlinuz-5.10.0-13-amd64 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro  quiet 
- echo 'Loading initial ramdisk ...' +        echo    'Loading initial ramdisk ...' 
- initrd /boot/usbinitramfs-3.16.0-4-686-pae.img+        initrd  /boot/usbinitramfs-5.10.0-13-amd64.img
 } }
 ### END /etc/grub.d/09_usbdebian ### ### END /etc/grub.d/09_usbdebian ###
Ligne 970: Ligne 878:
 ... ...
 </file> </file>
- 
-<WRAP center round todo> 
-**A faire** : **Re-démarrez votre machine pour tester votre configuration.** 
-</WRAP> 
  
 =====Processus de Démarrage du Noyau Linux===== =====Processus de Démarrage du Noyau Linux=====
Ligne 989: Ligne 893:
 La fonction **init_post()** essaie ensuite d'exécuter un des processus suivant dans l'ordre : La fonction **init_post()** essaie ensuite d'exécuter un des processus suivant dans l'ordre :
  
-  * /sbin/init+  * /sbin/init ==> /lib/systemd/systemd
   * /etc/init   * /etc/init
   * /bin/init   * /bin/init
-  * /bin/sh +  * /bin/sh ==> /bin/dash ==> /usr/bin/dash 
 + 
 +<code> 
 +root@debian11:/tmp/initrd# ls -l /sbin/init 
 +lrwxrwxrwx 1 root root 20 Mar 20 20:55 /sbin/init -> /lib/systemd/systemd 
 +root@debian11:/tmp/initrd# ls -l /etc/init 
 +ls: cannot access '/etc/init': No such file or directory 
 +root@debian11:/tmp/initrd# ls -l /bin/init 
 +ls: cannot access '/bin/init': No such file or directory 
 +root@debian11:/tmp/initrd# ls -l /bin/sh 
 +lrwxrwxrwx 1 root root 4 Apr 25 06:30 /bin/sh -> dash 
 +root@debian11:/tmp/initrd# ls -l /bin/dash 
 +-rwxr-xr-x 1 root root 125560 Dec 10  2020 /bin/dash 
 +root@debian11:/tmp/initrd# ls -l /usr/bin/dash 
 +-rwxr-xr-x 1 root root 125560 Dec 10  2020 /usr/bin/dash 
 +</code>
  
 Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché. Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché.
  
-=====Processus Init=====+=====Systemd=====
  
-Le premier processus lancé par le noyau est **Init**. L'exécutable lancé est **/sbin/init**. Son rôle est de d'initialiser le système et de lancer certains autres servicesLes tâches accomplies par init sont :+Les systèmes de démarrage antérieurs à Systemd, **SysVinit** et **Upstart**, étaient des systèmes de démarrage **séquentiels**
  
-  le montage de /proc et de /sys, +**Systemd** essaie, par contre, de démarrer autant de services en parallèle que possible. Ceci est rendu possible car la majorité d'architectures matérielles modernes sont multi-cœurs. Si un service dépend d'un autre qui n'est pas encore démarré ce premier est mis en attente dans une mémoire tampon. Qui plus estles services qui ne sont pas nécessaires au démarrage de la machine, tel cupsne sont démarrés ultérieurement que si nécessaire. Lors de démarrageles partitions sont montées en parallèle. Dernièrement, **Systemd** remplace les scripts de démarrage traditionnels avec des binaires compilésbeaucoup plus rapides que leur prédécesseurs.
-  configuration des paramètres du noyau présents dans **/etc/sysctl.conf**, +
-  * l'activation de %%SELinux%%, +
-  * la mise à l'heure du système, +
-  * la définition des consoles textes, +
-  * la définition du nom de la machine, +
-  * la détection des périphériques USB, +
-  * la mise en place du support RAID et LVM, +
-  * l'activation des quotas de disque, +
-  * le montages des systèmes de fichiers, +
-  * le re-montage du système de fichiers racine en lecture/écriture, +
-  l'activation du swap, +
-  le lancement de syslog, +
-  le chargement des modules du noyau, +
-  le nettoyage des fichiers temporaires, +
-  * la définition des variables d'environnement tels PATH et RUNLEVEL+
  
-=====Démarrer Debian 6 avec SysVinit=====+Au lieu de parler de scripts de démarrage et de niveaux d'exécution, **Systemd** utilise la terminologie **Unités** (//Units//) et **Cibles** (//Targets//). Une Unité peut être :
  
-====Niveaux d'exécution sous Debian 6====+  * **.automount** - active la fonctionalité d'automount. 
 +  * **.device** - expose une périphérique dans systemd. 
 +  * **.mount** - contrôle quand et comment les systèmes de fichiers sont montés. 
 +  * **.path** - active un service quand il y a un accès à un fichier ou répertoire sous surveillance par le système. 
 +  * **.service** - démarre, arrête, redémarre ou recharge un service. 
 +  * **.scope** - gère des services. 
 +  * **.slice** - regroupe des Unités dans une arborescence afin de limiter des ressources en utilisant des CGroups. 
 +  * **.snapshot** - un état sauvegardé du gestionnaire Systemd. 
 +  * **.socket** - permet aux Unités d'utiliser des sockets pour la communication inter-processus. 
 +  * **.swap** - encapsule une périphérique ou un fichier swap. 
 +  * **.timer** - déclenche l'activation d'autres Unités en utilisant des minuteurs de Systemd. 
 +  * **.target** - regroupe des Unités multiples afin qu'elles puissent être démarrées en même temps. Par exemple **network.target** regroupe toutes les Unités nécessaires pour démarrer toutes les interfaces réseaux en même temps.
  
-Il existe 8 niveaux d'exécution ou **RUNLEVELS** sous Linux. Quatre des 8 sont réservés :+Une Cible est en quelque sorte une **grande étape** dans le démarrage du système :
  
-^ RUNLEVEL ^ Description ^ +  * **halt.target** - arrête le système. 
-| 0 | Arrêt de la machine | +  * **poweroff.target** - arrête le système et coupe le courant. 
-| 1 | Mode mono-utilisateur pour la maintenance | +  * **shutdown.target** arrête le système. 
-| 6 | Redémarrage de la machine | +  * **rescue.target** - démarre le système en mode single-user (seul root peut s'y connecter). Tous les systèmes de fichiers sont montés mais le réseau n'est pas démarré. 
-| S ou | Mode mono-utilisateur avec seul la partition racine montée |+  * **emergency.target** - démarre le système en mode single-user (seul root peut s'y connecter). Uniquement le système de fichiers racine est monté en mode lecture seule. Le réseau n'est pas démarré. 
 +  * **multi-user.target** - démarre le système en mode multi-utilisateur avec tous les systèmes de fichiers montés et le service network démarré. 
 +  * **graphical.target** - démarre le système en multi-user.target puis démarre l'interface graphique. 
 +  * **hibernate.target** - sauvegarde l'état courant sur disque et arrête le système. Quand le système est démarré, l'état est restauré. 
 +  * **reboot.target** - redémarre le système.
  
-Les autres quatre RUNLEVELS sont définis par chaque distributionPar exemplesous Debian, ils sont :+**Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d'exécutionPour rendre la transition plus facileil existe des **Cibles** qui "simulent" les niveaux d'exécution de **SysVinit** :
  
-^ RUNLEVEL ^ Description ^ +<code> 
-| 2 | Mode multi-utilisateur | +root@debian11:/tmp/initrd# ls -l /usr/lib/systemd/system/runlevel* 
-| 3 | Mode multi-utilisateur Non-utilisé| +lrwxrwxrwx 1 root root   15 Mar 20 20:55 /usr/lib/systemd/system/runlevel0.target -> poweroff.target 
-| 4 | Mode multi-utilisateur Non-utilisé | +lrwxrwxrwx 1 root root   13 Mar 20 20:55 /usr/lib/systemd/system/runlevel1.target -> rescue.target 
-| 5 | Mode multi-utilisateur Non-utilisé |+lrwxrwxrwx 1 root root   17 Mar 20 20:55 /usr/lib/systemd/system/runlevel2.target -> multi-user.target 
 +lrwxrwxrwx 1 root root   17 Mar 20 20:55 /usr/lib/systemd/system/runlevel3.target -> multi-user.target 
 +lrwxrwxrwx 1 root root   17 Mar 20 20:55 /usr/lib/systemd/system/runlevel4.target -> multi-user.target 
 +lrwxrwxrwx 1 root root   16 Mar 20 20:55 /usr/lib/systemd/system/runlevel5.target -> graphical.target 
 +lrwxrwxrwx 1 root root   13 Mar 20 20:55 /usr/lib/systemd/system/runlevel6.target -> reboot.target
  
-Il existe aussi 3 pseudo-niveaux d'exécution **a**, **b** et **c**Ces pseudo-niveaux permettent à init de faire quelquechose sans changer de niveau d'exécution.+/usr/lib/systemd/system/runlevel1.target.wants: 
 +total 0
  
-Pour connaître le niveau d'exécution actuel de la machine, saisissez la commande suivante :+/usr/lib/systemd/system/runlevel2.target.wants: 
 +total 0 
 + 
 +/usr/lib/systemd/system/runlevel3.target.wants: 
 +total 0 
 + 
 +/usr/lib/systemd/system/runlevel4.target.wants: 
 +total 0 
 + 
 +/usr/lib/systemd/system/runlevel5.target.wants: 
 +total 0 
 +</code> 
 + 
 +====LAB #2 - La Commande systemctl==== 
 + 
 +Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option **list-units** :
  
 <code> <code>
-root@debian6:~# runlevel +root@debian11:/tmp/initrd# cd ~ 
-2+root@debian11:~# systemctl list-units 
 +  UNIT                                                                                         LOAD   ACTIVE SUB       DESCRIPTION 
 +  proc-sys-fs-binfmt_misc.automount                                                            loaded active waiting   Arbitrary Executable File Formats File System Automount Point                 
 +  sys-devices-pci0000:00-0000:00:01.1-ata2-host1-target1:0:0-1:0:0:0-block-sr0.device          loaded active plugged   QEMU_DVD-ROM Debian_11.3.0_amd64_n 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:0-block-sdb-sdb1.device  loaded active plugged   QEMU_HARDDISK 1 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:0-block-sdb-sdb2.device  loaded active plugged   QEMU_HARDDISK 2 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:0-block-sdb-sdb5.device  loaded active plugged   QEMU_HARDDISK 5 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:0-block-sdb.device       loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc1.device  loaded active plugged   QEMU_HARDDISK 1 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc10.device loaded active plugged   QEMU_HARDDISK 10 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc11.device loaded active plugged   QEMU_HARDDISK 11 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc12.device loaded active plugged   QEMU_HARDDISK 12 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc2.device  loaded active plugged   QEMU_HARDDISK 2 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc3.device  loaded active plugged   QEMU_HARDDISK 3 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc4.device  loaded active plugged   QEMU_HARDDISK 4 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc5.device  loaded active plugged   QEMU_HARDDISK 5 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc6.device  loaded active plugged   QEMU_HARDDISK 6 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc7.device  loaded active plugged   QEMU_HARDDISK 7 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc8.device  loaded active plugged   QEMU_HARDDISK my_reiserfs 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc-sdc9.device  loaded active plugged   QEMU_HARDDISK 9 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:1-block-sdc.device       loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:05.0-virtio1-host2-target2:0:0-2:0:0:2-block-sda.device       loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:12.0-virtio2-net-ens18.device                                 loaded active plugged   Virtio network device 
 +  sys-devices-platform-serial8250-tty-ttyS0.device                                             loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS0 
 +  sys-devices-platform-serial8250-tty-ttyS1.device                                             loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS1 
 +  sys-devices-platform-serial8250-tty-ttyS2.device                                             loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS2 
 +  sys-devices-platform-serial8250-tty-ttyS3.device                                             loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS3 
 +  sys-devices-virtual-block-dm\x2d0.device                                                     loaded active plugged   /sys/devices/virtual/block/dm-0 
 +  sys-devices-virtual-block-dm\x2d1.device                                                     loaded active plugged   /sys/devices/virtual/block/dm-1 
 +  sys-devices-virtual-block-dm\x2d2.device                                                     loaded active plugged   /sys/devices/virtual/block/dm-2 
 +  sys-devices-virtual-misc-rfkill.device                                                       loaded active plugged   /sys/devices/virtual/misc/rfkill 
 +  sys-module-configfs.device                                                                   loaded active plugged   /sys/module/configfs 
 +  sys-module-fuse.device                                                                       loaded active plugged   /sys/module/fuse 
 +  sys-subsystem-net-devices-ens18.device                                                       loaded active plugged   Virtio network device                                                         
 +  -.mount                                                                                      loaded active mounted   Root Mount 
 +  dev-hugepages.mount                                                                          loaded active mounted   Huge Pages File System 
 +  dev-mqueue.mount                                                                             loaded active mounted   POSIX Message Queue File System 
 +  mnt-sdc11.mount                                                                              loaded active mounted   /mnt/sdc11 
 +  mnt-sdc12.mount                                                                              loaded active mounted   /mnt/sdc12 
 +  run-user-1000.mount                                                                          loaded active mounted   /run/user/1000 
 +  run-user-113.mount                                                                           loaded active mounted   /run/user/113 
 +  sys-fs-fuse-connections.mount                                                                loaded active mounted   FUSE Control File System 
 +  sys-kernel-config.mount                                                                      loaded active mounted   Kernel Configuration File System 
 +  sys-kernel-debug.mount                                                                       loaded active mounted   Kernel Debug File System 
 +  sys-kernel-tracing.mount                                                                     loaded active mounted   Kernel Trace File System                                                      
 +  cups.path                                                                                    loaded active running   CUPS Scheduler 
 +  systemd-ask-password-plymouth.path                                                           loaded active waiting   Forward Password Requests to Plymouth Directory Watch 
 +  systemd-ask-password-wall.path                                                               loaded active waiting   Forward Password Requests to Wall Directory Watch                             
 +  init.scope                                                                                   loaded active running   System and Service Manager 
 +  session-180.scope                                                                            loaded active running   Session 180 of user trainee 
 +  session-c1.scope                                                                             loaded active running   Session c1 of user lightdm                                                    
 +  apparmor.service                                                                             loaded active exited    Load AppArmor profiles 
 +  auditd.service                                                                               loaded active running   Security Auditing Service 
 +  avahi-daemon.service                                                                         loaded active running   Avahi mDNS/DNS-SD Stack 
 +  blk-availability.service                                                                     loaded active exited    Availability of block devices 
 +  console-setup.service                                                                        loaded active exited    Set console font and keymap 
 +  cron.service                                                                                 loaded active running   Regular background program processing daemon 
 +  cups-browsed.service                                                                         loaded active running   Make remote CUPS printers available locally 
 +  cups.service                                                                                 loaded active running   CUPS Scheduler 
 +lines 1-58 
 +[q]
 </code> </code>
  
-La lettre N indique que le système n'a pas changé de niveau d'exécution depuis son démarrage.+Pour consulter la liste des Unités inactifs, utilisez la commande suivante :
  
-Pour modifier le niveau d'exécution courant, il convient d'utiliser la commande **init** ou **telinit** suivie du numéro du nouveau niveau d'exécution. Ces commandes peuvent prendre plusieurs options :+<code> 
 +root@debian11:~# systemctl list-units --all | grep inactive | more 
 +● home.mount                                                                                                     not-found inactive dead      home.mount 
 +  proc-sys-fs-binfmt_misc.mount                                                                                  loaded    inactive dead      Arbitrary Executable File Formats File System 
 +● tmp.mount                                                                                                      not-found inactive dead      tmp.mount 
 +  systemd-ask-password-console.path                                                                              loaded    inactive dead      Dispatch Password Requests to Console Directory Watch 
 +  anacron.service                                                                                                loaded    inactive dead      Run anacron jobs 
 +  apt-daily-upgrade.service                                                                                      loaded    inactive dead      Daily apt upgrade and clean activities 
 +  apt-daily.service                                                                                              loaded    inactive dead      Daily apt download activities 
 +● connman.service                                                                                                not-found inactive dead      connman.service 
 +● console-screen.service                                                                                         not-found inactive dead      console-screen.service 
 +  dm-event.service                                                                                               loaded    inactive dead      Device-mapper event daemon 
 +  e2scrub_all.service                                                                                            loaded    inactive dead      Online ext4 Metadata Check for All Filesystems 
 +  e2scrub_reap.service                                                                                           loaded    inactive dead      Remove Stale Online ext4 Metadata Check Snapshots 
 +  emergency.service                                                                                              loaded    inactive dead      Emergency Shell 
 +● fcoe.service                                                                                                   not-found inactive dead      fcoe.service 
 +  fstrim.service                                                                                                 loaded    inactive dead      Discard unused blocks on filesystems from /etc/fstab 
 +  getty-static.service                                                                                           loaded    inactive dead      getty on tty2-tty6 if dbus and logind are not available 
 +● iscsi-shutdown.service                                                                                         not-found inactive dead      iscsi-shutdown.service 
 +● iscsi.service                                                                                                  not-found inactive dead      iscsi.service 
 +● iscsid.service                                                                                                 not-found inactive dead      iscsid.service 
 +● kbd.service                                                                                                    not-found inactive dead      kbd.service 
 +  logrotate.service                                                                                              loaded    inactive dead      Rotate log files 
 +● lvm2-activation.service                                                                                        not-found inactive dead      lvm2-activation.service 
 +  lvm2-lvmpolld.service                                                                                          loaded    inactive dead      LVM2 poll daemon 
 +  man-db.service                                                                                                 loaded    inactive dead      Daily man-db regeneration 
 +  mlocate.service                                                                                                loaded    inactive dead      Update a database for mlocate 
 +  modprobe@configfs.service                                                                                      loaded    inactive dead      Load Kernel Module configfs 
 +  modprobe@drm.service                                                                                           loaded    inactive dead      Load Kernel Module drm 
 +  modprobe@fuse.service                                                                                          loaded    inactive dead      Load Kernel Module fuse 
 +● nslcd.service                                                                                                  not-found inactive dead      nslcd.service 
 +  plymouth-quit.service                                                                                          loaded    inactive dead      Terminate Plymouth Boot Screen 
 +● rbdmap.service                                                                                                 not-found inactive dead      rbdmap.service 
 +  rc-local.service                                                                                               loaded    inactive dead      /etc/rc.local Compatibility 
 +  rescue.service                                                                                                 loaded    inactive dead      Rescue Shell 
 +  rsync.service                                                                                                  loaded    inactive dead      fast remote file copy program daemon 
 +● sssd.service                                                                                                   not-found inactive dead      sssd.service 
 +  systemd-ask-password-console.service                                                                           loaded    inactive dead      Dispatch Password Requests to Console 
 +  systemd-ask-password-plymouth.service                                                                          loaded    inactive dead      Forward Password Requests to Plymouth 
 +  systemd-ask-password-wall.service                                                                              loaded    inactive dead      Forward Password Requests to Wall 
 +  systemd-binfmt.service                                                                                         loaded    inactive dead      Set Up Additional Binary Formats 
 +  systemd-boot-system-token.service                                                                              loaded    inactive dead      Store a System Token in an EFI Variable 
 +  systemd-cryptsetup@sdc11.service                                                                               loaded    inactive dead      Cryptography Setup for sdc11 
 +  systemd-fsck-root.service                                                                                      loaded    inactive dead      File System Check on Root Device 
 +  systemd-fsck@dev-mapper-sdc11.service                                                                          loaded    inactive dead      File System Check on /dev/mapper/sdc11 
 +  systemd-fsckd.service                                                                                          loaded    inactive dead      File System Check Daemon to report status 
 +  systemd-hwdb-update.service                                                                                    loaded    inactive dead      Rebuild Hardware Database 
 +  systemd-initctl.service                                                                                        loaded    inactive dead      initctl Compatibility Daemon 
 +  systemd-machine-id-commit.service                                                                              loaded    inactive dead      Commit a transient machine-id on disk 
 +  systemd-networkd.service                                                                                       loaded    inactive dead      Network Service 
 +  systemd-pstore.service                                                                                         loaded    inactive dead      Platform Persistent Storage Archival 
 +  systemd-quotacheck.service                                                                                     loaded    inactive dead      File System Quota Check 
 +  systemd-rfkill.service                                                                                         loaded    inactive dead      Load/Save RF Kill Switch Status 
 +  systemd-tmpfiles-clean.service                                                                                 loaded    inactive dead      Cleanup of Temporary Directories 
 +● systemd-update-done.service                                                                                    not-found inactive dead      systemd-update-done.service 
 +  systemd-update-utmp-runlevel.service                                                                           loaded    inactive dead      Update UTMP about System Runlevel Changes 
 +● systemd-vconsole-setup.service                                                                                 not-found inactive dead      systemd-vconsole-setup.service 
 +● ypbind.service                                                                                                 not-found inactive dead      ypbind.service 
 +  system-systemd\x2dcryptsetup.slice                                                                             loaded    inactive dead      Cryptsetup Units Slice 
 +  system-systemd\x2dfsck.slice                                                                                   loaded    inactive dead      system-systemd\x2dfsck.slice 
 +--More-- 
 +[q] 
 +</code>
  
-^ Option ^ Description ^ +Les points noirs au début de certaines lignes dans la sortie ci-dessus sont en réalité des points blancs à l'écran. Ces points impliquent que le service, la cible ou l'unité spécifié n'a pas été trouvé sur le système. Par exemple :
-| Q ou q | Demande à Init de relire le fichier /etc/inittab | +
--t | Permet de modifier le temps accordé par Init aux processus entre l'envoi du signal SIGTERM et l'envoi du signal SIGKILL |+
  
-====Inittab====+<code> 
 +root@debian11:~# systemctl status connman 
 +Unit connman.service could not be found. 
 +</code>
  
-Le fichier **/etc/inittab** permet de définir les services à démarrer en fonction du RUNLEVEL :+Pour consulter la liste des Unités ainsi que leurs statuts, utilisez la commande suivante :
  
 <code> <code>
-root@debian6:~# cat /etc/inittab  +root@debian11:~# systemctl list-unit-files | more 
-# /etc/inittab: init(8) configuration+UNIT FILE                                                                 STATE           VENDOR PRESET 
-# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $+proc-sys-fs-binfmt_misc.automount                                         static          - 
 +-.mount                                                                   generated       - 
 +dev-hugepages.mount                                                       static          - 
 +dev-mqueue.mount                                                          static          - 
 +media-cdrom0.mount                                                        generated       - 
 +mnt-sdc11.mount                                                           generated       - 
 +proc-sys-fs-binfmt_misc.mount                                             disabled        disabled 
 +sys-fs-fuse-connections.mount                                             static          - 
 +sys-kernel-config.mount                                                   static          - 
 +sys-kernel-debug.mount                                                    static          - 
 +sys-kernel-tracing.mount                                                  static          - 
 +cups.path                                                                 enabled         enabled 
 +systemd-ask-password-console.path                                         static          - 
 +systemd-ask-password-plymouth.path                                        static          - 
 +systemd-ask-password-wall.path                                            static          - 
 +session-180.scope                                                         transient       - 
 +session-c1.scope                                                          transient       - 
 +alsa-restore.service                                                      static          - 
 +alsa-state.service                                                        static          - 
 +alsa-utils.service                                                        masked          enabled 
 +anacron.service                                                           enabled         enabled 
 +apparmor.service                                                          enabled         enabled 
 +apt-daily-upgrade.service                                                 static          - 
 +apt-daily.service                                                         static          - 
 +auditd.service                                                            enabled         enabled 
 +autovt@.service                                                           alias           - 
 +avahi-daemon.service                                                      enabled         enabled 
 +blk-availability.service                                                  enabled         enabled 
 +colord.service                                                            static          - 
 +configure-printer@.service                                                static          - 
 +console-getty.service                                                     disabled        disabled 
 +console-setup.service                                                     enabled         enabled 
 +container-getty@.service                                                  static          - 
 +cron.service                                                              enabled         enabled 
 +cryptdisks-early.service                                                  masked          enabled 
 +cryptdisks.service                                                        masked          enabled 
 +cups-browsed.service                                                      enabled         enabled 
 +cups.service                                                              enabled         enabled 
 +dbus-fi.w1.wpa_supplicant1.service                                        alias           - 
 +dbus-org.freedesktop.Avahi.service                                        alias           - 
 +dbus-org.freedesktop.hostname1.service                                    alias           - 
 +dbus-org.freedesktop.locale1.service                                      alias           - 
 +dbus-org.freedesktop.login1.service                                       alias           - 
 +dbus-org.freedesktop.ModemManager1.service                                alias           - 
 +dbus-org.freedesktop.nm-dispatcher.service                                alias           - 
 +dbus-org.freedesktop.timedate1.service                                    alias           - 
 +dbus-org.freedesktop.timesync1.service                                    alias           - 
 +dbus.service                                                              static          - 
 +debug-shell.service                                                       disabled        disabled 
 +display-manager.service                                                   alias           - 
 +dm-event.service                                                          static          - 
 +e2scrub@.service                                                          static          - 
 +e2scrub_all.service                                                       static          - 
 +e2scrub_fail@.service                                                     static          - 
 +e2scrub_reap.service                                                      enabled         enabled 
 +emergency.service                                                         static          - 
 +fstrim.service                                                            static          - 
 +--More-- 
 +[q] 
 +</code>
  
-# The default runlevel. +Pour visualiser les Unités d'un type spécifique, il convient d'utiliser l'option **-t** :
-id:2:initdefault:+
  
-Boot-time system configuration/initialization script+<code> 
-# This is run first except when booting in emergency (-b) mode+root@debian11:~systemctl list-unit-files -t mount 
-si::sysinit:/etc/init.d/rcS+UNIT FILE                     STATE     VENDOR PRESET 
 +-.mount                       generated -             
 +dev-hugepages.mount           static    -             
 +dev-mqueue.mount              static    -             
 +media-cdrom0.mount            generated -             
 +mnt-sdc11.mount               generated -             
 +proc-sys-fs-binfmt_misc.mount disabled  disabled      
 +sys-fs-fuse-connections.mount static    -             
 +sys-kernel-config.mount       static    -             
 +sys-kernel-debug.mount        static    -             
 +sys-kernel-tracing.mount      static    -            
  
-# What to do in single-user mode+10 unit files listed
-~~:S:wait:/sbin/sulogin+</code>
  
-# /etc/init.d executes the S and K scripts upon change +Dans la colonne STATE on voit les mots **static** et **generated**
-# of runlevel. +
-+
-# Runlevel 0 is halt. +
-# Runlevel 1 is single-user. +
-# Runlevels 2-5 are multi-user. +
-# Runlevel 6 is reboot.+
  
-l0:0:wait:/etc/init.d/rc 0 +  * STATE = static 
-l1:1:wait:/etc/init.d/rc 1 +    * Ceci implique que l'Unité ne peut ni être démarrée, ni être arrêtée par l'administrateurLe démarrage et l'arrêt d'une telle Unité est effectué par le systèmeEn règle générale, les Unités dont le STATE est static sont des dépendances d'autres Unité
-l2:2:wait:/etc/init.d/rc 2 +
-l3:3:wait:/etc/init.d/rc 3 +
-l4:4:wait:/etc/init.d/rc 4 +
-l5:5:wait:/etc/init.d/rc 5 +
-l6:6:wait:/etc/init.d/rc 6 +
-# Normally not reached, but fallthrough in case of emergency. +
-z6:6:respawn:/sbin/sulogin+
  
-# What to do when CTRL-ALT-DEL is pressed. +  * STATE = generated 
-ca:12345:ctrlaltdel:/sbin/shutdown -t1 --r now+    * Ceci implique que le fichier a été généré automatiquement en utilisant les informations dans le fichier **/etc/fstab** lors du démarrage du système. Dans le cas d'un point de montage, l'exécutable respopnsable de la génération du fichier est **/lib/systemd/system-generators/systemd-fstab-generator** :
  
-Action on special keypress (ALT-UpArrow). +<code> 
-#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."+root@debian11:~ls -l /lib/systemd/system-generators/systemd-fstab-generator 
 +-rwxr-xr-x 1 root root 43440 Mar 20 20:55 /lib/systemd/system-generators/systemd-fstab-generator 
 +</code>
  
-# What to do when the power fails/returns. +Il existe aussi d'autres exécutables responsables de la génération d'autres fichiers :
-pf::powerwait:/etc/init.d/powerfail start +
-pn::powerfailnow:/etc/init.d/powerfail now +
-po::powerokwait:/etc/init.d/powerfail stop+
  
-# /sbin/getty invocations for the runlevels. +<code> 
-# +root@debian11:~ls -l /lib/systemd/system-generators 
-# The "id" field MUST be the same as the last +total 420 
-# characters of the device (after "tty"). +-rwxr-xr-x 1 root root 146872 Feb 22  2021 lvm2-activation-generator 
-# +-rwxr-xr-x 1 root root  14488 Mar 20 20:55 systemd-bless-boot-generator 
-# Format+-rwxr-xr-x 1 root root  35176 Mar 20 20:55 systemd-cryptsetup-generator 
- <id>:<runlevels>:<action>:<process> +-rwxr-xr-x 1 root root  14632 Mar 20 20:55 systemd-debug-generator 
-+-rwxr-xr-x 1 root root  43440 Mar 20 20:55 systemd-fstab-generator 
-# Note that on most Debian systems tty7 is used by the X Window System, +-rwxr-xr-x 1 root root  14480 Mar 20 20:55 systemd-getty-generator 
-# so if you want to add more getty's go ahead but skip tty7 if you run X. +-rwxr-xr-x 1 root root  34968 Mar 20 20:55 systemd-gpt-auto-generator 
-# +-rwxr-xr-x root root  14624 Mar 20 20:55 systemd-hibernate-resume-generator 
-1:2345:respawn:/sbin/getty 38400 tty1 +-rwxr-xr-x 1 root root  14480 Mar 20 20:55 systemd-rc-local-generator 
-2:23:respawn:/sbin/getty 38400 tty2 +-rwxr-xr-x 1 root root  14616 Mar 20 20:55 systemd-run-generator 
-3:23:respawn:/sbin/getty 38400 tty3 +-rwxr-xr-x 1 root root  14480 Mar 20 20:55 systemd-system-update-generator 
-4:23:respawn:/sbin/getty 38400 tty4 +-rwxr-xr-x 1 root root  30936 Mar 20 20:55 systemd-sysv-generator 
-5:23:respawn:/sbin/getty 38400 tty5 +-rwxr-xr-x 1 root root  14624 Mar 20 20:55 systemd-veritysetup-generator 
-6:23:respawn:/sbin/getty 38400 tty6+</code>
  
-# Example how to put a getty on a serial line (for a terminal) +Les options de la commande **systemctl** sont :
-+
-#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 +
-#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100+
  
-Example how to put getty on modem line+<code> 
-# +root@debian11:~systemctl --help 
-#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3+systemctl [OPTIONS...] COMMAND ... 
 + 
 +Query or send control commands to the system manager. 
 + 
 +Unit Commands: 
 +  list-units [PATTERN...]             List units currently in memory 
 +  list-sockets [PATTERN...]           List socket units currently in memory, 
 +                                      ordered by address 
 +  list-timers [PATTERN...]            List timer units currently in memory, 
 +                                      ordered by next elapse 
 +  is-active PATTERN...                Check whether units are active 
 +  is-failed PATTERN...                Check whether units are failed 
 +  status [PATTERN...|PID...]          Show runtime status of one or more units 
 +  show [PATTERN...|JOB...]            Show properties of one or more 
 +                                      units/jobs or the manager 
 +  cat PATTERN...                      Show files and drop-ins of specified units 
 +  help PATTERN...|PID...              Show manual for one or more units 
 +  list-dependencies [UNIT...]         Recursively show units which are required 
 +                                      or wanted by the units or by which those 
 +                                      units are required or wanted 
 +  start UNIT...                       Start (activate) one or more units 
 +  stop UNIT...                        Stop (deactivate) one or more units 
 +  reload UNIT...                      Reload one or more units 
 +  restart UNIT...                     Start or restart one or more units 
 +  try-restart UNIT...                 Restart one or more units if active 
 +  reload-or-restart UNIT...           Reload one or more units if possible, 
 +                                      otherwise start or restart 
 +  try-reload-or-restart UNIT...       If active, reload one or more units, 
 +                                      if supported, otherwise restart 
 +  isolate UNIT                        Start one unit and stop all others 
 +  kill UNIT...                        Send signal to processes of unit 
 +  clean UNIT...                       Clean runtime, cache, state, logs or 
 +                                      configuration of unit 
 +  freeze PATTERN...                   Freeze execution of unit processes 
 +  thaw PATTERN...                     Resume execution of frozen unit 
 +  set-property UNIT PROPERTY=VALUE... Sets one or more properties of a unit 
 +  service-log-level SERVICE [LEVEL]   Get/set logging threshold for service 
 +  service-log-target SERVICE [TARGET] Get/set logging target for service 
 +  reset-failed [PATTERN...]           Reset failed state for all, one, or more 
 +                                      units 
 +Unit File Commands: 
 +  list-unit-files [PATTERN...]        List installed unit files 
 +  enable [UNIT...|PATH...]            Enable one or more unit files 
 +  disable UNIT...                     Disable one or more unit files 
 +  reenable UNIT...                    Reenable one or more unit files 
 +  preset UNIT...                      Enable/disable one or more unit files 
 +                                      based on preset configuration 
 +  preset-all                          Enable/disable all unit files based on 
 +                                      preset configuration 
 +  is-enabled UNIT...                  Check whether unit files are enabled 
 +  mask UNIT...                        Mask one or more units 
 +  unmask UNIT...                      Unmask one or more units 
 +  link PATH...                        Link one or more units files into 
 +                                      the search path 
 +  revert UNIT...                      Revert one or more unit files to vendor 
 +                                      version 
 +  add-wants TARGET UNIT...            Add 'Wants' dependency for the target 
 +                                      on specified one or more units 
 +lines 1-58 
 +[q]
 </code> </code>
  
-Dans l'exemple ci-dessus, chaque ligne non-commentée est composée de quatre champs, séparés par le caractère **:** :+====LAB #3 Fichiers de Configuration====
  
-^ Champ ^ Nom ^ Description ^ +===3.- Fichiers de Configuration par Défaut===
-| Identifiant | Identifiant unique de la ligne composé de 1 à 4 caractères | +
-| 2 | RUNLEVELS | Liste des niveaux d'exécution concernés par la ligne | +
-| 3 | Action | Méthode utilisé pour lancer la commande se trouvant dans le champ 4 | +
-| 4 | Commande | Commande à lancer |+
  
-Le champ **action** prend une des directives suivantes :+Les fichiers de configuration des Cibles et fichiers de configuration des Unités installés par des paquets se trouvent dans le répertoire **/lib/systemd/system** :
  
-^ Directive ^ Description ^ +<code> 
-| respawn | Le processus est relancé en cas d'arrêt de celui-ci | +root@debian11:~# pkg-config systemd --variable=systemdsystemunitdir 
-| mingetty | Assure la gestion du terminal texte | +/lib/systemd/system 
-| once | Le processus n'est exécuté qu'une fois | +</code>
-| wait | Le processus n'est exécuté qu'une fois. Init attend la fin du processus avant de passer à la ligne suivante | +
-| boot | Le processus est exécuté au démarrage de la machine. Le champ RUNLEVELS est sans importance | +
-| bootwait | Le processus est exécuté au démarrage de la machine. Le champ RUNLEVELS est sans importance. Init attend la fin du processus avant de passer à la ligne suivante | +
-| off | Revient à commenter la ligne | +
-| ondemand | La même chose que respawn mais la commande est exécuté dans un des 3 pseudo-niveaux d'exécution | +
-| initdefault | Définit le niveau d'exécution par défaut | +
-| sysinit | La commande est exécutée au démarrage da la machine avant les lignes boot et bootwait | +
-| powerfail | La commande est exécutée quand init reçoit un signal SIGPWR d'un onduleur | +
-| powerwait | La commande est exécutée quand init reçoit un signal SIGPWR d'un onduleur. Init attend la fin du processus avant de passer à la ligne suivante | +
-| powerokwait | La commande est exécutée si Init reçoit un signal de rétablissement du courant | +
-| powerfailnow | La commande est exécutée quand Init reçoit un signal comme quoi la batterie de l'onduleur est presque vide | +
-| ctrlaltdel | La commande est exécutée quand Init reçoit un signal SIGINT. Ce signal est envoyé par la combinaison de touches [CTRL] [ALT] [SUPPR] | +
-| kbrequest | La commande est exécutée suivant des séquences de touches saisies au clavier |+
  
-L'analyse de notre fichier d'exemple sous Debian indique :+<code> 
 +root@debian11:~# ls -l /lib/systemd/system | more 
 +total 1076 
 +-rw-r--r-- 1 root root  576 Dec  7  2020 alsa-restore.service 
 +-rw-r--r-- 1 root root  528 Dec  7  2020 alsa-state.service 
 +lrwxrwxrwx 1 root root    9 Dec  7  2020 alsa-utils.service -> /dev/null 
 +-rw-r--r-- 1 root root  776 Feb   2021 anacron.service 
 +-rw-r--r-- 1 root root  154 Feb  6  2021 anacron.timer 
 +-rw-r--r-- 1 root root 1162 Apr  3  2021 apparmor.service 
 +-rw-r--r-- 1 root root  326 Jun 10  2021 apt-daily.service 
 +-rw-r--r-- 1 root root  156 Jun 10  2021 apt-daily.timer 
 +-rw-r--r-- 1 root root  389 Jun 10  2021 apt-daily-upgrade.service 
 +-rw-r--r-- 1 root root  184 Jun 10  2021 apt-daily-upgrade.timer 
 +-rw-r--r-- 1 root root 1491 Jan  6  2021 auditd.service 
 +lrwxrwxrwx 1 root root   14 Mar 20 20:55 autovt@.service -> getty@.service 
 +-rw-r--r-- 1 root root 1044 Feb  6  2021 avahi-daemon.service 
 +-rw-r--r-- 1 root root  870 Feb  6  2021 avahi-daemon.socket 
 +-rw-r--r-- 1 root root  927 Feb  2  2021 basic.target 
 +-rw-r--r-- 1 root root  380 Feb 22  2021 blk-availability.service 
 +-rw-r--r-- 1 root root  449 Feb  2  2021 blockdev@.target 
 +-rw-r--r-- 1 root root  427 Feb  2  2021 bluetooth.target 
 +-rw-r--r-- 1 root root  463 Feb  2  2021 boot-complete.target 
 +-rw-r--r-- 1 root root  295 Nov 12  2020 colord.service 
 +-rw-r--r-- 1 root root  150 Jan 13  2021 configure-printer@.service 
 +-rw-r--r-- 1 root root 1073 Mar 20 20:55 console-getty.service 
 +-rw-r--r-- 1 root root  312 Oct 29  2018 console-setup.service 
 +-rw-r--r-- 1 root root 1254 Mar 20 20:55 container-getty@.service 
 +-rw-r--r-- 1 root root  316 Feb 22  2021 cron.service 
 +lrwxrwxrwx 1 root root    9 Mar 20 20:55 cryptdisks-early.service -> /dev/null 
 +lrwxrwxrwx 1 root root    9 Mar 20 20:55 cryptdisks.service -> /dev/null 
 +-rw-r--r-- 1 root root  473 Feb  2  2021 cryptsetup-pre.target 
 +-rw-r--r-- 1 root root  420 Feb  2  2021 cryptsetup.target 
 +lrwxrwxrwx 1 root root   13 Mar 20 20:55 ctrl-alt-del.target -> reboot.target 
 +-rw-r--r-- 1 root root  234 Jan  7  2021 cups-browsed.service 
 +-rw-r--r-- 1 root root  142 May 27  2021 cups.path 
 +-rw-r--r-- 1 root root  278 May 27  2021 cups.service 
 +-rw-r--r-- 1 root root  132 May 27  2021 cups.socket 
 +lrwxrwxrwx 1 root root   25 Mar 20 20:55 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service 
 +lrwxrwxrwx 1 root root   23 Mar 20 20:55 dbus-org.freedesktop.locale1.service -> systemd-localed.service 
 +lrwxrwxrwx 1 root root   22 Mar 20 20:55 dbus-org.freedesktop.login1.service -> systemd-logind.service 
 +lrwxrwxrwx 1 root root   25 Mar 20 20:55 dbus-org.freedesktop.timedate1.service -> systemd-timedated.service 
 +-rw-r--r-- 1 root root  380 Feb 21  2021 dbus.service 
 +-rw-r--r-- 1 root root  102 Feb 21  2021 dbus.socket 
 +-rw-r--r-- 1 root root 1065 Mar 20 20:55 debug-shell.service 
 +lrwxrwxrwx 1 root root   16 Mar 20 20:55 default.target -> graphical.target 
 +-rw-r--r-- 1 root root  758 Feb  2  2021 dev-hugepages.mount 
 +-rw-r--r-- 1 root root  701 Feb  2  2021 dev-mqueue.mount 
 +-rw-r--r-- 1 root root  341 Feb 22  2021 dm-event.service 
 +-rw-r--r-- 1 root root  248 Feb 22  2021 dm-event.socket 
 +-rw-r--r-- 1 root root  297 Jun  7  2021 e2scrub_all.service 
 +-rw-r--r-- 1 root root  251 Jun  7  2021 e2scrub_all.timer 
 +-rw-r--r-- 1 root root  245 Jun  7  2021 e2scrub_fail@.service 
 +-rw-r--r-- 1 root root  550 Jun  7  2021 e2scrub_reap.service 
 +-rw-r--r-- 1 root root  438 Jun  7  2021 e2scrub@.service 
 +-rw-r--r-- 1 root root  805 Mar 20 20:55 emergency.service 
 +-rw-r--r-- 1 root root  479 Feb  2  2021 emergency.target 
 +-rw-r--r-- 1 root root  549 Feb  2  2021 exit.target 
 +-rw-r--r-- 1 root root  488 Feb  2  2021 final.target 
 +-rw-r--r-- 1 root root  461 Feb  2  2021 first-boot-complete.target 
 +-rw-r--r-- 1 root root  477 Jan 20 21:10 fstrim.service 
 +--More-- 
 +[q] 
 +</code>
  
-^ Ligne ^ Description ^ +===3.2 - Surchargement des Fichiers par Défaut===
-| id:2:initdefault: | Le niveau d'exécution par défaut est 2 | +
-| si::sysinit:/etc/init.d/rcS | Le script /etc/init.d/rcS est lancé au démarrage de la machine | +
-| ~~:S:wait:/sbin/sulogin | La commande /sbin/sulogin est lancée au démarrage de la machine en niveau d'exécution S | +
-| l0:0:wait:/etc/init.d/rc 0 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 0 | +
-| l1:1:wait:/etc/init.d/rc 1 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 1 | +
-| l2:2:wait:/etc/init.d/rc 2 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 2 | +
-| l3:3:wait:/etc/init.d/rc 3 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 3 | +
-| l4:4:wait:/etc/init.d/rc 4 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 4 | +
-| l5:5:wait:/etc/init.d/rc 5 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 5 | +
-| l6:6:wait:/etc/init.d/rc 6 | Le script /etc/rc.d/rc est lancé pour le niveau d'exécution 6 | +
-| z6:6:respawn:/sbin/sulogin | La commande /sbin/sulogin est lancée au redémarrage de la machine si necéssaire | +
-| ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now | La commande /sbin/shutdown -t1 -a -r now est lancée si les touches  [CTRL] [ALT] [SUPPR] sont appuyées simultanément | +
-| pf::powerwait:/etc/init.d/powerfail start | Le script /etc/init.d/powerfail start est lancée quand Init reçoit le signal SIGPWR | +
-| pn::powerfailnow:/etc/init.d/powerfail now | Le script /etc/init.d/powerfail now est lancée quand Init reçoit un signal comme quoi la batterie de l'onduleur est presque vide | +
-| po::powerokwait:/etc/init.d/powerfail stop | Le script /etc/init.d/powerfail stop est lancée quand Init reçoit un signal de rétablissement du courant | +
-| 1:2345:respawn:/sbin/getty 38400 tty1 | Le terminal tty1 est initialisé par la commande /sbin/mingetty. Le terminal est disponible en appuyant sur les touches [CTRL] [ALT] [F1] | +
-| 2:23:respawn:/sbin/getty 38400 tty2 | Le terminal tty2 est initialisé par la commande /sbin/mingetty. Le terminal est disponible en appuyant sur les touches [CTRL] [ALT] [F2] | +
-| 3:23:respawn:/sbin/getty 38400 tty3 | Le terminal tty3 est initialisé par la commande /sbin/mingetty. Le terminal est disponible en appuyant sur les touches [CTRL] [ALT] [F3] | +
-| 4:23:respawn:/sbin/getty 38400 tty4 | Le terminal tty4 est initialisé par la commande /sbin/mingetty. Le terminal est disponible en appuyant sur les touches [CTRL] [ALT] [F4] | +
-| 5:23:respawn:/sbin/getty 38400 tty5 | Le terminal tty5 est initialisé par la commande /sbin/mingetty. Le terminal est disponible en appuyant sur les touches [CTRL] [ALT] [F5] | +
-| 6:23:respawn:/sbin/getty 38400 tty6 | Le terminal tty6 est initialisé par la commande /sbin/mingetty. Le terminal est disponible en appuyant sur les touches [CTRL] [ALT] [F6] |+
  
-====Scripts de Démarrage====+Certains fichiers de configuration sont créés à la volée dans le répertoire **/run/systemd/system** lors du runtime puis ils sont détruits quand le système n'en a plus besoin :
  
-===Le script rc.S sous Debian 6===+<code> 
 +root@debian11:~# ls -l /run/systemd/system/ 
 +total 0 
 +</code>
  
-D'après l'étude du fichier **inittab**, nous savons que le script /etc/init.d/rcS est exécuté en premier. Ce script appelle tous les scripts dans /etc/init.d qui sont référencés par les liens dans /etc/rcS.det ceci dans un ordre numérique/alphabétique :+Les fichiers de configuration des Unités crées par les utilisateurs doivent être mis dans le répertoire **/usr/lib/systemd/user** :
  
 <code> <code>
-root@debian6:/etc/init.dcat /etc/init.d/rcS +root@debian11:~pkg-config systemd --variable=systemduserunitdir 
-#! /bin/sh +/usr/lib/systemd/user 
-+</code>
-# rcS +
-+
-# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order +
-#+
  
-exec /etc/init.d/rc S+<WRAP center round important 60%> 
 +**Important** : De cette façon les fichiers dans **/usr/lib/systemd/user** surchargent les fichiers dans le répertoire **/run/systemd/system** qui surchargent les fichiers dans le répertoire **/lib/systemd/system**. 
 +</WRAP> 
 + 
 +Les fichiers de configuration par défaut peuvent être surchargés par des fichiers dans d'autres répertoires : 
 + 
 +<code> 
 +root@debian11:~# pkg-config systemd --variable=systemdsystemunitpath 
 +/etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
 </code> </code>
  
-====Répertoire init.d====+===3.3 - Les Fichiers d'Unités===
  
-Le répertoire **/etc/init.d** contient les scripts permettant de lancer les services du système :+Prenons maintenant le cas du service **sshd** qui est configuré par le fichier **/usr/lib/systemd/system/ssh.service** :
  
 <code> <code>
-root@debian6:/etccd init.d +root@debian11:~cat /lib/systemd/system/ssh.service 
-root@debian6:/etc/init.d# ls +[Unit] 
-acpid    hwclockfirst.sh   rc.local +Description=OpenBSD Secure Shell server 
-alsa-utils    hwclock.sh   rcS +Documentation=man:sshd(8) man:sshd_config(5) 
-anacron    ifupdown   README +After=network.target auditd.service 
-atd    ifupdown-clean   reboot +ConditionPathExists=!/etc/ssh/sshd_not_to_be_run 
-avahi-daemon    kerneloops   rmnologin + 
-binfmt-support    keyboard-setup   rsyslog +[Service] 
-bluetooth    killprocs   saned +EnvironmentFile=-/etc/default/ssh 
-bootlogd    lm-sensors   sendsigs +ExecStartPre=/usr/sbin/sshd -t 
-bootlogs    loadcpufreq   single +ExecStart=/usr/sbin/sshd -D $SSHD_OPTS 
-bootmisc.sh    module-init-tools   skeleton +ExecReload=/usr/sbin/sshd -t 
-checkfs.sh    mountall-bootclean.sh  stop-bootlogd +ExecReload=/bin/kill -HUP $MAINPID 
-checkroot.sh    mountall.sh   stop-bootlogd-single +KillMode=process 
-console-screen.sh  mountdevsubfs.sh   sudo +Restart=on-failure 
-console-setup    mountkernfs.sh   udev +RestartPreventExitStatus=255 
-cpufrequtils    mountnfs-bootclean.sh  udev-mtab +Type=notify 
-cron    mountnfs.sh   umountfs +RuntimeDirectory=sshd 
-cups    mountoverflowtmp   umountnfs.sh +RuntimeDirectoryMode=0755 
-dbus    mtab.sh   umountroot + 
-exim4    networking   unattended-upgrades +[Install] 
-fancontrol    network-manager   urandom +WantedBy=multi-user.target 
-fuse    nfs-common   vboxadd +Alias=sshd.service
-gdm3    portmap   vboxadd-service +
-halt    pppd-dns   vboxadd-x11 +
-hdparm    procps   x11-common +
-hostname.sh    rc+
 </code> </code>
  
-====Linux Standard Base====+Dans le fichier on peut noter la présence des lignes suivantes dans la section **[Unit]** :
  
-**[[http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/tocsysinit.html|Linux Standard Base]]** (LSBfut introduit par le **[[http://www.linuxfoundation.org/|Linux Foundation]]** dans un but de permettre la portabilité des scripts init entre distributions différentes.+  * **Description=OpenBSD Secure Shell server**, 
 +    * Cette directive est utilisée pour donner une courte description des fonctionnalités de l'Unité, 
 +  * **Documentation=man:sshd(8) man:sshd_config(5)**
 +    * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l'Unité, 
 +  * **After=network.target auditd.service**
 +    * Cette directive indique les cibles qui devraient être atteintes et les Unités qui devraient être démarrées avant l'Unité sshdPar contre, cette directive ne spécifie pas une dépendance,
  
-Les scripts init qui sont conformes au standard LSB doivent fournir :+Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** :
  
-  * au moins les actions **start**, **stop**, **restart**, **force-reload** et **status**, +  * **Type=notify**, 
-  * des codes retours standardisés+    Cette directive indique que le service informera Systemd quand son démarrage a terminé, 
-  des informations sur des dépendances.+  **ExecStart=/usr/sbin/sshd -D $SSHD_OPTS**, 
 +     Cette directive définit l'exécutable à lancer, 
 +  **ExecReload=/usr/sbin/sshd -t**, 
 +    Cette directive indique la commande necéssaire pour redémarrer le service, 
 +  * **KillMode=process**
 +    Cette directive indique comment les processus du service doivent être arrêtés. La valeur de **process** implique l'utilisation de SIGTERM suivi par SIGHUP
 +  * **Restart=on-failure**
 +    Cette ligne indique que le service doit être re-démarré en cas d'arrêt de celui-ci.
  
-Les scripts init conforment au standard LSB peuvent aussi fournir :+On note la présence de la ligne suivante dans la section **[Install]** :
  
-  * les actions **reload** et **try-restart**, +  * **WantedBy=multi-user.target**, 
-  des messages de journalisation en utilisant les fonctions Init.d **log_success_msg**, **log_failure_msg** et **log_warning_msg**.+    Cette directive indique la Cible dans laquelle le service doit être démarré. La présence de cette directive crée un lien symbolique dans le répertoire **/etc/systemd/system/multi-user.target.wants** qui pointe vers ce fichier.
  
-===Codes Retour Standardisés===+<code> 
 +root@debian11:~# ls -l /etc/systemd/system/multi-user.target.wants 
 +total 0 
 +lrwxrwxrwx 1 root root 35 Apr 25 06:47 anacron.service -> /lib/systemd/system/anacron.service 
 +lrwxrwxrwx 1 root root 34 Apr 29 14:24 auditd.service -> /lib/systemd/system/auditd.service 
 +lrwxrwxrwx 1 root root 40 Apr 25 06:51 avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service 
 +lrwxrwxrwx 1 root root 41 Apr 25 06:32 console-setup.service -> /lib/systemd/system/console-setup.service 
 +lrwxrwxrwx 1 root root 32 Apr 25 06:31 cron.service -> /lib/systemd/system/cron.service 
 +lrwxrwxrwx 1 root root 40 Apr 25 06:52 cups-browsed.service -> /lib/systemd/system/cups-browsed.service 
 +lrwxrwxrwx 1 root root 29 Apr 25 06:52 cups.path -> /lib/systemd/system/cups.path 
 +lrwxrwxrwx 1 root root 38 Apr 25 06:51 lm-sensors.service -> /lib/systemd/system/lm-sensors.service 
 +lrwxrwxrwx 1 root root 40 Apr 25 06:52 ModemManager.service -> /lib/systemd/system/ModemManager.service 
 +lrwxrwxrwx 1 root root 38 Apr 25 06:31 networking.service -> /lib/systemd/system/networking.service 
 +lrwxrwxrwx 1 root root 42 Apr 25 06:52 NetworkManager.service -> /lib/systemd/system/NetworkManager.service 
 +lrwxrwxrwx 1 root root 36 Apr 25 06:30 remote-fs.target -> /lib/systemd/system/remote-fs.target 
 +lrwxrwxrwx 1 root root 33 Apr 28 13:36 rsync.service -> /lib/systemd/system/rsync.service 
 +lrwxrwxrwx 1 root root 35 Apr 25 06:31 rsyslog.service -> /lib/systemd/system/rsyslog.service 
 +lrwxrwxrwx 1 root root 31 Apr 25 07:04 ssh.service -> /lib/systemd/system/ssh.service 
 +lrwxrwxrwx 1 root root 42 Apr 25 06:51 wpa_supplicant.service -> /lib/systemd/system/wpa_supplicant.service 
 +</code>
  
-Les codes retour standardisés sont :+Dernièrement, la ligne suivante de la section **[Install]** indique que le fichier ssh.service est référencé par un alias dénommé **sshd.service** :
  
-^ Code Retour ^ Description ^ +  * **Alias=sshd.service**
-| 0 | Le programme fonctionne et le service est correctement démarré | +
-| 1 | Le programme est mort et le fichier pid dans /var/run existe | +
-| 2 | Le programme est mort et le fichier verrou dans /var/lock existe | +
-| 3 | Le programme ne fonctionne pas et le service n'est pas correctement démarré | +
-| 4 | Le statut du programme ou du service est inconnu | +
-| 5 - 99 | Réservés pour LSB | +
-| 100-149 | Réserves pour la distribution | +
-| 150-199 | Réservés pour l'application | +
-| 200-254 | Réservés |+
  
-===Scripts===+Les alias se trouvent dans la répertoire **/etc/systemd/system/** :
  
-LSB stipule un format //rigide// de script qui commence par une section délimitée par deux clauses :+<code> 
 +root@debian11:~# ls -l /etc/systemd/system/ 
 +total 36 
 +lrwxrwxrwx 1 root root   42 Apr 25 06:51 dbus-fi.w1.wpa_supplicant1.service -> /lib/systemd/system/wpa_supplicant.service 
 +lrwxrwxrwx 1 root root   40 Apr 25 06:51 dbus-org.freedesktop.Avahi.service -> /lib/systemd/system/avahi-daemon.service 
 +lrwxrwxrwx 1 root root   40 Apr 25 06:52 dbus-org.freedesktop.ModemManager1.service -> /lib/systemd/system/ModemManager.service 
 +lrwxrwxrwx 1 root root   53 Apr 25 06:52 dbus-org.freedesktop.nm-dispatcher.service -> /lib/systemd/system/NetworkManager-dispatcher.service 
 +lrwxrwxrwx 1 root root   45 Apr 25 06:48 dbus-org.freedesktop.timesync1.service -> /lib/systemd/system/systemd-timesyncd.service 
 +drwxr-xr-x 2 root root 4096 Apr 25 06:30 default.target.wants 
 +lrwxrwxrwx 1 root root   35 Apr 25 06:53 display-manager.service -> /lib/systemd/system/lightdm.service 
 +drwxr-xr-x 2 root root 4096 Apr 25 06:30 getty.target.wants 
 +drwxr-xr-x 2 root root 4096 Apr 25 06:50 graphical.target.wants 
 +drwxr-xr-x 2 root root 4096 Apr 29 14:24 multi-user.target.wants 
 +drwxr-xr-x 2 root root 4096 Apr 25 06:52 network-online.target.wants 
 +drwxr-xr-x 2 root root 4096 Apr 25 06:52 printer.target.wants 
 +drwxr-xr-x 2 root root 4096 Apr 26 13:47 sockets.target.wants 
 +lrwxrwxrwx 1 root root   31 Apr 25 07:04 sshd.service -> /lib/systemd/system/ssh.service 
 +drwxr-xr-x 2 root root 4096 Apr 26 13:47 sysinit.target.wants 
 +lrwxrwxrwx 1 root root   35 Apr 25 06:31 syslog.service -> /lib/systemd/system/rsyslog.service 
 +drwxr-xr-x 2 root root 4096 Apr 29 14:38 timers.target.wants 
 +</code>
  
-  * **### BEGIN INIT INFO**, +Pour consulter **l'ensemble** des directives de configuration ainsi que leurs valeurs d'une Unitéil convient d'utiliser la commande **systemctl show**  en spécifiant l'Unité concernée :
-  * **### END INIT INFO**.+
  
-Par exemple :+<code> 
 +root@debian11:~# systemctl show sshd 
 +Type=notify 
 +Restart=on-failure 
 +NotifyAccess=main 
 +RestartUSec=100ms 
 +TimeoutStartUSec=1min 30s 
 +TimeoutStopUSec=1min 30s 
 +TimeoutAbortUSec=1min 30s 
 +TimeoutStartFailureMode=terminate 
 +TimeoutStopFailureMode=terminate 
 +RuntimeMaxUSec=infinity 
 +WatchdogUSec=0 
 +WatchdogTimestampMonotonic=0 
 +RootDirectoryStartOnly=no 
 +RemainAfterExit=no 
 +GuessMainPID=yes 
 +RestartPreventExitStatus=255 
 +MainPID=449 
 +ControlPID=0 
 +FileDescriptorStoreMax=0 
 +NFileDescriptorStore=0 
 +StatusErrno=0 
 +Result=success 
 +ReloadResult=success 
 +CleanResult=success 
 +UID=[not set] 
 +GID=[not set] 
 +NRestarts=0 
 +OOMPolicy=stop 
 +ExecMainStartTimestamp=Tue 2022-04-26 13:08:21 CEST 
 +ExecMainStartTimestampMonotonic=7283003 
 +ExecMainExitTimestampMonotonic=0 
 +ExecMainPID=449 
 +ExecMainCode=0 
 +ExecMainStatus=0 
 +ExecStartPre={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -t ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecStartPreEx={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -t ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecStart={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $SSHD_OPTS ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecStartEx={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $SSHD_OPTS ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReload={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -t ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReload={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReloadEx={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -t ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReloadEx={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +Slice=system.slice 
 +ControlGroup=/system.slice/ssh.service 
 +MemoryCurrent=5832704 
 +CPUUsageNSec=664103000 
 +EffectiveCPUs= 
 +EffectiveMemoryNodes= 
 +TasksCurrent=1 
 +IPIngressBytes=[no data] 
 +IPIngressPackets=[no data] 
 +IPEgressBytes=[no data] 
 +IPEgressPackets=[no data] 
 +IOReadBytes=18446744073709551615 
 +IOReadOperations=18446744073709551615 
 +IOWriteBytes=18446744073709551615 
 +IOWriteOperations=18446744073709551615 
 +Delegate=no 
 +lines 1-58 
 +[q] 
 +</code> 
 + 
 +Pour consulter la liste des dépendances d'une Unité, il convient d'utiliser **systemctl list-dependancies** en spécifiant l'Unité concernée :
  
 <code> <code>
-[root@centos5 ~]more /etc/rc.d/init.d/sshd +root@debian11:~# systemctl list-dependencies sshd.service 
-#!/bin/bash +sshd.service 
-# +● ├─-.mount 
-# sshd Start up the OpenSSH server daemon +● ├─system.slice 
-# +● └─sysinit.target 
-# chkconfig: 2345 55 25 +●   ├─apparmor.service 
-# description: SSH is a protocol for secure remote shell access\ +●   ├─blk-availability.service 
-#              This service starts up the OpenSSH server daemon+●   ├─dev-hugepages.mount 
-# +●   ├─dev-mqueue.mount 
-# processname: sshd +●   ├─keyboard-setup.service 
-# config: /etc/ssh/ssh_host_key +●   ├─kmod-static-nodes.service 
-# config: /etc/ssh/ssh_host_key.pub +●   ├─lvm2-lvmpolld.socket 
-# config: /etc/ssh/ssh_random_seed +●   ├─lvm2-monitor.service 
-config: /etc/ssh/sshd_config +●   ├─plymouth-read-write.service 
-# pidfile: /var/run/sshd.pid+●   ├─plymouth-start.service 
 +●   ├─proc-sys-fs-binfmt_misc.automount 
 +●   ├─sys-fs-fuse-connections.mount 
 +●   ├─sys-kernel-config.mount 
 +●   ├─sys-kernel-debug.mount 
 +●   ├─sys-kernel-tracing.mount 
 +●   ├─systemd-ask-password-console.path 
 +●   ├─systemd-binfmt.service 
 +●   ├─systemd-boot-system-token.service 
 +●   ├─systemd-hwdb-update.service 
 +●   ├─systemd-journal-flush.service 
 +●   ├─systemd-journald.service 
 +●   ├─systemd-machine-id-commit.service 
 +●   ├─systemd-modules-load.service 
 +●   ├─systemd-pstore.service 
 +●   ├─systemd-random-seed.service 
 +●   ├─systemd-sysctl.service 
 +●   ├─systemd-sysusers.service 
 +●   ├─systemd-timesyncd.service 
 +●   ├─systemd-tmpfiles-setup-dev.service 
 +●   ├─systemd-tmpfiles-setup.service 
 +●   ├─systemd-udev-trigger.service 
 +●   ├─systemd-udevd.service 
 +●   ├─systemd-update-utmp.service 
 +●   ├─cryptsetup.target 
 +●   │ └─systemd-cryptsetup@sdc11.service 
 +●   ├─local-fs.target 
 +●   │ ├─-.mount 
 +●   │ ├─mnt-sdc11.mount 
 +●   │ ├─systemd-fsck-root.service 
 +●   │ └─systemd-remount-fs.service 
 +●   └─swap.target 
 +●     └─dev-disk-by\x2duuid-1f9439f5\x2d4b19\x2d49b1\x2db292\x2d60c2c674cee9.swap 
 +</code>
  
-### BEGIN INIT INFO +====LAB #4 - La Commande systemd-analyze====
-# Provides: sshd +
-# Required-Start: $local_fs $network $syslog +
-# Required-Stop: $local_fs $syslog +
-# Should-Start: $syslog +
-# Should-Stop: $network $syslog +
-# Default-Start: 2 3 +
-# Default-Stop: 0 1 6 +
-# Short-Description: Start up the OpenSSH server daemon +
-# Description:       SSH is a protocol for secure remote shell access. +
-#      This service starts up the OpenSSH server daemon. +
-### END INIT INFO+
  
-# source function library +Pour avoir une évaluation du temps de démarrage, il convient d'utiliser la commande suivante :
-. /etc/rc.d/init.d/functions+
  
-# pull in sysconfig settings +<code> 
--f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd +root@debian11:~# systemd-analyze 
---Plus--(20%)+Startup finished in 3.197s (kernel+ 4.577s (userspace) = 7.775s  
 +graphical.target reached after 4.567s in userspace
 </code> </code>
  
-Les lignes se trouvant entre les deux clauses ont un format spécifique :+L'option **blame** de la commande systemd-analyze permet de voir le temps de démarrage de chaque Unité afin de pourvoir se concentrer sur les plus lentes :
  
 <code> <code>
-{MotClef}valeur1 [valeur2...]+root@debian11:~systemd-analyze blame 
 +1.781s dev-sdb1.device 
 +1.645s man-db.service 
 +1.304s apparmor.service 
 +1.254s udisks2.service 
 +1.212s systemd-random-seed.service 
 +1.155s systemd-journal-flush.service 
 +1.027s NetworkManager-wait-online.service 
 +1.005s systemd-udevd.service 
 + 876ms ModemManager.service 
 + 645ms ssh.service 
 + 608ms NetworkManager.service 
 + 584ms polkit.service 
 + 542ms logrotate.service 
 + 469ms avahi-daemon.service 
 + 449ms wpa_supplicant.service 
 + 445ms systemd-logind.service 
 + 441ms lightdm.service 
 + 433ms plymouth-quit-wait.service 
 + 410ms user@113.service 
 + 372ms apt-daily.service 
 + 358ms apt-daily-upgrade.service 
 + 329ms packagekit.service 
 + 313ms keyboard-setup.service 
 + 299ms networking.service 
 + 288ms systemd-timesyncd.service 
 + 226ms systemd-tmpfiles-setup.service 
 + 197ms systemd-modules-load.service 
 + 196ms rsyslog.service 
 + 184ms systemd-udev-trigger.service 
 + 165ms e2scrub_reap.service 
 + 164ms systemd-journald.service 
 + 152ms user@1000.service 
 + 108ms hddtemp.service 
 + 101ms systemd-tmpfiles-setup-dev.service 
 +  94ms systemd-sysusers.service 
 +  93ms plymouth-start.service 
 +  91ms lvm2-pvscan@8:41.service 
 +  89ms systemd-update-utmp.service 
 +  86ms systemd-remount-fs.service 
 +  80ms lm-sensors.service 
 +  72ms lvm2-pvscan@8:39.service 
 +  68ms systemd-sysctl.service 
 +  67ms plymouth-read-write.service 
 +  65ms lvm2-monitor.service 
 +  63ms dev-hugepages.mount 
 +  63ms sys-kernel-debug.mount 
 +  62ms dev-mqueue.mount 
 +  60ms sys-kernel-tracing.mount 
 +  57ms lvm2-pvscan@8:38.service 
 +  41ms systemd-user-sessions.service 
 +  33ms modprobe@fuse.service 
 +  32ms sys-kernel-config.mount 
 +  32ms ifupdown-pre.service 
 +  27ms auditd.service 
 +  27ms console-setup.service 
 +  22ms rtkit-daemon.service 
 +  20ms modprobe@configfs.service 
 +  19ms sys-fs-fuse-connections.mount 
 +lines 1-58 
 +[q]
 </code> </code>
  
-<WRAP center round important> +L'option **critical-chain** de la commande **systemd-analyze** permet de voir l'enchaînement des événements qui amènent au chargement de l'Unité qui est passée en argument :
-**Important** : Notez qu'à part la deuxième ligne de la description, chaque ligne **doit** commencer par le caractère **#** suivi par un espace. +
-</WRAP>+
  
-Les Mots Clefs sont :+<code> 
 +root@debian11:~# systemd-analyze critical-chain sshd.service 
 +The time when unit became active or started is printed after the "@" character. 
 +The time the unit took to start is printed after the "+" character.
  
-^ Mot Clef ^ Description ^ +ssh.service +645ms 
-| Provides | Indique le service -(//boot facilities// en anglais) démarré par le scriptLe nom doit être unique| +└─network.target @3.425s 
-| Required-start | Indique d'autres services qui doivent être démarrés avant le démarrage de celui indiqué par le mot-clef **Provides** | +  └─NetworkManager.service @2.816s +608ms 
-| Required-Stop | Indique d'autres services qui doivent être arrêtés **après** l'arrêt de celui indiqué par le mot-clef **Provides**| +    └─dbus.service @2.812s 
-| Should-Start | Indique d'autres services qui, s'ils sont présents sur le système, être démarrés avant le démarrage de celui indiqué par le mot-clef **Provides**| +      └─basic.target @2.789s 
-| Should-Stop | Indique d'autres services qui, s'ils sont présents sur le système, doivent être arrêtés **après** l'arrêt de celui indiqué par le mot-clef **Provides**| +        └─sockets.target @2.789s 
-| Default-Start | Indique les niveaux d'exécution dans lesquels le service doit être démarré| +          └─dbus.socket @2.789s 
-| Default-Stop | Indique les niveaux d'exécution dans lesquels le service doit être arrêté| +            └─sysinit.target @2.786s 
-| Short-Description | Indique une description du service en **une seule ligne**| +              └─systemd-timesyncd.service @2.497s +288ms 
-| Description | Indique une description multi-lignes du service. |+                └─systemd-tmpfiles-setup.service @2.268s +226ms 
 +                  └─systemd-journal-flush.service @1.112s +1.155s 
 +                    └─systemd-journald.service @946ms +164ms 
 +                      └─systemd-journald.socket @925ms 
 +                        └─system.slice @487ms 
 +                          └─-.slice @487ms 
 +</code>
  
-Il existe des groupements de services, appelés en anglais des //Virtual Facilities//Les plus importants sont :+Les options de la commande **systemd-analyze** sont :
  
-^ Virtual Facility ^ Description ^ +<code> 
-| $local_fs | Tous les systèmes de fichiers locaux doivent être montés. | +root@debian11:~# systemd-analyze --help 
-| $network | La carte Ethernet doit fonctionner | +systemd-analyze [OPTIONS...] COMMAND ...
-| $named | Les daemons, si présents, responsables de la résolution des noms tels DNS, NIS+ ou LDAP doivent être démarrés+
-| $portmap | Les daemons qui fournissent le //SunRPC/ONCRPC port mapping// doivent être démarrés+
-| $remote_fs | Tous les systèmes de fichiers doivent être montés+
-| $syslog | Syslog, Syslog-ng ou Rsyslog doit être démarré+
-| $time | L'heure du système doit avoir été fixé soit par NTP, soit par rdate soit par l'horloge système|+
  
-====Répertoires rcx.d====+Profile systemd, show unit dependencies, check unit files.
  
-Les répertoires **rc0.d** à **rc6.d** contiennent des liens vers les scripts du répertoire **init.d**.+Commands: 
 +  [time]                   Print time required to boot the machine 
 +  blame                    Print list of running units ordered by time to init 
 +  critical-chain [UNIT...] Print a tree of the time critical chain of units 
 +  plot                     Output SVG graphic showing service initialization 
 +  dot [UNIT...]            Output dependency graph in dot(1) format 
 +  dump                     Output state serialization of service manager 
 +  cat-config               Show configuration file and drop-ins 
 +  unit-files               List files and symlinks for units 
 +  unit-paths               List load directories for units 
 +  exit-status [STATUS...]  List exit status definitions 
 +  capability [CAP...]      List capability definitions 
 +  syscall-filter [NAME...] Print list of syscalls in seccomp filter 
 +  condition CONDITION...   Evaluate conditions and asserts 
 +  verify FILE...           Check unit files for correctness 
 +  calendar SPEC...         Validate repetitive calendar time events 
 +  timestamp TIMESTAMP...   Validate a timestamp 
 +  timespan SPAN...         Validate a time span 
 +  security [UNIT...]       Analyze security of unit
  
-Pour mieux comprendre, saisissez les commandes suivantes :+Options: 
 +  -h --help                Show this help 
 +     --version             Show package version 
 +     --no-pager            Do not pipe output into a pager 
 +     --system              Operate on system systemd instance 
 +     --user                Operate on user systemd instance 
 +     --global              Operate on global user configuration 
 +  -H --host=[USER@]HOST    Operate on remote host 
 +  -M --machine=CONTAINER   Operate on local container 
 +     --order               Show only order in the graph 
 +     --require             Show only requirement in the graph 
 +     --from-pattern=GLOB   Show only origins in the graph 
 +     --to-pattern=GLOB     Show only destinations in the graph 
 +     --fuzz=SECONDS        Also print services which finished SECONDS earlier 
 +                           than the latest in the branch 
 +     --man[=BOOL]          Do [not] check for existence of man pages 
 +     --generators[=BOOL]   Do [not] run unit generators (requires privileges) 
 +     --iterations=N        Show the specified number of iterations 
 +     --base-time=TIMESTAMP Calculate calendar times relative to specified time
  
-<code> +See the systemd-analyze(1) man page for details.
-root@debian6:/etc/init.d# for rep in /etc/rc[2345].d; do echo "dans $rep : "; ls $rep/S*; done +
-dans /etc/rc2.d :  +
-/etc/rc2.d/S01vboxadd        /etc/rc2.d/S18kerneloops +
-/etc/rc2.d/S02vboxadd-service  /etc/rc2.d/S18loadcpufreq +
-/etc/rc2.d/S14portmap        /etc/rc2.d/S19avahi-daemon +
-/etc/rc2.d/S15nfs-common       /etc/rc2.d/S19bluetooth +
-/etc/rc2.d/S17binfmt-support   /etc/rc2.d/S19cpufrequtils +
-/etc/rc2.d/S17fancontrol       /etc/rc2.d/S19network-manager +
-/etc/rc2.d/S17rsyslog        /etc/rc2.d/S20cups +
-/etc/rc2.d/S17sudo        /etc/rc2.d/S20gdm3 +
-/etc/rc2.d/S18acpid        /etc/rc2.d/S20saned +
-/etc/rc2.d/S18anacron        /etc/rc2.d/S21bootlogs +
-/etc/rc2.d/S18atd        /etc/rc2.d/S22rc.local +
-/etc/rc2.d/S18cron        /etc/rc2.d/S22rmnologin +
-/etc/rc2.d/S18dbus        /etc/rc2.d/S22stop-bootlogd +
-/etc/rc2.d/S18exim4 +
-dans /etc/rc3.d :  +
-/etc/rc3.d/S01vboxadd        /etc/rc3.d/S18kerneloops +
-/etc/rc3.d/S02vboxadd-service  /etc/rc3.d/S18loadcpufreq +
-/etc/rc3.d/S14portmap        /etc/rc3.d/S19avahi-daemon +
-/etc/rc3.d/S15nfs-common       /etc/rc3.d/S19bluetooth +
-/etc/rc3.d/S17binfmt-support   /etc/rc3.d/S19cpufrequtils +
-/etc/rc3.d/S17fancontrol       /etc/rc3.d/S19network-manager +
-/etc/rc3.d/S17rsyslog        /etc/rc3.d/S20cups +
-/etc/rc3.d/S17sudo        /etc/rc3.d/S20gdm3 +
-/etc/rc3.d/S18acpid        /etc/rc3.d/S20saned +
-/etc/rc3.d/S18anacron        /etc/rc3.d/S21bootlogs +
-/etc/rc3.d/S18atd        /etc/rc3.d/S22rc.local +
-/etc/rc3.d/S18cron        /etc/rc3.d/S22rmnologin +
-/etc/rc3.d/S18dbus        /etc/rc3.d/S22stop-bootlogd +
-/etc/rc3.d/S18exim4 +
-dans /etc/rc4.d :  +
-/etc/rc4.d/S01vboxadd        /etc/rc4.d/S18kerneloops +
-/etc/rc4.d/S02vboxadd-service  /etc/rc4.d/S18loadcpufreq +
-/etc/rc4.d/S14portmap        /etc/rc4.d/S19avahi-daemon +
-/etc/rc4.d/S15nfs-common       /etc/rc4.d/S19bluetooth +
-/etc/rc4.d/S17binfmt-support   /etc/rc4.d/S19cpufrequtils +
-/etc/rc4.d/S17fancontrol       /etc/rc4.d/S19network-manager +
-/etc/rc4.d/S17rsyslog        /etc/rc4.d/S20cups +
-/etc/rc4.d/S17sudo        /etc/rc4.d/S20gdm3 +
-/etc/rc4.d/S18acpid        /etc/rc4.d/S20saned +
-/etc/rc4.d/S18anacron        /etc/rc4.d/S21bootlogs +
-/etc/rc4.d/S18atd        /etc/rc4.d/S22rc.local +
-/etc/rc4.d/S18cron        /etc/rc4.d/S22rmnologin +
-/etc/rc4.d/S18dbus        /etc/rc4.d/S22stop-bootlogd +
-/etc/rc4.d/S18exim4 +
-dans /etc/rc5.d :  +
-/etc/rc5.d/S01vboxadd        /etc/rc5.d/S18kerneloops +
-/etc/rc5.d/S02vboxadd-service  /etc/rc5.d/S18loadcpufreq +
-/etc/rc5.d/S14portmap        /etc/rc5.d/S19avahi-daemon +
-/etc/rc5.d/S15nfs-common       /etc/rc5.d/S19bluetooth +
-/etc/rc5.d/S17binfmt-support   /etc/rc5.d/S19cpufrequtils +
-/etc/rc5.d/S17fancontrol       /etc/rc5.d/S19network-manager +
-/etc/rc5.d/S17rsyslog        /etc/rc5.d/S20cups +
-/etc/rc5.d/S17sudo        /etc/rc5.d/S20gdm3 +
-/etc/rc5.d/S18acpid        /etc/rc5.d/S20saned +
-/etc/rc5.d/S18anacron        /etc/rc5.d/S21bootlogs +
-/etc/rc5.d/S18atd        /etc/rc5.d/S22rc.local +
-/etc/rc5.d/S18cron        /etc/rc5.d/S22rmnologin +
-/etc/rc5.d/S18dbus        /etc/rc5.d/S22stop-bootlogd +
-/etc/rc5.d/S18exim4+
 </code> </code>
  
-<WRAP center round important> +====LAB #- Les Cibles====
-**Important** : Notez que chaque répertoire correspondant à un niveau d'exécution contient des liens pointant vers un script dans le répertoire **/etc/init.d**. La lettre **S** indique au script **rc** que le script dans **/etc/init.d** doit être exécutée avec l'option **start**. De cette façon les processus sont lancés dans le niveau d'exécution spécifié. Le numéro qui suit la lettre **S** indique l'ordre de lancement par le script **rc**. Si deux scripts dans un répertoire **/etc/rcX.d** ont le même numéro, l'ordre alphabétique prime. Notez aussi la présence du lien **S99local** qui lance le script **rc.local** en dernier. Le script rc.local est lancé dans les niveaux d'exécution **2, 3, 4 et 5**. C'est dans ce script que **root** peut ajouter des commandes. +
-</WRAP>+
  
-Rappelez la commande précédente et modifiez la lettre S en **K** :+Chaque Cible est décrite par un fichier de configuration :
  
 <code> <code>
-root@debian6:/etc/init.dfor rep in /etc/rc[016].d; do echo "dans $rep :"; ls $rep/K*; done +root@debian11:~cat /usr/lib/systemd/system/graphical.target 
-dans /etc/rc0.d : +#  SPDX-License-Identifier: LGPL-2.1-or-later 
-/etc/rc0.d/K01alsa-utils    /etc/rc0.d/K02avahi-daemon +# 
-/etc/rc0.d/K01anacron    /etc/rc0.d/K02vboxadd + This file is part of systemd
-/etc/rc0.d/K01atd    /etc/rc0.d/K03sendsigs +# 
-/etc/rc0.d/K01bluetooth    /etc/rc0.d/K04rsyslog +#  systemd is free software; you can redistribute it and/or modify it 
-/etc/rc0.d/K01exim4    /etc/rc0.d/K05umountnfs.sh +#  under the terms of the GNU Lesser General Public License as published by 
-/etc/rc0.d/K01fuse    /etc/rc0.d/K06nfs-common + the Free Software Foundation; either version 2.1 of the License, or 
-/etc/rc0.d/K01gdm3    /etc/rc0.d/K06portmap +#  (at your option) any later version
-/etc/rc0.d/K01kerneloops    /etc/rc0.d/K07hwclock.sh + 
-/etc/rc0.d/K01network-manager    /etc/rc0.d/K07networking +[Unit] 
-/etc/rc0.d/K01saned    /etc/rc0.d/K08ifupdown +Description=Graphical Interface 
-/etc/rc0.d/K01unattended-upgrades  /etc/rc0.d/K09umountfs +Documentation=man:systemd.special(7) 
-/etc/rc0.d/K01urandom    /etc/rc0.d/K10umountroot +Requires=multi-user.target 
-/etc/rc0.d/K01vboxadd-service    /etc/rc0.d/K11halt +Wants=display-manager.service 
-dans /etc/rc1.d : +Conflicts=rescue.service rescue.target 
-/etc/rc1.d/K01alsa-utils  /etc/rc1.d/K01network-manager +After=multi-user.target rescue.service rescue.target display-manager.service 
-/etc/rc1.d/K01anacron   /etc/rc1.d/K01saned +AllowIsolate=yes
-/etc/rc1.d/K01atd   /etc/rc1.d/K01vboxadd-service +
-/etc/rc1.d/K01bluetooth   /etc/rc1.d/K02avahi-daemon +
-/etc/rc1.d/K01cups   /etc/rc1.d/K02vboxadd +
-/etc/rc1.d/K01exim4   /etc/rc1.d/K04rsyslog +
-/etc/rc1.d/K01gdm3   /etc/rc1.d/K06nfs-common +
-/etc/rc1.d/K01kerneloops  /etc/rc1.d/K06portmap +
-dans /etc/rc6.d : +
-/etc/rc6.d/K01alsa-utils    /etc/rc6.d/K02avahi-daemon +
-/etc/rc6.d/K01anacron    /etc/rc6.d/K02vboxadd +
-/etc/rc6.d/K01atd    /etc/rc6.d/K03sendsigs +
-/etc/rc6.d/K01bluetooth    /etc/rc6.d/K04rsyslog +
-/etc/rc6.d/K01exim4    /etc/rc6.d/K05umountnfs.sh +
-/etc/rc6.d/K01fuse    /etc/rc6.d/K06nfs-common +
-/etc/rc6.d/K01gdm3    /etc/rc6.d/K06portmap +
-/etc/rc6.d/K01kerneloops    /etc/rc6.d/K07hwclock.sh +
-/etc/rc6.d/K01network-manager    /etc/rc6.d/K07networking +
-/etc/rc6.d/K01saned    /etc/rc6.d/K08ifupdown +
-/etc/rc6.d/K01unattended-upgrades  /etc/rc6.d/K09umountfs +
-/etc/rc6.d/K01urandom    /etc/rc6.d/K10umountroot +
-/etc/rc6.d/K01vboxadd-service    /etc/rc6.d/K11reboot+
 </code> </code>
  
 +Dans ce fichier on peut noter la présence des lignes suivantes :
  
-<WRAP center round important> +  * **Requires=multi-user.target**, 
-**Important** : Ici le principe est le même sauf que la lettre **K** indique au script **rc** que le script dans **/etc/init.d** doit être lancé avec l'option **stop**. +     Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint au préalable, 
-</WRAP>+  * **After=multi-user.target rescue.service rescue.target display-manager.service**, 
 +    * Cette ligne indique le **multi-user.target** et **rescue.target** doivent d'abord être atteints et que les services **rescue.service** et **display-manager.service** doivent d'abord être démarrés, 
 +  * **Conflicts=rescue.service rescue.target**, 
 +    * Cette ligne indique la Cible et le service en conflits avec le **graphical.target**
 +  * **Wants=display-manager.service**, 
 +    * Cette ligne indique quel service doit être démarré.
  
-===rc.local===+===5.1 - Contrôler les dépendances d'une Cible===
  
-Le script rc.local est lancé dans les niveaux d'exécution **2, 3, 4 et 5**. C'est dans ce script que **root** peut ajouter des commandes.+Les dépendances d'une Cible peuvent être consultées en utilisant la commande **systemctl list-dependencies** :
  
-====La commande chkconfig====+<code> 
 +root@debian11:~# systemctl list-dependencies multi-user.target 
 +multi-user.target 
 +● ├─anacron.service 
 +● ├─auditd.service 
 +● ├─avahi-daemon.service 
 +● ├─console-setup.service 
 +● ├─cron.service 
 +● ├─cups-browsed.service 
 +● ├─cups.path 
 +● ├─dbus.service 
 +● ├─hddtemp.service 
 +● ├─lm-sensors.service 
 +● ├─ModemManager.service 
 +● ├─networking.service 
 +● ├─NetworkManager.service 
 +● ├─plymouth-quit-wait.service 
 +● ├─plymouth-quit.service 
 +● ├─rsync.service 
 +● ├─rsyslog.service 
 +● ├─ssh.service 
 +● ├─systemd-ask-password-wall.path 
 +● ├─systemd-logind.service 
 +● ├─systemd-update-utmp-runlevel.service 
 +● ├─systemd-user-sessions.service 
 +● ├─wpa_supplicant.service 
 +● ├─basic.target 
 +● │ ├─-.mount 
 +● │ ├─tmp.mount 
 +● │ ├─paths.target 
 +● │ ├─slices.target 
 +● │ │ ├─-.slice 
 +● │ │ └─system.slice 
 +● │ ├─sockets.target 
 +● │ │ ├─avahi-daemon.socket 
 +● │ │ ├─cups.socket 
 +● │ │ ├─dbus.socket 
 +● │ │ ├─dm-event.socket 
 +● │ │ ├─systemd-initctl.socket 
 +● │ │ ├─systemd-journald-audit.socket 
 +● │ │ ├─systemd-journald-dev-log.socket 
 +● │ │ ├─systemd-journald.socket 
 +● │ │ ├─systemd-udevd-control.socket 
 +● │ │ └─systemd-udevd-kernel.socket 
 +● │ ├─sysinit.target 
 +● │ │ ├─apparmor.service 
 +● │ │ ├─blk-availability.service 
 +● │ │ ├─dev-hugepages.mount 
 +● │ │ ├─dev-mqueue.mount 
 +● │ │ ├─keyboard-setup.service 
 +● │ │ ├─kmod-static-nodes.service 
 +● │ │ ├─lvm2-lvmpolld.socket 
 +● │ │ ├─lvm2-monitor.service 
 +● │ │ ├─plymouth-read-write.service 
 +● │ │ ├─plymouth-start.service 
 +● │ │ ├─proc-sys-fs-binfmt_misc.automount 
 +● │ │ ├─sys-fs-fuse-connections.mount 
 +● │ │ ├─sys-kernel-config.mount 
 +● │ │ ├─sys-kernel-debug.mount 
 +● │ │ ├─sys-kernel-tracing.mount 
 +lines 1-58 
 +[q] 
 +</code>
  
-Sous Debian la commande **chkconfig** n'est pas installée par défautIl convient donc de l'installer en utilisant la commande **apt-get** :+Les points noirs au début de chaque ligne dans la sortie ci-dessus peuvent être de trois couleurs différentes : 
 + 
 +  * **Vert** implique que le service, la cible ou l'unité est activé et démarré 
 +  * **Blanc** implique le service, la cible ou l'unité est inactif. 
 +  * **Rouge** implique que le service, la cible ou l'unité n'a pas démarré à cause d'une erreur fatale. 
 + 
 +Pour visualiser les Unités en état d'erreur fatale, utilisez la commande **systemctl --failed** :
  
 <code> <code>
-root@debian6:/etc/init.dapt-get install chkconfig +root@debian11:~systemctl --failed 
-Lecture des listes de paquets... Fait +  UNIT LOAD ACTIVE SUB DESCRIPTION 
-Construction de l'arbre des dépendances        +loaded units listed.
-Lecture des informations d'état... Fait +
-Les NOUVEAUX paquets suivants seront installés : +
-  chkconfig +
-mis à jour, 1 nouvellement installés, 0 à enlever et 219 non mis à jour. +
-Il est nécessaire de prendre 9 182 o dans les archives. +
-Après cette opération, 69,6 ko d'espace disque supplémentaires seront utilisés. +
-Réception de : 1 http://ftp.fr.debian.org/debian/ squeeze/main chkconfig all 11.0-79.1-2 [9 182 B] +
-9 182 o réceptionnés en 50s (183 o/s) +
-(Lecture de la base de données... 130287 fichiers et répertoires déjà installés.) +
-Dépaquetage de chkconfig (à partir de .../chkconfig_11.0-79.1-2_all.deb) ... +
-Traitement des actions différées (« triggers ») pour « man-db »... +
-Paramétrage de chkconfig (11.0-79.1-2) ...+
 </code> </code>
  
-Saisissez maintenant la commande suivante :+Les dépendances sont créés sous la forme de liens symboliques dans les répertoires **/etc/systemd/system/multi-user.target.wants** et **/usr/lib/systemd/system/multi-user.target.wants** :
  
 <code> <code>
-root@debian6:/tmpchkconfig --list +root@debian11:~ls -l /etc/systemd/system/multi-user.target.wants 
-acpid                     0:off  1:off  2:on   3:on   4:on   5:on   6:off +total 0 
-alsa-utils                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 35 Apr 25 06:47 anacron.service -> /lib/systemd/system/anacron.service 
-anacron                   0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 34 Apr 29 14:24 auditd.service -> /lib/systemd/system/auditd.service 
-atd                       0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 40 Apr 25 06:51 avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service 
-avahi-daemon              0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 41 Apr 25 06:32 console-setup.service -> /lib/systemd/system/console-setup.service 
-binfmt-support            0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 32 Apr 25 06:31 cron.service -> /lib/systemd/system/cron.service 
-bluetooth                 0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 40 Apr 25 06:52 cups-browsed.service -> /lib/systemd/system/cups-browsed.service 
-bootlogd                  0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 29 Apr 25 06:52 cups.path -> /lib/systemd/system/cups.path 
-bootlogs                  0:off  1:on   2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 38 Apr 25 06:51 lm-sensors.service -> /lib/systemd/system/lm-sensors.service 
-bootmisc.sh               0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 40 Apr 25 06:52 ModemManager.service -> /lib/systemd/system/ModemManager.service 
-checkfs.sh                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 38 Apr 25 06:31 networking.service -> /lib/systemd/system/networking.service 
-checkroot.sh              0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 42 Apr 25 06:52 NetworkManager.service -> /lib/systemd/system/NetworkManager.service 
-console-screen.sh         0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 36 Apr 25 06:30 remote-fs.target -> /lib/systemd/system/remote-fs.target 
-console-setup             0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 33 Apr 28 13:36 rsync.service -> /lib/systemd/system/rsync.service 
-cpufrequtils              0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 35 Apr 25 06:31 rsyslog.service -> /lib/systemd/system/rsyslog.service 
-cron                      0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 31 Apr 25 07:04 ssh.service -> /lib/systemd/system/ssh.service 
-cups                      0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 42 Apr 25 06:51 wpa_supplicant.service -> /lib/systemd/system/wpa_supplicant.service 
-dbus                      0:off  1:off  2:on   3:on   4:on   5:on   6:off + 
-exim4                     0:off  1:off  2:on   3:on   4:on   5:on   6:off +root@debian11:~# ls -l /usr/lib/systemd/system/multi-user.target.wants 
-fancontrol                0:off  1:off  2:on   3:on   4:on   5:on   6:off +total 
-fuse                      0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 15 Feb 21  2021 dbus.service -> ../dbus.service 
-gdm3                      0:off  1:off  2:on   3:on   4:on   5:on   6:off +lrwxrwxrwx root root 15 Mar 20 20:55 getty.target -> ../getty.target 
-hdparm                    0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 24 Mar  2  2021 plymouth-quit.service -> ../plymouth-quit.service 
-hostname.sh               0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 29 Mar  2  2021 plymouth-quit-wait.service -> ../plymouth-quit-wait.service 
-hwclock.sh                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 33 Mar 20 20:55 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path 
-hwclockfirst.sh           0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 25 Mar 20 20:55 systemd-logind.service -> ../systemd-logind.service 
-ifupdown                  0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 39 Mar 20 20:55 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service 
-ifupdown-clean            0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +lrwxrwxrwx root root 32 Mar 20 20:55 systemd-user-sessions.service -> ../systemd-user-sessions.service
-kerneloops                0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-keyboard-setup            0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-killprocs                 0:off  1:on   2:off  3:off  4:off  5:off  6:off +
-lm-sensors                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-loadcpufreq               0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-module-init-tools         0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountall-bootclean.sh     0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountall.sh               0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountdevsubfs.sh          0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountkernfs.sh            0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountnfs-bootclean.sh     0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountnfs.sh               0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mountoverflowtmp          0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-mtab.sh                   0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-network-manager           0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-networking                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-nfs-common                0:off  1:off  2:on   3:on   4:on   5:on   6:off  S:on  +
-portmap                   0:off  1:off  2:on   3:on   4:on   5:on   6:off  S:on  +
-pppd-dns                  0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-procps                    0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-rc.local                  0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-rcS                       0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-rmnologin                 0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-rsyslog                   0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-saned                     0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-sendsigs                  0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-stop-bootlogd             0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-stop-bootlogd-single      0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-sudo                      0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-udev                      0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-udev-mtab                 0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-umountfs                  0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-umountnfs.sh              0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-umountroot                0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-unattended-upgrades       0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-urandom                   0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on  +
-vboxadd                   0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-vboxadd-service           0:off  1:off  2:on   3:on   4:on   5:on   6:off +
-vboxadd-x11               0:off  1:off  2:off  3:off  4:off  5:off  6:off +
-x11-common                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on +
 </code> </code>
  
-===Options de la commande===+===5.2 - La Cible par Défaut===
  
-Les options de la commande **chkconfig** sont :+==Consulter la Cible par Défaut== 
 + 
 +Pour consulter la cible par défaut, il convient d'utiliser la commande **systemctl get-default** :
  
 <code> <code>
-root@debian6:/tmpchkconfig --help +root@debian11:~systemctl get-default 
-usage: +graphical.target 
-        chkconfig -A|--allservices              (together with -l: show all services) +</code>
-        chkconfig -t|--terse [names]            (shows the links) +
-        chkconfig -e|--edit  [names]            (configure services) +
-        chkconfig -s|--set   [name state]...    (configure services) +
-        chkconfig -l|--list [--deps] [names]    (shows the links) +
-        chkconfig -c|--check name [state]       (check state) +
-        chkconfig -a|--add   [names]            (runs insserv) +
-        chkconfig -d|--del   [names]            (runs insserv -r) +
-        chkconfig -h|--help                     (print usage) +
-        chkconfig -f|--force ...                (call insserv with -f)+
  
-        chkconfig [name]           same as chkconfig -t +==Modifier la Cible par Défaut== 
-        chkconfig name state...    same as chkconfig -s name state+ 
 +Pour modifier la Cible par défaut avec une prise en compte lors du **prochain** démarrage, il convient d'utiliser la commande **systemctl set-default** : 
 + 
 +<code> 
 +root@debian11:~# ls -l /lib/systemd/system/multi-user.target 
 +-rw-r--r-- 1 root root 540 Feb  2  2021 /lib/systemd/system/multi-user.target 
 +root@debian11:~# systemctl set-default multi-user.target 
 +Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.
 </code> </code>
  
-Les options les plus importantes sont :+==Modifier la Cible en Cours==
  
-^ Option ^ Description ^ +Il est possible de modifier la cible actuellement en cours en utilisant la commande **systemctl isolate** :
-| - -add (nom) | Permet d'ajouter un service aux runlevels définis par le service lui-même | +
-| - -del (nom) | Permet de supprimer un service aux runlevels définis par le service lui-même | +
-| %%- -level [niveau] (nom) [on|off|reset]%%  | Permet d'activer, de désactiver ou de réinitialiser un service inscrit |+
  
-====La commande update-rc.d sous Debian 6====+<code> 
 +root@debian11:~# systemctl isolate rescue
  
-La commande **update-rc.d** est utilisée pour gérer les liens dans les répertoires rc[x].d. Cette commande permet d'insérer les liens vers un script dans /etc/init.d et prend la forme suivante :+root@debian11:~# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
 +  rescue.target                    loaded active active Rescue Mode
  
-<file> +root@debian11:~# runlevel 
-update-rc.d <service> start <priorité de démarrage> <runlevels de démarrage> . stop <priorité d'arrêt> <runlevels d'arrêt>+5 1
-</file>+
  
-Par exemple la commande suivante crée les liens **S** dans rc2.d à rc5.d avec une priorité de 20 et les liens **K** dans rc0.d, rc1.d et rc6.d avec une priorité de 20 pour le script /etc/init.d/ssh :+root@debian11:~# who -r 
 +         run-level 1  2022-04-30 12:19                   last=5
  
-  update-rc.d ssh start 20 2 3 4 5 . stop 20 0 1 6 . [Entrée]+root@debian11:~systemctl isolate multi-user
  
-<WRAP center round important> +root@debian11:~# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
-**Important** :  +  multi-user.target                loaded active active Multi-User System
-Il existe aussi un mot clef : **default**. Ce mot clef indique à **update-rc.d** d'utiliser les valeurs spécifiées dans la command précédente. +
-</WRAP>+
  
-Pour supprimer les liens il convient d'utiliser la commande suivante :+root@debian11:~# runlevel 
 +1 3
  
-  update-rc.d -f ssh remove [Entrée]+root@debian11:~who -
 +         run-level 3  2022-04-30 12:21                   last=1 
 +</code>
  
-<WRAP center round important> +====LAB #6 - Gestion des Services====
-**Important** :  +
-Cette commande laisse le script ssh dans le répertoire /etc/init.d. +
-</WRAP>+
  
-===Options de la commande===+===6.1 - Gestion des Instances Uniques===
  
-Les options de cette commande sont :+Commencez par installer le paquet **apache2** :
  
 <code> <code>
-root@debian:/etc/init.dupdate-rc.d --help +root@debian11:~apt install -y apache2
-update-rc.d: using dependency based boot sequencing +
-update-rc.d: error: --help +
-usage: update-rc.d [-n] [-f] <basename> remove +
-       update-rc.d [-n] <basename> defaults [NN | SS KK] +
-       update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] . +
-       update-rc.d [-n] <basename> disable|enable [S|2|3|4|5] +
- -n: not really +
- -f: force +
- +
-The disable|enable API is not stable and might change in the future.+
 </code> </code>
  
-=====Démarrer Debian 8 avec systemd=====+Pour obtenir le détail sur un service donné, il convient d'utiliser la commande **systemctl status** :
  
-Debian 8, comme beaucoup d'autres distributions, ont abandonné **Upstart** pour **Systemd**Ce dernier prend une approche différente au démarrage de LinuxEn effet, **SysVinit** et **Upstart** sont des systèmes de démarrage **séquentiels**. **Systemd** essaie, par contre, de démarrer autant de services en parallèle que possible. Ceci est rendu possible car la majorité d'architectures matérielles modernes sont multi-cœursSi un service dépend d'un autre qui n'est pas encore démarré ce premier est mis en attente dans une mémoire tamponQui plus est, les services qui ne sont pas nécessaires au démarrage de la machine, tel cups, ne sont démarrés ultérieurement que si nécessaireLors de démarrage, les partitions sont montées en parallèleDernièrement, **Systemd** remplace les scripts de démarrage traditionnels avec des binaires compilés, beaucoup plus rapides que leur prédécesseurs.+<code> 
 +root@debian11:~# systemctl status apache2.service 
 +● apache2.service The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
 +     Active: active (running) since Sat 2022-04-30 12:22:50 CEST; 42s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +   Main PID: 56037 (apache2) 
 +      Tasks: 55 (limit: 4663) 
 +     Memory: 8.8M 
 +        CPU: 38ms 
 +     CGroup: /system.slice/apache2.service 
 +             ├─56037 /usr/sbin/apache2 -k start 
 +             ├─56039 /usr/sbin/apache2 -k start 
 +             └─56040 /usr/sbin/apache2 -k start
  
-Au lieu de parler de scripts de démarrage et de niveaux d'exécution, **Systemd** utilise la terminologie **Unités** (//Units//) et **Cibles** (//Targets//)Une Cible est en quelque sorte une **grande étape** dans le démarrage du système tandis qu'une Unité peut être :+Apr 30 12:22:50 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 12:22:50 debian11 systemd[1]: Started The Apache HTTP Server. 
 +</code>
  
-  * un automount (.automount), +Dans le cas du service apache2 ci-dessuson peut constater que le statut est **enabled**. Le statut peut être une de 2 valeurs :
-  une périphérique - //Device// - (.device), +
-  un montage d'un périphérique - //Mount// - (.mount), +
-  un chemin - //Path// - (.path) +
-  un socket - //Socket// - (.socket), +
-  * un service - //Service// - (.service), +
-  * une instantanée - //Snapshot// - (.snapshot), +
-  * une cible - //Target// - (.target).+
  
-<WRAP center round important> +  * **disabled** - le service ne démarrera pas lors du prochain démarrage du système. 
-**Important** : Dans le contexte d'une Unité, le type **cible** regroupe des Unités multiples afin qu'elles puissent être démarrées en même temps. Par exemple **network.target** regroupe toutes les Unités nécessaires pour démarrer toutes les interfaces réseaux en même temps. +  * **enabled** - le service démarrera lors du prochain démarrage du système.
-</WRAP>+
  
-====La Commande systemctl==== +Il est possible de vérifier le statut en utilisant le commande **systemctl is-enabled** :
- +
-Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option **list-units** :+
  
 <code> <code>
-root@debian8:~# systemctl list-units +root@debian11:~# systemctl is-enabled apache2.service 
-UNIT                                                           LOAD   ACTIVE SUB       DESCRIPTION +enabled
-proc-sys-fs-binfmt_misc.automount                              loaded active waiting   Arbitrary Executable File Formats File System Automount Point +
-sys-devices-pci0000:00-0000:00:01.1-ata3-host2-target2:0:0-2:0:0:0-block-sr0.device loaded active plugged   VBOX_CD-ROM +
-sys-devices-pci0000:00-0000:00:03.0-net-eth0.device            loaded active plugged   82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapte +
-sys-devices-pci0000:00-0000:00:05.0-sound-card0.device         loaded active plugged   82801AA AC'97 Audio Controller +
-sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loaded active plugged   VBOX_HARDDISK 1 +
-sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loaded active plugged   VBOX_HARDDISK 2 +
-sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda5.device loaded active plugged   VBOX_HARDDISK 5 +
-sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda.device loaded active plugged   VBOX_HARDDISK +
-sys-devices-platform-serial8250-tty-ttyS0.device               loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS0 +
-sys-devices-platform-serial8250-tty-ttyS1.device               loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS1 +
-sys-devices-platform-serial8250-tty-ttyS2.device               loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS2 +
-sys-devices-platform-serial8250-tty-ttyS3.device               loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS3 +
-sys-module-fuse.device                                         loaded active plugged   /sys/module/fuse +
-sys-subsystem-net-devices-eth0.device                          loaded active plugged   82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapte +
--.mount                                                        loaded active mounted   / +
-dev-hugepages.mount                                            loaded active mounted   Huge Pages File System +
-dev-mqueue.mount                                               loaded active mounted   POSIX Message Queue File System +
-etc-machine\x2did.mount                                        loaded active mounted   /etc/machine-id +
-run-rpc_pipefs.mount                                           loaded active mounted   /run/rpc_pipefs +
-run-user-1000.mount                                            loaded active mounted   /run/user/1000 +
-run-user-120.mount                                             loaded active mounted   /run/user/120 +
-sys-fs-fuse-connections.mount                                  loaded active mounted   FUSE Control File System +
-sys-kernel-debug.mount                                         loaded active mounted   Debug File System +
-cups.path                                                      loaded active waiting   CUPS Printer Service Spool +
-systemd-ask-password-console.path                              loaded active waiting   Dispatch Password Requests to Console Directory Watch +
-systemd-ask-password-wall.path                                 loaded active waiting   Forward Password Requests to Wall Directory Watch +
-session-2.scope                                                loaded active running   Session 2 of user trainee +
-session-c1.scope                                               loaded active abandoned Session c1 of user lightdm +
-accounts-daemon.service                                        loaded active running   Accounts Service +
-atd.service                                                    loaded active running   Deferred execution scheduler +
-lines 1-31+
 </code> </code>
  
-Pour consulter la liste des Unités inactifsutilisez la commande suivante :+Pour rendre le statut **disabled**il convient d'utiliser la commande **systemctl disable** :
  
 <code> <code>
-root@debian8:~# systemctl list-units --all | grep inactive | more +root@debian11:~# systemctl disable apache2.service 
-  proc-sys-fs-binfmt_misc.mount                                                            loaded    inactive dead      Arbitrary Executable File Form +Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install
-ats File System +Executing: /lib/systemd/systemd-sysv-install disable apache2 
-  run-vmblock\x2dfuse.mount                                                                loaded    inactive dead      VMware vmblock fuse mount +Removed /etc/systemd/system/multi-user.target.wants/apache2.service. 
-  sys-kernel-config.mount                                                                  loaded    inactive dead      Configuration File System + 
-  tmp.mount                                                                                loaded    inactive dead      Temporary Directory +root@debian11:~# systemctl is-enabled apache2.service 
-● var-lock.mount                                                                           not-found inactive dead      var-lock.mount +disabled 
-● var-run.mount                                                                            not-found inactive dead      var-run.mount + 
-  systemd-ask-password-plymouth.path                                                       loaded    inactive dead      Forward Password Requests to P +root@debian11:~# systemctl status apache2.service 
-lymouth Directory Watch +● apache2.service - The Apache HTTP Server 
-  alsa-restore.service                                                                     loaded    inactive dead      Restore Sound Card State +     Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled) 
-  alsa-state.service                                                                       loaded    inactive dead      Manage Sound Card State (resto +     Active: active (running) since Sat 2022-04-30 12:22:50 CEST; 3min 6s ago 
-re and store) +       Docs: https://httpd.apache.org/docs/2.4/ 
-  alsa-store.service                                                                       loaded    inactive dead      Store Sound Card State +   Main PID: 56037 (apache2) 
-  anacron.service                                                                          loaded    inactive dead      Run anacron jobs +      Tasks: 55 (limit: 4663) 
-● bootmisc.service                                                                         masked    inactive dead      bootmisc.service +     Memory: 8.8M 
-● clamav-daemon.service                                                                    not-found inactive dead      clamav-daemon.service +        CPU: 46ms 
-● console-screen.service                                                                   not-found inactive dead      console-screen.service +     CGroup: /system.slice/apache2.service 
-  debian-fixup.service                                                                     loaded    inactive dead      Various fixups to make systemd +             ├─56037 /usr/sbin/apache2 -k start 
- work better on Debian +             ├─56039 /usr/sbin/apache2 -k start 
-  emergency.service                                                                        loaded    inactive dead      Emergency Shell +             └─56040 /usr/sbin/apache2 -k start 
-● festival.service                                                                         not-found inactive dead      festival.service + 
-  getty-static.service                                                                     loaded    inactive dead      getty on tty2-tty6 if dbus and +Apr 30 12:22:50 debian11 systemd[1]: Starting The Apache HTTP Server..
- logind are not available +Apr 30 12:22:50 debian11 systemd[1]: Started The Apache HTTP Server.
-● greylist.service                                                                         not-found inactive dead      greylist.service +
-● keymap.service                                                                           not-found inactive dead      keymap.service +
-● mountkernfs.service                                                                      masked    inactive dead      mountkernfs.service +
-● mysql.service                                                                            not-found inactive dead      mysql.service +
-  open-vm-tools.service                                                                    loaded    inactive dead      Service for virtual machines h +
-osted on VMware +
-  plymouth-quit-wait.service                                                               loaded    inactive dead      Wait for Plymouth Boot Screen  +
-to Quit +
---More--+
 </code> </code>
  
-Pour consulter la liste des fichiers Unitésutilisez la commande suivante :+Dans le cas du service httpd ci-dessuson peut constater que l'état est **active (running)**.  L'état peut être une de 7 valeurs : 
 + 
 +  * **inactive (dead)** - le service est arrêté. 
 +  * **active(running)** - le service est démarré avec un ou plusieurs processus. 
 +  * **active(exited)** - le service a terminé une configuration unique. 
 +  * **active(waiting)** - le service est démarré mais en attente d'un évènement. 
 +  * **activating** - le service est en cours d'activation. 
 +  * **deactivating** - le service est en cours de désactivation. 
 +  * **failed** - le service a rencontré une erreur fatale. 
 + 
 +Il est possible de vérifier l'état en utilisant le commande **systemctl is-active** :
  
 <code> <code>
-root@debian8:~# systemctl list-unit-files | more +root@debian11:~# systemctl is-active apache2.service 
-UNIT FILE                                  STATE    +active
-proc-sys-fs-binfmt_misc.automount          static   +
-dev-hugepages.mount                        static   +
-dev-mqueue.mount                           static   +
-proc-sys-fs-binfmt_misc.mount              static   +
-run-vmblock\x2dfuse.mount                  enabled  +
-sys-fs-fuse-connections.mount              static   +
-sys-kernel-config.mount                    static   +
-sys-kernel-debug.mount                     static   +
-tmp.mount                                  disabled +
-cups.path                                  enabled  +
-systemd-ask-password-console.path          static   +
-systemd-ask-password-plymouth.path         static   +
-systemd-ask-password-wall.path             static   +
-session-2.scope                            static   +
-session-c1.scope                           static   +
-accounts-daemon.service                    enabled  +
-alsa-restore.service                       static   +
-alsa-state.service                         static   +
-alsa-store.service                         static   +
-alsa-utils.service                         masked   +
-anacron-resume.service                     enabled  +
-anacron.service                            enabled  +
-atd.service                                enabled  +
-auditd.service                             enabled  +
-autovt@.service                            disabled +
-avahi-daemon.service                       enabled  +
-bluetooth.service                          enabled  +
-bootlogd.service                           masked   +
-bootlogs.service                           masked   +
-bootmisc.service                           masked   +
---More--+
 </code> </code>
  
-===Options de la Commande systemctl===+Pour rendre l'état **inactive(dead)**, utilisez la commande suivante :
  
-Les options de la commande **systemctl** sont :+<code> 
 +root@debian11:~# systemctl stop apache2.service 
 +</code> 
 + 
 +Vérifiez ensuite l'état du service :
  
 <code> <code>
-root@debian8:~# systemctl --help +root@debian11:~# systemctl is-active apache2.service 
-systemctl [OPTIONS...] {COMMAND} ...+inactive
  
-Query or send control commands to the systemd manager.+root@debian11:~# systemctl status apache2.service 
 +● apache2.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled) 
 +     Active: inactive (dead) since Sat 2022-04-30 12:27:53 CEST; 1min 26s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +    Process: 56435 ExecStop=/usr/sbin/apachectl graceful-stop (code=exited, status=0/SUCCESS) 
 +   Main PID: 56037 (code=exited, status=0/SUCCESS) 
 +        CPU: 77ms
  
-  -h --help           Show this help +Apr 30 12:22:50 debian11 systemd[1]: Starting The Apache HTTP Server... 
-     --version        Show package version +Apr 30 12:22:50 debian11 systemd[1]: Started The Apache HTTP Server. 
-     --system         Connect to system manager +Apr 30 12:27:53 debian11 systemd[1]: Stopping The Apache HTTP Server..
-     --user           Connect to user service manager +Apr 30 12:27:53 debian11 systemd[1]: apache2.service: Succeeded
-  -H --host=[USER@]HOST +Apr 30 12:27:53 debian11 systemd[1]: Stopped The Apache HTTP Server.
-                      Operate on remote host +
-  -M --machine=CONTAINER +
-                      Operate on local container +
-  -t --type=TYPE      List only units of a particular type +
-     --state=STATE    List only units with particular LOAD or SUB or ACTIVE state +
-  -p --property=NAME  Show only properties by this name +
-  -a --all            Show all loaded units/properties, including dead/empty +
-                      onesTo list all units installed on the system, use +
-                      the 'list-unit-files' command instead+
-  -l --full           Don't ellipsize unit names on output +
-  -r --recursive      Show unit list of host and local containers +
-     --reverse        Show reverse dependencies with 'list-dependencies' +
-     --job-mode=MODE  Specify how to deal with already queued jobs, when +
-                      queueing a new job +
-     --show-types     When showing sockets, explicitly show their type +
-  -i --ignore-inhibitors +
-                      When shutting down or sleeping, ignore inhibitors +
-     --kill-who=WHO   Who to send signal to +
-  -s --signal=SIGNAL  Which signal to send +
-  -q --quiet          Suppress output +
-     --no-block       Do not wait until operation finished +
-     --no-wall        Don't send wall message before halt/power-off/reboot +
-lines 1-31+
 </code> </code>
  
-====Fichiers de Configuration==== +Pour démarrer une Unité de service, utilisez la commande suivante :
- +
-Les Cibles et les Unités sont configurées par des fichiers se trouvant dans le répertoire **/etc/systemd/system** :+
  
 <code> <code>
-root@debian8:~# ls -l /etc/systemd/system +root@debian11:~# systemctl start apache2.service 
-total 52 + 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 bluetooth.target.wants +root@debian11:~# systemctl status apache2.service 
-lrwxrwxrwx 1 root root   37 Oct 23 16:34 dbus-org.bluez.service -/lib/systemd/system/bluetooth.service +● apache2.service - The Apache HTTP Server 
-lrwxrwxrwx 1 root root   40 Oct 23 16:34 dbus-org.freedesktop.Avahi.service -> /lib/systemd/system/avahi-daemon.service +     Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled) 
-lrwxrwxrwx 1 root root   40 Oct 23 16:34 dbus-org.freedesktop.ModemManager1.service -> /lib/systemd/system/ModemManager.service +     Activeactive (running) since Sat 2022-04-30 12:30:17 CEST; 2s ago 
-lrwxrwxrwx 1 root root   53 Oct 23 16:34 dbus-org.freedesktop.nm-dispatcher.service -> /lib/systemd/system/NetworkManager-dispatcher.service +       Docs: https://httpd.apache.org/docs/2.4
-lrwxrwxrwx 1 root root   35 Oct 23 16:34 display-manager.service -> /lib/systemd/system/lightdm.service +    Process56448 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 getty.target.wants +   Main PID56452 (apache2) 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 graphical.target.wants +      Tasks55 (limit4663) 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 halt.target.wants +     Memory8.7M 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 hibernate.target.wants +        CPU35ms 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 hybrid-sleep.target.wants +     CGroup/system.slice/apache2.service 
-drwxr-xr-x 2 root root 4096 Oct 28 06:37 multi-user.target.wants +             ├─56452 /usr/sbin/apache2 -k start 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 paths.target.wants +             ├─56453 /usr/sbin/apache2 -k start 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 poweroff.target.wants +             └─56454 /usr/sbin/apache2 -k start 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 printer.target.wants + 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 reboot.target.wants +Apr 30 12:30:17 debian11 systemd[1]Starting The Apache HTTP Server... 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 sockets.target.wants +Apr 30 12:30:17 debian11 systemd[1]Started The Apache HTTP Server.
-lrwxrwxrwx root root   31 Oct 23 16:34 sshd.service -> /lib/systemd/system/ssh.service +
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 suspend.target.wants +
-lrwxrwxrwx root root   35 Oct 23 16:34 syslog.service -> /lib/systemd/system/rsyslog.service+
 </code> </code>
  
-ainsi que par des fichiers se trouvant dans le répertoire **/lib/systemd/system** :+Pour activer un service au prochain démarrage du système, utilisez l'option **enable** :
  
 <code> <code>
-root@debian8:~# ls -l /lib/systemd/system | more +root@debian11:~# systemctl enable apache2.service 
-total 904 +Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install
--rw-r--r-- 1 root root  411 Oct  1  2014 accounts-daemon.service +Executing: /lib/systemd/systemd-sysv-install enable apache2 
--rw-r--r-- 1 root root  476 Jul  8  2014 alsa-restore.service + 
--rw-r--r-- 1 root root  526 Jul  8  2014 alsa-state.service +Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service. 
--rw-r--r-- 1 root root  373 Jul  8  2014 alsa-store.service +root@debian11:~# systemctl status apache2.service 
-lrwxrwxrwx 1 root root    9 Oct 23 16:34 alsa-utils.service -> /dev/null +● apache2.service - The Apache HTTP Server 
--rw-r--r-- 1 root root  283 Dec 28  2014 anacron-resume.service +     Loadedloaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
--rw-r--r-- 1 root root  183 Dec 28  2014 anacron.service +     Active: active (running) since Sat 2022-04-30 12:30:17 CEST; 1min 5s ago 
--rw-r--r-- 1 root root  169 Sep 30  2014 atd.service +       Docs: https://httpd.apache.org/docs/2.4/ 
--rw-r--r-- 1 root root  688 Dec  9  2014 auditd.service +   Main PID56452 (apache2) 
-lrwxrwxrwx 1 root root   14 Aug 31 00:04 autovt@.service -> getty@.service +      Tasks55 (limit: 4663) 
--rw-r--r-- 1 root root 1044 Apr 14  2015 avahi-daemon.service +     Memory8.7M 
--rw-r--r-- 1 root root  874 Apr 14  2015 avahi-daemon.socket +        CPU39ms 
--rw-r--r-- 1 root root  524 Aug 31 00:04 basic.target +     CGroup/system.slice/apache2.service 
-drwxr-xr-x 2 root root 4096 Oct 23 16:34 basic.target.wants +             ├─56452 /usr/sbin/apache2 -k start 
--rw-r--r-- 1 root root  338 Jan  3  2015 bluetooth.service +             ├─56453 /usr/sbin/apache2 -k start 
--rw-r--r-- 1 root root  379 Aug 31 00:04 bluetooth.target +             └─56454 /usr/sbin/apache2 -k start 
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 bootlogd.service -> /dev/null + 
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 bootlogs.service -> /dev/null +Apr 30 12:30:17 debian11 systemd[1]Starting The Apache HTTP Server..
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 bootmisc.service -> /dev/null +Apr 30 12:30:17 debian11 systemd[1]Started The Apache HTTP Server.
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 checkfs.service -> /dev/null +
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 checkroot-bootclean.service -> /dev/null +
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 checkroot.service -> /dev/null +
--rw-r--r-- 1 root root  298 Dec  9  2014 colord.service +
--rw-r--r-- 1 root root  150 Oct 23  2014 configure-printer@.service +
--rw-r--r-- 1 root root  737 Aug 31 00:04 console-getty.service +
--rw-r--r-- 1 root root  741 Aug 31 00:04 console-shell.service +
--rw-r--r-- 1 root root  783 Aug 31 00:04 container-getty@.service +
--rw-r--r-- root root  251 May 14 09:18 cron.service +
-lrwxrwxrwx 1 root root    9 Aug 31 00:04 cryptdisks-early.service -> /dev/null +
-lrwxrwxrwx root root    9 Aug 31 00:04 cryptdisks.service -> /dev/null +
---More--+
 </code> </code>
  
-Par exemple, sous Debian 8, le service sshd est configuré par le fichier **/etc/systemd/system/sshd.service** :+===6.2 - Gestion d'Instances Multiples=== 
 + 
 +Systemd permet l'utilisation des gabarits (templates) des fichiers de configuration des Unités. De cette façon il est possible de faire coexister deux ou plusieurs instances du même service. Un gabarit est reconnaissable par le caractère **@** qui est placé juste avant le point dans le nom du fichier :
  
 <code> <code>
-root@debian8:~# cat /etc/systemd/system/sshd.service+root@debian11:~# cat /usr/lib/systemd/system/apache2@.service
 [Unit] [Unit]
-Description=OpenBSD Secure Shell server +Description=The Apache HTTP Server 
-After=network.target auditd.service +After=network.target remote-fs.target nss-lookup.target 
-ConditionPathExists=!/etc/ssh/sshd_not_to_be_run+ConditionPathIsDirectory=/etc/apache2-%i 
 +Documentation=https://httpd.apache.org/docs/2.4/
  
 [Service] [Service]
-EnvironmentFile=-/etc/default/ssh +Type=forking 
-ExecStart=/usr/sbin/sshd -D $SSHD_OPTS +Environment=APACHE_CONFDIR=/etc/apache2-%i APACHE_STARTED_BY_SYSTEMD=true 
-ExecReload=/bin/kill -HUP $MAINPID +ExecStart=/usr/sbin/apachectl start 
-KillMode=process +ExecStop=/usr/sbin/apachectl graceful-stop 
-Restart=on-failure+ExecReload=/usr/sbin/apachectl graceful 
 +KillMode=mixed 
 +PrivateTmp=true 
 +Restart=on-abort
  
 [Install] [Install]
 WantedBy=multi-user.target WantedBy=multi-user.target
-Alias=sshd.service 
 </code> </code>
  
-Dans ce fichier on peut noter la présence des lignes suivantes :+Une instance créée à partir de ce gabarit devrait avoir un nom sous la forme suivante :
  
-  * **ExecStart=/usr/sbin/sshd -D $SSHD_OPTS**, +<code> 
-     * Cette ligne définit l'exécutable à lancer, +apache2@<nom_instance>.service 
-  * **After=network.target auditd.service**, +</code>
-    * Cette ligne indique les services qui devraient être démarrés avant le démarrage de sshd, +
-  * **WantedBy=multi-user.target**, +
-    * Cette ligne indique la Cible dans laquelle le service doit être démarré, +
-  * **Restart=on-failure**, +
-    * Cette ligne indique quand le service doit être re-démarré.+
  
-====Système de Démarrage====+Dans ce fichier on peut constater l'utilisation d'un **identifier** sous la forme de **%i**. Les identifiers sont de deux types - un dit **échappé** où les caractères non-ASCII alphanumérique sont remplacés par **escapes** de type langage C et l'autre non-échappé :
  
-**Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d'exécutionPour rendre la transition plus facileil existe des **Cibles** qui simulent les niveaux d'exécution de **SysVinit** :+  %n : est remplacé par le nom complet échappé de l'Unité. 
 +  %N : est remplacé par le nom complet non-échappé de l'Unité. 
 +  %p : est remplacé par le préfixe échappé de l'Unité, c'est-à-dire la partie **avant** le caractère @. 
 +  * %P : est remplacé par le préfixe non-échappé de l'Unité, c'est-à-dire la partie **avant** le caractère @. 
 +  * %i : est remplacé par le nom de l'instance échappé de l'Unité, c'est-à-dire la partie **après** le caractère @ et **avant** le point. 
 +  * %I : est remplacé par le nom de l'instance non-échappé de l'Unitéc'est-à-dire la partie **après** le caractère @ et **avant** le point. 
 +  * %f : est remplacé par le préfixe non-échappé ou le nom de l'instance non-échappé préfixé par le caractère **/**. 
 +  * %c : est remplacé par le CGroup de l'Unité sans le chemin /sys/fs/cgroup/systemd/
 +  * %u : est remplacé par le nom de l'utilisateur responsable de l'exécution de l'Unité. 
 +  %U : est remplacé par l'UID de l'utilisateur responsable de l'exécution de l'Unité. 
 +  %H : est remplacé par le nom d'hôte sur lequel est exécuté l'Unité. 
 +  %% est remplacé" par le caractère **%**.
  
-  runlevel0.target, +Créez maintenant deux copies du fichier **/usr/lib/systemd/system/apache2@.service** :
-  runlevel1.target, +
-  runlevel2.target, +
-  runlevel3.target, +
-  * runlevel4.target, +
-  * runlevel5.target, +
-  * runlevel6.target.+
  
-Ceci étant il y principalement deux Cibles finales :+<code> 
 +root@debian11:~# cp /usr/lib/systemd/system/apache2@.service /usr/lib/systemd/system/apache2@instance01.service 
 +root@debian11:~# cp /usr/lib/systemd/system/apache2@.service /usr/lib/systemd/system/apache2@instance02.service 
 +</code>
  
-  * **multi-user.target** qui est l'équivalent du niveau d'exécution 3, +Copiez le répertoire **/etc/apache2** vers **/etc/apache2-instance01** et **/etc/apache2-instance02** :
-  * **graphical.target** qui est l'équivalent du niveau d'exécution 5.+
  
-Chaque Cible est décrite par un fichier de configuration :+<code> 
 +root@debian11:~# cp -r /etc/apache2/ /etc/apache2-instance01 
 +root@debian11:~# cp -r /etc/apache2/ /etc/apache2-instance02 
 +</code> 
 + 
 +Editez le fichier **vi /etc/apache2-instance01/ports.conf** en modifiant le port d'écoute à 81 :
  
 <code> <code>
-root@debian8:~# cat /lib/systemd/system/graphical.target +root@debian11:~# vi /etc/apache2-instance01/ports.conf 
- This file is part of systemd+root@debian11:~cat /etc/apache2-instance01/ports.conf 
-# +If you just change the port or add more ports here, you will likely also 
-#  systemd is free software; you can redistribute it and/or modify it +have to change the VirtualHost statement in 
- under the terms of the GNU Lesser General Public License as published by +/etc/apache2/sites-enabled/000-default.conf
- the Free Software Foundation; either version 2.1 of the License, or +
-#  (at your option) any later version.+
  
-[Unit] +Listen 81
-Description=Graphical Interface +
-Documentation=man:systemd.special(7) +
-Requires=multi-user.target +
-After=multi-user.target +
-Conflicts=rescue.target +
-Wants=display-manager.service +
-AllowIsolate=yes +
-</code>+
  
-Dans ce fichier on peut noter la présence des lignes suivantes :+<IfModule ssl_module> 
 +        Listen 443 
 +</IfModule>
  
-  * **Requires=multi-user.target**, +<IfModule mod_gnutls.c> 
-     * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint aupréalable, +        Listen 443 
-  * **After=multi-user.target**, +</IfModule>
-    * Cette ligne indique le **multi-user.target** doit d'abord être lancé, +
-  * **Conflicts=rescue.target**, +
-    * Cette ligne indique la Cible en conflit avec le **graphical.target**, +
-  * **Wants=display-manager.service**, +
-    * Cette ligne indique quel service doit être démarré.+
  
-Dernièrement, la Cible par défaut peut être modifiée en éditant le lien symbolique **/lib/systemd/system/default.target** :+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 
 +</code> 
 + 
 +Editez le fichier **vi /etc/apache2-instance02/ports.conf** en modifiant le port d'écoute à 82 :
  
 <code> <code>
-root@debian8:~# ls -l /lib/systemd/system/default.target +root@debian11:~# vi /etc/apache2-instance02/ports.conf 
-lrwxrwxrwx 1 root root 16 Aug 31 00:04 /lib/systemd/system/default.target -> graphical.target +root@debian11:~# cat /etc/apache2-instance02/ports.conf 
-</code>+# If you just change the port or add more ports here, you will likely also 
 +# have to change the VirtualHost statement in 
 +/etc/apache2/sites-enabled/000-default.conf
  
-====La Commande systemd-analyze====+Listen 82
  
-Pour avoir une évaluation du temps de démarrage, il convient d'utiliser la commande suivante :+<IfModule ssl_module> 
 +        Listen 443 
 +</IfModule> 
 + 
 +<IfModule mod_gnutls.c> 
 +        Listen 443 
 +</IfModule>
  
-<code> +vim: syntax=apache ts=4 sw=4 sts=4 sr noet
-root@debian8:~systemd-analyze +
-Startup finished in 6.296s (kernel) + 17.035s (userspace) 23.332s+
 </code> </code>
  
-L'option **blame** de la commande systemd-analyze permet de voir le temps de démarrage de chaque Unité afin de pourvoir se concentrer sur les plus lentes :+Editez la directive **APACHE_PID_FILE** du fichier **/etc/apache2-instance01/envvars** :
  
 <code> <code>
-root@debian8:~# systemd-analyze blame +root@debian11:~# vi /etc/apache2-instance01/envvars 
-          6.942s NetworkManager.service +root@debian11:~# cat /etc/apache2-instance01/envvars 
-          6.781s ModemManager.service +# envvars default environment variables for apache2ctl
-          6.672s exim4.service +
-          5.483s accounts-daemon.service +
-          3.697s alsa-restore.service +
-          3.697s pppd-dns.service +
-          3.587s systemd-logind.service +
-          3.554s vboxadd-x11.service +
-          3.545s vboxadd.service +
-          3.543s rc-local.service +
-          3.539s minissdpd.service +
-          3.538s irqbalance.service +
-          3.527s gdomap.service +
-          3.527s speech-dispatcher.service +
-          3.461s avahi-daemon.service +
-          2.895s networking.service +
-          2.726s kbd.service +
-          1.652s polkitd.service +
-          1.459s keyboard-setup.service +
-          1.434s lightdm.service +
-          1.055s rsyslog.service +
-           955ms systemd-tmpfiles-setup.service +
-           864ms systemd-modules-load.service +
-           830ms vboxadd-service.service +
-           778ms systemd-journal-flush.service +
-           697ms nfs-common.service +
-           644ms systemd-tmpfiles-setup-dev.service +
-           600ms console-setup.service +
-           555ms rpcbind.service +
-           494ms systemd-setup-dgram-qlen.service +
-           456ms sys-kernel-debug.mount +
-lines 1-31 +
-</code>+
  
-L'option **critical-chain** permet de voir l'enchaînement des événements qui amènent au chargement de l'Unité passée en argument :+# this won't be correct after changing uid 
 +unset HOME
  
-<code> +# for supporting multiple apache2 instances 
-root@debian8:~systemd-analyze critical-chain sshd.service +if [ "${APACHE_CONFDIR##/etc/apache2-}!= "${APACHE_CONFDIR}" ] ; then 
-The time after the unit is active or started is printed after the "@character. +        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}" 
-The time the unit takes to start is printed after the "+character.+else 
 +        SUFFIX= 
 +fi
  
-ssh.service @10.074s +# Since there is no sane way to get the parsed apache2 config in scripts, some 
-└─basic.target @9.951s +# settings are defined via environment variables and then used in apache2ctl, 
-  └─paths.target @9.950s +# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc
-    └─cups.path @9.950s +export APACHE_RUN_USER=www-data 
-      └─sysinit.target @9.940s +export APACHE_RUN_GROUP=www-data 
-        └─nfs-common.service @9.242s +697ms +# temporary state file locationThis might be changed to /run in Wheezy+1 
-          └─rpcbind.target @9.242s +export APACHE_PID_FILE=/var/run/apache2-instance01/apache2.pid 
-            └─rpcbind.service @8.684s +555ms +export APACHE_RUN_DIR=/var/run/apache2$SUFFIX 
-              └─network-online.target @8.683s +export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX 
-                └─network.target @8.683s +# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2
-                  └─networking.service @5.788s +2.895s +export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
-                    └─systemd-random-seed.service @5.458s +328ms +
-                      └─systemd-remount-fs.service @5.298s +157ms +
-                        └─keyboard-setup.service @3.837s +1.459s +
-                          └─systemd-udevd.service @3.702s +126ms +
-                            └─systemd-tmpfiles-setup-dev.service @3.057s +644ms +
-                              └─kmod-static-nodes.service @2.858s +193ms +
-                                └─system.slice @2.805s +
-                                  └─-.slice @2.804s+
  
-</code>+## The locale used by some modules like mod_dav 
 +export LANG=C 
 +## Uncomment the following line to use the system default locale instead: 
 +#. /etc/default/locale
  
-===Options de la Commande===+export LANG
  
-Les options de la commande **systemd-analyze** sont :+## The command to get the status for 'apache2ctl status'
 +## Some packages providing 'www-browser' need '--dump' instead of '-dump'
 +#export APACHE_LYNX='www-browser -dump' 
 + 
 +## If you need a higher file descriptor limit, uncomment and adjust the 
 +## following line (default is 8192): 
 +#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536' 
 + 
 +## If you would like to pass arguments to the web server, add them below 
 +## to the APACHE_ARGUMENTS environment. 
 +#export APACHE_ARGUMENTS='' 
 + 
 +## Enable the debug mode for maintainer scripts. 
 +## This will produce a verbose output on package installations of web server modules and web application 
 +## installations which interact with Apache 
 +#export APACHE2_MAINTSCRIPT_DEBUG=1 
 +</code>  
 + 
 +Editez la directive **APACHE_PID_FILE** du fichier **/etc/apache2-instance02/envvars** :
  
 <code> <code>
-root@debian8:~# systemd-analyze --help +root@debian11:~# vi /etc/apache2-instance02/envvars 
-systemd-analyze [OPTIONS...] {COMMAND} ...+root@debian11:~# cat /etc/apache2-instance02/envvars 
 +# envvars default environment variables for apache2ctl
  
-Process systemd profiling information.+# this won't be correct after changing uid 
 +unset HOME
  
-  -h --help               Show this help +# for supporting multiple apache2 instances 
-     --version            Show package version +if [ "${APACHE_CONFDIR##/etc/apache2-}" !"${APACHE_CONFDIR}" ; then 
-     --no-pager           Do not pipe output into a pager +        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}" 
-     --system             Connect to system manager +else 
-     --user               Connect to user manager +        SUFFIX
-  -H --host=[USER@]HOST   Operate on remote host +fi
-  -M --machine=CONTAINER  Operate on local container +
-     --order              When generating a dependency graph, show only order +
-     --require            When generating a dependency graph, show only requirement +
-     --from-pattern=GLOB, --to-pattern=GLOB +
-                          When generating a dependency graph, filter only origins +
-                          or destinations, respectively +
-     --fuzz=TIMESPAN      When printing the tree of the critical chain, print also +
-                          services, which finished TIMESPAN earlier, than the +
-                          latest in the branch. The unit of TIMESPAN is seconds +
-                          unless specified with a different unit, i.e. 50ms+
  
-Commands: +# Since there is no sane way to get the parsed apache2 config in scripts, some 
-  time                    Print time spent in the kernel before reaching userspace +# settings are defined via environment variables and then used in apache2ctl, 
-  blame                   Print list of running units ordered by time to init +# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc. 
-  critical-chain          Print a tree of the time critical chain of units +export APACHE_RUN_USER=www-data 
-  plot                    Output SVG graphic showing service initialization +export APACHE_RUN_GROUP=www-data 
-  dot                     Output dependency graph in dot(1) format +# temporary state file location. This might be changed to /run in Wheezy+
-  set-log-level LEVEL     Set logging threshold for systemd +export APACHE_PID_FILE=/var/run/apache2-instance02/apache2.pid 
-  dump                    Output state serialization of service manager +export APACHE_RUN_DIR=/var/run/apache2$SUFFIX 
-</code>+export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX 
 +# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2. 
 +export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
  
-====Gestion des Services====+## The locale used by some modules like mod_dav 
 +export LANG=
 +## Uncomment the following line to use the system default locale instead: 
 +#. /etc/default/locale
  
-Sous Debian 8, sshd.service est un lien vers ssh.service :+export LANG
  
-<code> +## The command to get the status for 'apache2ctl status'. 
-root@debian8:~ls -l /etc/systemd/system/sshd.service +## Some packages providing 'www-browser' need '--dump' instead of '-dump'
-lrwxrwxrwx 1 root root 31 Oct 23 16:34 /etc/systemd/system/sshd.service -> /lib/systemd/system/ssh.service +#export APACHE_LYNX='www-browser -dump' 
-</code>+ 
 +## If you need a higher file descriptor limit, uncomment and adjust the 
 +## following line (default is 8192): 
 +#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536' 
 + 
 +## If you would like to pass arguments to the web server, add them below 
 +## to the APACHE_ARGUMENTS environment. 
 +#export APACHE_ARGUMENTS='' 
 + 
 +## Enable the debug mode for maintainer scripts. 
 +## This will produce a verbose output on package installations of web server modules and web application 
 +## installations which interact with Apache 
 +#export APACHE2_MAINTSCRIPT_DEBUG=1 
 +</code> 
  
-Pour obtenir le détail sur un service donné, il convient d'utiliser la commande **systemctl** :+Créez les répertoires **/var/log/apache2-instance01** et **/var/log/apache2-instance02** en modifiant le groupe associé :
  
 <code> <code>
-root@debian8:~# systemctl status ssh.service +root@debian11:~# mkdir /var/log/apache2-instance01 
-● ssh.service - OpenBSD Secure Shell server +root@debian11:~# mkdir /var/log/apache2-instance02
-   Loaded: loaded (/lib/systemd/system/ssh.service; enabled) +
-   Active: active (running) since Sun 2015-11-01 09:35:03 CET; 10min ago +
- Main PID2024 (sshd) +
-   CGroup: /system.slice/ssh.service +
-           └─2024 /usr/sbin/sshd -D+
  
-Nov 01 09:35:03 debian8 sshd[2024]: Server listening on 0.0.0.0 port 22. +root@debian11:~# chown root:adm /var/log/apache2-instance01 
-Nov 01 09:35:03 debian8 sshd[2024]: Server listening on :: port 22.+root@debian11:~# chown root:adm /var/log/apache2-instance02
 </code> </code>
  
-Pour arrêter une Unité de service, utilisez la commande suivante :+Démarrez les deux services :
  
 <code> <code>
-root@debian8:~# systemctl stop ssh.service +root@debian11:~# systemctl start apache2@instance01.service
-root@debian8:~# systemctl status ssh.service +
-● ssh.service - OpenBSD Secure Shell server +
-   Loaded: loaded (/lib/systemd/system/ssh.service; enabled) +
-   Active: inactive (dead) since Sun 2015-11-01 09:46:13 CET; 2s ago +
- Main PID: 2024 (code=exited, status=0/SUCCESS)+
  
-Nov 01 09:35:03 debian8 sshd[2024]: Server listening on 0.0.0.0 port 22+root@debian11:~# systemctl status apache2@instance01.service 
-Nov 01 09:35:03 debian8 sshd[2024]: Server listening on :: port 22.+● apache2@instance01.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2@instance01.service; disabled; vendor preset: enabled) 
 +     Active: active (running) since Sat 2022-04-30 13:51:47 CEST; 4s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +    Process: 56906 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) 
 +   Main PID: 56910 (apache2) 
 +      Tasks: 55 (limit: 4663) 
 +     Memory: 8.8M 
 +        CPU: 31ms 
 +     CGroup: /system.slice/system-apache2.slice/apache2@instance01.service 
 +             ├─56910 /usr/sbin/apache2 -d /etc/apache2-instance01 -k start 
 +             ├─56911 /usr/sbin/apache2 -d /etc/apache2-instance01 -k start 
 +             └─56912 /usr/sbin/apache2 -d /etc/apache2-instance01 -k start 
 + 
 +Apr 30 13:51:47 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 13:51:47 debian11 systemd[1]: Started The Apache HTTP Server. 
 + 
 +root@debian11:~# systemctl start apache2@instance02.service 
 + 
 +root@debian11:~# systemctl status apache2@instance02.service 
 +● apache2@instance02.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2@instance02.service; disabled; vendor preset: enabled) 
 +     Active: active (running) since Sat 2022-04-30 14:04:21 CEST; 10s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +    Process: 57137 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) 
 +   Main PID: 57148 (apache2) 
 +      Tasks: 55 (limit: 4663) 
 +     Memory: 8.8M 
 +        CPU37ms 
 +     CGroup: /system.slice/system-apache2.slice/apache2@instance02.service 
 +             ├─57148 /usr/sbin/apache2 -d /etc/apache2-instance02 -k start 
 +             ├─57149 /usr/sbin/apache2 -d /etc/apache2-instance02 -k start 
 +             └─57150 /usr/sbin/apache2 -d /etc/apache2-instance02 -k start 
 + 
 +Apr 30 14:04:21 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 14:04:21 debian11 systemd[1]: Started The Apache HTTP Server.
 </code> </code>
  
-Pour démarrer un service, utilisez la commande suivante :+Installez l'exécutable **lynx** :
  
 <code> <code>
-root@debian8:~# systemctl start ssh.service +root@debian11:~# apt -y install lynx
-root@debian8:~# systemctl status ssh.service +
-● ssh.service OpenBSD Secure Shell server +
-   Loaded: loaded (/lib/systemd/system/ssh.service; enabled) +
-   Active: active (running) since Sun 2015-11-01 09:47:10 CET; 6s ago +
- Main PID: 2180 (sshd) +
-   CGroup: /system.slice/ssh.service +
-           └─2180 /usr/sbin/sshd -D +
- +
-Nov 01 09:47:10 debian8 sshd[2180]: Server listening on 0.0.0.0 port 22. +
-Nov 01 09:47:10 debian8 sshd[2180]: Server listening on :: port 22.+
 </code> </code>
  
-Pour désactiver un service au prochain démarrage du système, utilisez l'option **disable** :+Testez ensuite les deux instances d'Apache :
  
 <code> <code>
-root@debian8:~# systemctl disable ssh.service +root@debian11:~# lynx --dump http://localhost:81 | more 
-Synchronizing state for ssh.service with sysvinit using update-rc.d... +   Debian Logo Apache2 Debian Default Page 
-Executing /usr/sbin/update-rc.d ssh defaults +   It works!
-Executing /usr/sbin/update-rc.d ssh disable +
-insservwarning: current start runlevel(s) (empty) of script `ssh' overrides LSB defaults (2 3 4 5). +
-insserv: warning: current stop runlevel(s) (2 3 4 5) of script `ssh' overrides LSB defaults (empty). +
-Removed symlink /etc/systemd/system/sshd.service. +
-root@debian8:~# systemctl status ssh.service +
-● ssh.service - OpenBSD Secure Shell server +
-   Loaded: loaded (/lib/systemd/system/ssh.service; disabled) +
-   Active: active (running) since Sun 2015-11-01 09:47:10 CET; 1min 7s ago +
- Main PID: 2180 (sshd) +
-   CGroup: /system.slice/ssh.service +
-           └─2180 /usr/sbin/sshd -D+
  
-Nov 01 09:47:10 debian8 sshd[2180]: Server listening on 0.0.0.0 port 22+   This is the default welcome page used to test the correct operation of 
-Nov 01 09:47:10 debian8 sshd[2180]: Server listening on :: port 22.+   the Apache2 server after installation on Debian systems. If you can 
 +   read this page, it means that the Apache HTTP server installed at this 
 +   site is working properly. You should replace this file (located at 
 +   /var/www/html/index.html) before continuing to operate your HTTP 
 +   server. 
 + 
 +   If you are a normal user of this web site and don't know what this page 
 +   is about, this probably means that the site is currently unavailable 
 +   due to maintenance. If the problem persists, please contact the site'
 +   administrator. 
 +   Configuration Overview 
 + 
 +   Debian's Apache2 default configuration is different from the upstream 
 +   default configuration, and split into several files optimized for 
 +   interaction with Debian tools. The configuration system is fully 
 +   documented in /usr/share/doc/apache2/README.Debian.gz. Refer to this 
 +   for the full documentation. Documentation for the web server itself can 
 +   be found by accessing the [1]manual if the apache2-doc package was 
 +   installed on this server. 
 + 
 +   The configuration layout for an Apache2 web server installation on 
 +   Debian systems is as follows: 
 +/etc/apache2/ 
 +|-- apache2.conf 
 +|       `--  ports.conf 
 +|-- mods-enabled 
 +|       |-- *.load 
 +|       `-- *.conf 
 +|-- conf-enabled 
 +|       `-- *.conf 
 +|-- sites-enabled 
 +|       `-- *.conf 
 + 
 +     * apache2.conf is the main configuration file. It puts the pieces 
 +       together by including all remaining configuration files when 
 +       starting up the web server. 
 +     * ports.conf is always included from the main configuration file. It 
 +       is used to determine the listening ports for incoming connections, 
 +       and this file can be customized anytime. 
 +     * Configuration files in the mods-enabled/, conf-enabled/ and 
 +       sites-enabled/ directories contain particular configuration 
 +       snippets which manage modules, global configuration fragments, or 
 +       virtual host configurations, respectively. 
 +     * They are activated by symlinking available configuration files from 
 +       their respective *-available/ counterpartsThese should be managed 
 +       by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and 
 +       a2enconf, a2disconf See their respective man pages for detailed 
 +       information. 
 +     * The binary is called apache2. Due to the use of environment 
 +       variables, in the default configuration, apache2 needs to be 
 +       started/stopped with /etc/init.d/apache2 or apache2ctl. Calling 
 +       /usr/bin/apache2 directly will not work with the default 
 +       configuration. 
 + 
 +--More-- 
 +[q] 
 + 
 +root@debian11:~# lynx --dump http://localhost:82 | more 
 +   Debian Logo Apache2 Debian Default Page 
 +   It works! 
 + 
 +   This is the default welcome page used to test the correct operation of 
 +   the Apache2 server after installation on Debian systems. If you can 
 +   read this page, it means that the Apache HTTP server installed at this 
 +   site is working properly. You should replace this file (located at 
 +   /var/www/html/index.html) before continuing to operate your HTTP 
 +   server. 
 + 
 +   If you are a normal user of this web site and don't know what this page 
 +   is about, this probably means that the site is currently unavailable 
 +   due to maintenance. If the problem persists, please contact the site'
 +   administrator. 
 +   Configuration Overview 
 + 
 +   Debian's Apache2 default configuration is different from the upstream 
 +   default configuration, and split into several files optimized for 
 +   interaction with Debian tools. The configuration system is fully 
 +   documented in /usr/share/doc/apache2/README.Debian.gz. Refer to this 
 +   for the full documentation. Documentation for the web server itself can 
 +   be found by accessing the [1]manual if the apache2-doc package was 
 +   installed on this server. 
 + 
 +   The configuration layout for an Apache2 web server installation on 
 +   Debian systems is as follows: 
 +/etc/apache2/ 
 +|-- apache2.conf 
 +|       `--  ports.conf 
 +|-- mods-enabled 
 +|       |-- *.load 
 +|       `-- *.conf 
 +|-- conf-enabled 
 +|       `-- *.conf 
 +|-- sites-enabled 
 +|       `-- *.conf 
 + 
 +     * apache2.conf is the main configuration file. It puts the pieces 
 +       together by including all remaining configuration files when 
 +       starting up the web server. 
 +     * ports.conf is always included from the main configuration file. It 
 +       is used to determine the listening ports for incoming connections, 
 +       and this file can be customized anytime. 
 +     * Configuration files in the mods-enabled/, conf-enabled/ and 
 +       sites-enabled/ directories contain particular configuration 
 +       snippets which manage modules, global configuration fragments, or 
 +       virtual host configurations, respectively. 
 +     * They are activated by symlinking available configuration files from 
 +       their respective *-available/ counterparts. These should be managed 
 +       by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and 
 +       a2enconf, a2disconf . See their respective man pages for detailed 
 +       information. 
 +     * The binary is called apache2. Due to the use of environment 
 +       variables, in the default configuration, apache2 needs to be 
 +       started/stopped with /etc/init.d/apache2 or apache2ctl. Calling 
 +       /usr/bin/apache2 directly will not work with the default 
 +       configuration. 
 + 
 +--More-- 
 +[q]
 </code> </code>
  
-Pour activer un service au prochain démarrage du système, utilisez l'option **enable** :+===6.3 - Interdire la Modification du Statut d'un Service=== 
 + 
 +Il est possible d'interdire la modification en utilisant la commande **systemctl mask**:
  
 <code> <code>
-root@debian8:~# systemctl enable ssh.service +root@debian11:~# systemctl status apache2.service 
-Synchronizing state for ssh.service with sysvinit using update-rc.d... +● apache2.service - The Apache HTTP Server 
-Executing /usr/sbin/update-rc.d ssh defaults +     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
-insservwarningcurrent start runlevel(s) (emptyof script `ssh' overrides LSB defaults (2 3 4 5). +     Active: active (running) since Sat 2022-04-30 12:30:17 CEST; 1h 39min ago 
-insservwarningcurrent stop runlevel(s) (2 5) of script `ssh' overrides LSB defaults (empty)+       Docs: https://httpd.apache.org/docs/2.4/ 
-Executing /usr/sbin/update-rc.d ssh enable +   Main PID: 56452 (apache2) 
-Created symlink from /etc/systemd/system/sshd.service to /lib/systemd/system/ssh.service. +      Tasks: 55 (limit: 4663) 
-root@debian8:~# systemctl status ssh.service +     Memory: 8.7M 
-● ssh.service - OpenBSD Secure Shell server +        CPU: 379ms 
-   Loaded: loaded (/lib/systemd/system/ssh.service; enabled) +     CGroup: /system.slice/apache2.service 
-   Active: active (running) since Sun 2015-11-01 09:47:10 CET1min 43s ago +             ├─56452 /usr/sbin/apache2 -k start 
- Main PID: 2180 (sshd+             ├─56453 /usr/sbin/apache2 -k start 
-   CGroup: /system.slice/ssh.service +             └─56454 /usr/sbin/apache2 -k start 
-           └─2180 /usr/sbin/sshd -D+ 
 +Apr 30 12:30:17 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 12:30:17 debian11 systemd[1]: Started The Apache HTTP Server. 
 + 
 +root@debian11:~# systemctl mask apache2.service 
 +Created symlink /etc/systemd/system/apache2.service → /dev/null. 
 + 
 +root@debian11:~# systemctl list-unit-files --type=service | grep apache2 
 +apache2.service                            masked          enabled 
 +apache2@.service                           disabled        enabled 
 +apache2@instance01.service                 disabled        enabled 
 +apache2@instance02.service                 disabled        enabled 
 + 
 +root@debian11:~# systemctl disable apache2.service 
 +Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install. 
 +Executing: /lib/systemd/systemd-sysv-install disable apache2 
 +Unit /etc/systemd/system/apache2.service is masked, ignoring. 
 + 
 +root@debian11:~# systemctl status apache2.service 
 +● apache2.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
 +     Active: active (running) since Sat 2022-04-30 14:17:14 CEST; 3s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +    Process: 57431 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) 
 +   Main PID: 57435 (apache2) 
 +      Tasks: 55 (limit: 4663) 
 +     Memory: 8.8M 
 +        CPU33ms 
 +     CGroup/system.slice/apache2.service 
 +             ├─57435 /usr/sbin/apache2 -k start 
 +             ├─57436 /usr/sbin/apache2 -k start 
 +             └─57437 /usr/sbin/apache2 -k start 
 + 
 +Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. 
 + 
 +root@debian11:~# systemctl stop apache2.service 
 + 
 +root@debian11:~# systemctl status apache2.service 
 +● apache2.service 
 +     Loaded: masked (Reason: Unit apache2.service is masked.) 
 +     Active: inactive (deadsince Sat 2022-04-30 14:17:45 CEST; 3s ago 
 +   Main PID: 57435 (code=exited, status=0/SUCCESS) 
 +        CPU: 39ms 
 + 
 +Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server..
 +Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. 
 +Apr 30 14:17:45 debian11 systemd[1]: Stopping apache2.service... 
 +Apr 30 14:17:45 debian11 systemd[1]: apache2.service: Succeeded. 
 +Apr 30 14:17:45 debian11 systemd[1]: Stopped apache2.service. 
 + 
 +root@debian11:~# systemctl start apache2.service 
 +Failed to start apache2.service: Unit apache2.service is masked. 
 + 
 +root@debian11:~# systemctl unmask apache2.service 
 +Removed /etc/systemd/system/apache2.service. 
 + 
 +root@debian11:~# systemctl status apache2.service 
 +● apache2.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
 +     Active: inactive (dead) since Sat 2022-04-30 14:17:45 CEST; 1min 13s ago 
 +       Docs: https://httpd.apache.org/docs/2.4
 +   Main PID: 57435 (code=exited, status=0/SUCCESS) 
 +        CPU: 39ms 
 + 
 +Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. 
 +Apr 30 14:17:45 debian11 systemd[1]: Stopping apache2.service... 
 +Apr 30 14:17:45 debian11 systemd[1]: apache2.service: Succeeded. 
 +Apr 30 14:17:45 debian11 systemd[1]: Stopped apache2.service. 
 + 
 +root@debian11:~# systemctl enable apache2.service 
 +Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install
 +Executing/lib/systemd/systemd-sysv-install enable apache2 
 + 
 +root@debian11:~# systemctl status apache2.service 
 +● apache2.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
 +     Active: inactive (dead) since Sat 2022-04-30 14:17:45 CEST; 1min 20s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +   Main PID: 57435 (code=exited, status=0/SUCCESS) 
 +        CPU: 39ms 
 + 
 +Apr 30 14:17:14 debian11 systemd[1]: Starting The Apache HTTP Server... 
 +Apr 30 14:17:14 debian11 systemd[1]: Started The Apache HTTP Server. 
 +Apr 30 14:17:45 debian11 systemd[1]: Stopping apache2.service... 
 +Apr 30 14:17:45 debian11 systemd[1]: apache2.service: Succeeded. 
 +Apr 30 14:17:45 debian11 systemd[1]: Stopped apache2.service. 
 + 
 +root@debian11:~# systemctl start apache2.service 
 + 
 +root@debian11:~# systemctl status apache2.service 
 +● apache2.service - The Apache HTTP Server 
 +     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) 
 +     Active: active (running) since Sat 2022-04-30 14:19:12 CEST3s ago 
 +       Docs: https://httpd.apache.org/docs/2.4/ 
 +    Process: 57685 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) 
 +   Main PID: 57689 (apache2
 +      Tasks: 55 (limit: 4663) 
 +     Memory: 8.7M 
 +        CPU: 30ms 
 +     CGroup: /system.slice/apache2.service 
 +             ├─57689 /usr/sbin/apache2 -k start 
 +             ├─57690 /usr/sbin/apache2 -k start 
 +             └─57691 /usr/sbin/apache2 -k start
  
-Nov 01 09:47:10 debian8 sshd[2180]: Server listening on 0.0.0.0 port 22+Apr 30 14:19:11 debian11 systemd[1]: Starting The Apache HTTP Server... 
-Nov 01 09:47:10 debian8 sshd[2180]: Server listening on :: port 22.+Apr 30 14:19:12 debian11 systemd[1]: Started The Apache HTTP Server.
 </code> </code>
  
Ligne 2202: Ligne 2697:
  
 <code> <code>
-root@debian8:~# shutdown --help+root@debian11:~# shutdown --help
 shutdown [OPTIONS...] [TIME] [WALL...] shutdown [OPTIONS...] [TIME] [WALL...]
  
 Shut down the system. Shut down the system.
  
 +Options:
      --help      Show this help      --help      Show this help
   -H --halt      Halt the machine   -H --halt      Halt the machine
Ligne 2215: Ligne 2711:
      --no-wall   Don't send wall message before halt/power-off/reboot      --no-wall   Don't send wall message before halt/power-off/reboot
   -c             Cancel a pending shutdown   -c             Cancel a pending shutdown
 +
 +See the shutdown(8) man page for details.
 </code> </code>
  
Ligne 2236: Ligne 2734:
 **Important** : Si l'opération est programmée pour dans moins de 5 minutes, les connexions supplémentaires sont interdites, y comprises les tentatives de connexion de root. Notez aussi que l'utilisation de la commande **shutdown** peut être accordée à d'autres utilisateurs de root en utilisant le fichier **/etc/shutdown.allow**. **Important** : Si l'opération est programmée pour dans moins de 5 minutes, les connexions supplémentaires sont interdites, y comprises les tentatives de connexion de root. Notez aussi que l'utilisation de la commande **shutdown** peut être accordée à d'autres utilisateurs de root en utilisant le fichier **/etc/shutdown.allow**.
 </WRAP> </WRAP>
- 
-Dans votre VM, ouvrez deux terminaux. Dans le premier passez en tant que root. Planifiez ensuite un redémarrage de la VM dans 30 minutes : 
- 
-<code> 
-root@debian8:~# shutdown -r +30 
-Shutdown scheduled for Sun 2015-11-01 10:21:04 CET, use 'shutdown -c' to cancel. 
-</code> 
- 
-Dans le deuxième terminal est passez en tant que route. Annulez ensuite le shutdown : 
- 
-<code> 
-trainee@debian8:~$ su - 
-Password:  
-root@debian8:~# shutdown -c 
- 
-Broadcast message from root@debian8 (Sun 2015-11-01 09:53:34 CET): 
- 
-The system shutdown has been cancelled at Sun 2015-11-01 09:54:34 CET! 
- 
-root@debian8:~#  
-</code> 
- 
-Retournez au premier terminal et constatez le message affiché : 
- 
-<code> 
-root@debian8:~#  
-Broadcast message from root@debian8 (Sun 2015-11-01 09:53:34 CET): 
- 
-The system shutdown has been cancelled at Sun 2015-11-01 09:54:34 CET! 
- 
- 
-</code> 
  
 ==== La commande reboot==== ==== La commande reboot====
Ligne 2278: Ligne 2744:
  
 <code> <code>
-root@debian8:~# reboot --help+root@debian11:~# reboot --help
 reboot [OPTIONS...] [ARG] reboot [OPTIONS...] [ARG]
  
 Reboot the system. Reboot the system.
  
 +Options:
      --help      Show this help      --help      Show this help
      --halt      Halt the machine      --halt      Halt the machine
Ligne 2291: Ligne 2758:
   -d --no-wtmp   Don't write wtmp record   -d --no-wtmp   Don't write wtmp record
      --no-wall   Don't send wall message before halt/power-off/reboot      --no-wall   Don't send wall message before halt/power-off/reboot
 +
 +See the halt(8) man page for details.
 </code> </code>
  
Ligne 2302: Ligne 2771:
  
 <code> <code>
-root@debian8:~# halt --help+root@debian11:~# halt --help
 halt [OPTIONS...] halt [OPTIONS...]
  
 Halt the system. Halt the system.
  
 +Options:
      --help      Show this help      --help      Show this help
      --halt      Halt the machine      --halt      Halt the machine
Ligne 2315: Ligne 2785:
   -d --no-wtmp   Don't write wtmp record   -d --no-wtmp   Don't write wtmp record
      --no-wall   Don't send wall message before halt/power-off/reboot      --no-wall   Don't send wall message before halt/power-off/reboot
 +
 +See the halt(8) man page for details.
 </code> </code>
  
Ligne 2326: Ligne 2798:
  
 <code> <code>
-root@debian8:~# poweroff --help+root@debian11:~# poweroff --help
 poweroff [OPTIONS...] poweroff [OPTIONS...]
  
 Power off the system. Power off the system.
  
 +Options:
      --help      Show this help      --help      Show this help
      --halt      Halt the machine      --halt      Halt the machine
Ligne 2339: Ligne 2812:
   -d --no-wtmp   Don't write wtmp record   -d --no-wtmp   Don't write wtmp record
      --no-wall   Don't send wall message before halt/power-off/reboot      --no-wall   Don't send wall message before halt/power-off/reboot
 +
 +See the halt(8) man page for details.
 </code> </code>
  
------ +<WRAP center round important
-<html> +**Important** : Avant de poursuivre, supprimez le fichier **/etc/grub.d/09_usbdebian**. 
-<div align="center"+</WRAP>
-Copyright © 2020 Hugh Norris +
-</div> +
-</html> +
------ +
  
 +-----
 +Copyright © 2024 Hugh Norris.
Menu