Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
elearning:workbooks:debian:10:junior:l118 [2023/08/24 11:23] – removed admin | elearning:workbooks:debian:10:junior:l118 [2023/11/20 12:52] (Version actuelle) – created admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ~~PDF: | ||
+ | Version : **2022.01** | ||
+ | |||
+ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
+ | |||
+ | ======LDF512 - Gestion du Noyau et des Quotas====== | ||
+ | |||
+ | =====Contenu du Module===== | ||
+ | |||
+ | * **LDF512 - Gestion du Noyau et des Quotas** | ||
+ | * Contenu du Module | ||
+ | * Rôle du noyau | ||
+ | * LAB #1 - Compilation et installation du noyau | ||
+ | * 1.1 - Déplacer /home | ||
+ | * 1.2 - Télécharger le Code Source du Noyau | ||
+ | * 1.3 - Configurer le Noyau | ||
+ | * 1.4 - Compiler le Noyau | ||
+ | * 1.5 - Installer le Nouveau Noyau | ||
+ | * 1.6 - Désinstaller un Noyau | ||
+ | * LAB #2 - Mise à Jour du Noyau avec le Gestionnaire des Paquets | ||
+ | * LAB #3 - Gestion des Quotas | ||
+ | * 3.1 - La Commande quotacheck | ||
+ | * 3.2 - La Commande edquota | ||
+ | * 3.3 - La Commande quotaon | ||
+ | * 3.4 - La Commande repquota | ||
+ | * 3.5 - La Commande quota | ||
+ | * 3.6 - La Commande warnquota | ||
+ | |||
+ | =====Rôle du noyau===== | ||
+ | |||
+ | Le noyau ou //kernel// est la partie du système d' | ||
+ | |||
+ | * la diminution de la taille du noyau, | ||
+ | * la prise en charge de nouveau matériel, | ||
+ | * l' | ||
+ | * l' | ||
+ | * la correction de bogues, | ||
+ | * le besoin d'une fonctionnalité expérimentale. | ||
+ | |||
+ | Commencez par identifier le noyau utilisé par votre machine : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | 5.10.0-13-amd64 | ||
+ | </ | ||
+ | |||
+ | Dans le cas d'une utilisation courante de Linux, il est cependant préférable de faire appel aux **modules**. Les modules se trouvent dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | kernel | ||
+ | modules.alias | ||
+ | </ | ||
+ | |||
+ | Les commandes pour manipuler les modules sont : | ||
+ | |||
+ | * insmod | ||
+ | * rmmod | ||
+ | * lsmod | ||
+ | * modprobe | ||
+ | |||
+ | Par exemple : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Module | ||
+ | rfkill | ||
+ | raid456 | ||
+ | async_raid6_recov | ||
+ | async_memcpy | ||
+ | async_pq | ||
+ | async_xor | ||
+ | async_tx | ||
+ | md_mod | ||
+ | sg | ||
+ | virtio_balloon | ||
+ | joydev | ||
+ | qemu_fw_cfg | ||
+ | pcspkr | ||
+ | serio_raw | ||
+ | evdev 28672 2 | ||
+ | ecryptfs | ||
+ | parport_pc | ||
+ | ppdev 24576 0 | ||
+ | lp | ||
+ | parport | ||
+ | fuse 167936 | ||
+ | configfs | ||
+ | ip_tables | ||
+ | x_tables | ||
+ | autofs4 | ||
+ | ext4 921600 | ||
+ | crc16 16384 1 ext4 | ||
+ | mbcache | ||
+ | jbd2 151552 | ||
+ | hid_generic | ||
+ | btrfs 1568768 | ||
+ | usbhid | ||
+ | hid | ||
+ | blake2b_generic | ||
+ | xor 24576 2 async_xor, | ||
+ | raid6_pq | ||
+ | libcrc32c | ||
+ | crc32c_generic | ||
+ | usb_storage | ||
+ | dm_mod | ||
+ | sd_mod | ||
+ | t10_pi | ||
+ | crc_t10dif | ||
+ | crct10dif_generic | ||
+ | crct10dif_common | ||
+ | sr_mod | ||
+ | cdrom 73728 1 sr_mod | ||
+ | virtio_net | ||
+ | net_failover | ||
+ | failover | ||
+ | virtio_scsi | ||
+ | bochs_drm | ||
+ | ata_generic | ||
+ | drm_vram_helper | ||
+ | uhci_hcd | ||
+ | drm_ttm_helper | ||
+ | ttm | ||
+ | ehci_hcd | ||
+ | drm_kms_helper | ||
+ | cec 61440 1 drm_kms_helper | ||
+ | psmouse | ||
+ | drm | ||
+ | usbcore | ||
+ | ata_piix | ||
+ | virtio_pci | ||
+ | libata | ||
+ | virtio_ring | ||
+ | virtio | ||
+ | i2c_piix4 | ||
+ | scsi_mod | ||
+ | usb_common | ||
+ | floppy | ||
+ | button | ||
+ | </ | ||
+ | |||
+ | Pour ajouter un module, on peut utiliser la commande **insmod** ou **modprobe**. Cette dernière ajoute non seulement le module passé en argument mais également ses dépendances : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | Module | ||
+ | bonding | ||
+ | rfkill | ||
+ | raid456 | ||
+ | async_raid6_recov | ||
+ | async_memcpy | ||
+ | async_pq | ||
+ | async_xor | ||
+ | async_tx | ||
+ | md_mod | ||
+ | </ | ||
+ | |||
+ | Pour supprimer un module, on peut utiliser la commande **rmmod** ou **modprobe -r**. Cette dernière essaie de supprimer les dépendances non-utilisées : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | Module | ||
+ | rfkill | ||
+ | raid456 | ||
+ | async_raid6_recov | ||
+ | async_memcpy | ||
+ | async_pq | ||
+ | async_xor | ||
+ | async_tx | ||
+ | md_mod | ||
+ | sg | ||
+ | </ | ||
+ | |||
+ | Les dépendances des modules sont résolues par la commande **modprobe** grâce aux fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | mmon.ko kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | crypto/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | --More--(0%) | ||
+ | [q] | ||
+ | </ | ||
+ | |||
+ | Il est possible d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | filename: | ||
+ | author: | ||
+ | description: | ||
+ | license: | ||
+ | alias: | ||
+ | depends: | ||
+ | retpoline: | ||
+ | intree: | ||
+ | name: | ||
+ | vermagic: | ||
+ | sig_id: | ||
+ | signer: | ||
+ | sig_key: | ||
+ | sig_hashalgo: | ||
+ | signature: | ||
+ | EC: | ||
+ | 77: | ||
+ | CD: | ||
+ | 29: | ||
+ | F1: | ||
+ | 84: | ||
+ | 73: | ||
+ | 9D: | ||
+ | 4A: | ||
+ | D7: | ||
+ | 85: | ||
+ | 0D: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mdadm.conf | ||
+ | |||
+ | root@debian11: | ||
+ | # mdadm module configuration file | ||
+ | # set start_ro=1 to make newly assembled arrays read-only initially, | ||
+ | # to prevent metadata writes. | ||
+ | # resume-from-disk to work - new boot should not perform writes | ||
+ | # because it will be done behind the back of the system being | ||
+ | # resumed. | ||
+ | |||
+ | options md_mod start_ro=1 | ||
+ | </ | ||
+ | |||
+ | =====LAB #1 - Compilation et installation du noyau===== | ||
+ | |||
+ | Commencez par installer les paquets necessaires : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Hit:1 http:// | ||
+ | Get:2 http:// | ||
+ | Get:3 http:// | ||
+ | Fetched 83.5 kB in 1s (158 kB/s) | ||
+ | Reading package lists... Done | ||
+ | |||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | ====1.1 - Déplacer /home==== | ||
+ | |||
+ | Créez une seule partition sur **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | Welcome to fdisk (util-linux 2.36.1). | ||
+ | Changes will remain in memory only, until you decide to write them. | ||
+ | Be careful before using the write command. | ||
+ | |||
+ | Device does not contain a recognized partition table. | ||
+ | Created a new DOS disklabel with disk identifier 0xa10c368d. | ||
+ | |||
+ | Command (m for help): n | ||
+ | Partition type | ||
+ | | ||
+ | | ||
+ | Select (default p): | ||
+ | |||
+ | Using default response p. | ||
+ | Partition number (1-4, default 1): | ||
+ | First sector (2048-134217727, | ||
+ | Last sector, +/-sectors or +/ | ||
+ | |||
+ | Created a new partition 1 of type ' | ||
+ | |||
+ | Command (m for help): w | ||
+ | The partition table has been altered. | ||
+ | Calling ioctl() to re-read partition table. | ||
+ | Syncing disks. | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un système de fichiers ext4 sur **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | mke2fs 1.46.2 (28-Feb-2021) | ||
+ | Discarding device blocks: done | ||
+ | Creating filesystem with 16776960 4k blocks and 4194304 inodes | ||
+ | Filesystem UUID: 24f1821e-1d5b-4256-8ee3-c9ee6b382ddc | ||
+ | Superblock backups stored on blocks: | ||
+ | 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, | ||
+ | 4096000, 7962624, 11239424 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (65536 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Editez le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | # | ||
+ | |||
+ | # This is the sshd server system-wide configuration file. See | ||
+ | # sshd_config(5) for more information. | ||
+ | |||
+ | # This sshd was compiled with PATH=/ | ||
+ | |||
+ | # The strategy used for options in the default sshd_config shipped with | ||
+ | # OpenSSH is to specify options with their default value where | ||
+ | # possible, but leave them commented. | ||
+ | # default value. | ||
+ | |||
+ | Include / | ||
+ | |||
+ | #Port 22 | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | #HostKey / | ||
+ | #HostKey / | ||
+ | #HostKey / | ||
+ | |||
+ | # Ciphers and keying | ||
+ | #RekeyLimit default none | ||
+ | |||
+ | # Logging | ||
+ | # | ||
+ | #LogLevel INFO | ||
+ | |||
+ | # Authentication: | ||
+ | |||
+ | # | ||
+ | PermitRootLogin yes | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Re-démarrez le serveur ssh : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | ● ssh.service - OpenBSD Secure Shell server | ||
+ | | ||
+ | | ||
+ | Docs: man:sshd(8) | ||
+ | | ||
+ | Process: 2793 ExecStartPre=/ | ||
+ | Main PID: 2794 (sshd) | ||
+ | Tasks: 1 (limit: 4656) | ||
+ | | ||
+ | CPU: 25ms | ||
+ | | ||
+ | | ||
+ | |||
+ | May 01 15:35:50 debian11 systemd[1]: Starting OpenBSD Secure Shell server... | ||
+ | May 01 15:35:50 debian11 sshd[2794]: Server listening on 0.0.0.0 port 22. | ||
+ | May 01 15:35:50 debian11 sshd[2794]: Server listening on :: port 22. | ||
+ | May 01 15:35:50 debian11 systemd[1]: Started OpenBSD Secure Shell server. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round todo> | ||
+ | **A Faire** - Déconnectez-vous en ssh. Connectez-vous directement en tant que root en ssh. | ||
+ | </ | ||
+ | |||
+ | Montez **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Copiez le contenu de /home vers /mnt : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Démontez /dev/sdb1 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Identifiez l'UUID de /dev/sdb1 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | lrwxrwxrwx 1 root root 10 May 1 15:31 24f1821e-1d5b-4256-8ee3-c9ee6b382ddc -> ../../sdb1 | ||
+ | </ | ||
+ | |||
+ | Editez le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | # /etc/fstab: static file system information. | ||
+ | # | ||
+ | # Use ' | ||
+ | # device; this may be used with UUID= as a more robust way to name devices | ||
+ | # that works even if disks are added and removed. See fstab(5). | ||
+ | # | ||
+ | # systemd generates mount units based on this file, see systemd.mount(5). | ||
+ | # Please run ' | ||
+ | # | ||
+ | # <file system> <mount point> | ||
+ | # / was on /dev/sda1 during installation | ||
+ | UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e / | ||
+ | UUID=24f1821e-1d5b-4256-8ee3-c9ee6b382ddc /home | ||
+ | # swap was on /dev/sda5 during installation | ||
+ | UUID=1f9439f5-4b19-49b1-b292-60c2c674cee9 none swap sw 0 0 | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Créez le point de montage /home : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Montez /dev/sdb1 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | proc on /proc type proc (rw, | ||
+ | udev on /dev type devtmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | tmpfs on /run type tmpfs (rw, | ||
+ | /dev/sda1 on / type ext4 (rw, | ||
+ | securityfs on / | ||
+ | tmpfs on /dev/shm type tmpfs (rw, | ||
+ | tmpfs on /run/lock type tmpfs (rw, | ||
+ | cgroup2 on / | ||
+ | pstore on / | ||
+ | none on /sys/fs/bpf type bpf (rw, | ||
+ | systemd-1 on / | ||
+ | mqueue on /dev/mqueue type mqueue (rw, | ||
+ | debugfs on / | ||
+ | hugetlbfs on / | ||
+ | tracefs on / | ||
+ | configfs on / | ||
+ | fusectl on / | ||
+ | tmpfs on /run/user/0 type tmpfs (rw, | ||
+ | /dev/sdb1 on /home type ext4 (rw, | ||
+ | </ | ||
+ | |||
+ | Notez la taille de /home : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Filesystem | ||
+ | udev 1.9G | ||
+ | tmpfs | ||
+ | / | ||
+ | tmpfs | ||
+ | tmpfs | ||
+ | tmpfs | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP center round todo> | ||
+ | **A Faire** - Fermez la session de root et connectez-vous en tant que trainee en ssh. | ||
+ | </ | ||
+ | |||
+ | ====1.2 - Télécharger le Code Source du Noyau==== | ||
+ | |||
+ | Le code source est disponible sur le site **www.kernel.org** : | ||
+ | |||
+ | < | ||
+ | trainee@debian11: | ||
+ | </ | ||
+ | |||
+ | Désarchivez le tar.xz que vous avez téléchargé : | ||
+ | |||
+ | < | ||
+ | trainee@debian8: | ||
+ | </ | ||
+ | |||
+ | Notez que l' | ||
+ | |||
+ | < | ||
+ | trainee@debian11: | ||
+ | 1.2G ./ | ||
+ | </ | ||
+ | |||
+ | ====1.3 - Configurer le Noyau==== | ||
+ | |||
+ | Le fichier **Makefile** contient le nom du noyau et spécifie les informations suivantes : | ||
+ | |||
+ | * VERSION, | ||
+ | * PATCHLEVEL, | ||
+ | * SUBLEVEL, | ||
+ | * EXTRAVERSION. | ||
+ | |||
+ | Les trois premières informations sont gérées par **kernel.org** et Linus Torvalds en personne tandis que l' | ||
+ | |||
+ | < | ||
+ | trainee@debian11: | ||
+ | # SPDX-License-Identifier: | ||
+ | VERSION = 5 | ||
+ | PATCHLEVEL = 11 | ||
+ | SUBLEVEL = 1 | ||
+ | EXTRAVERSION = | ||
+ | NAME = 💕 Valentine' | ||
+ | |||
+ | # *DOCUMENTATION* | ||
+ | # To see a list of typical targets execute "make help" | ||
+ | # More info can be located in ./README | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - La version 2.6 du noyau a vu le jour en **2003**. Les **SUBLEVEL** se suivaient régulièrement. Avec la version 2.6 du noyau, la valeur paire du **PATCHLEVEL** indiquait que le noyau était stable. Quand vous recompilez le noyau à partir des sources, vous devez modifier la valeur de l' | ||
+ | </ | ||
+ | |||
+ | Utilisez maintenant la commande **make defconfig** pour créer le fichier de configuration .config : | ||
+ | |||
+ | < | ||
+ | trainee@debian11: | ||
+ | Password: fenestros | ||
+ | root@debian11: | ||
+ | root@debian11:/ | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | LEX | ||
+ | YACC scripts/ | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTCC | ||
+ | HOSTLD | ||
+ | *** Default configuration is based on ' | ||
+ | # | ||
+ | # configuration written to .config | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | Ce fichier est configuré par une des trois commandes suivantes : | ||
+ | |||
+ | * make config | ||
+ | * make menuconfig | ||
+ | * make xconfig | ||
+ | |||
+ | Dans ce fichier, vous pouvez constater la présence de lignes correspondantes à des fonctionalités suivies par une lettre ou une valeur. Dans le cas d'une lettre, la signification est la suivante : | ||
+ | |||
+ | * **y** | ||
+ | * la fonctionnalité est incluse dans le noyau monolithique ou dans le cas d'une dépendance d'un module, dans le module concerné, | ||
+ | * **m** | ||
+ | * la fonctionnalité est incluse en tant que module, | ||
+ | * **n** | ||
+ | * la fonctionnalité n'est pas incluse. Cette option est rarement visible car dans bien les cas, la fonctionnalité est simplement commentée dans le fichier lui-même. | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | # | ||
+ | # Automatically generated file; DO NOT EDIT. | ||
+ | # Linux/x86 5.11.1 Kernel Configuration | ||
+ | # | ||
+ | CONFIG_CC_VERSION_TEXT=" | ||
+ | CONFIG_CC_IS_GCC=y | ||
+ | CONFIG_GCC_VERSION=100201 | ||
+ | CONFIG_LD_VERSION=235020000 | ||
+ | CONFIG_CLANG_VERSION=0 | ||
+ | CONFIG_LLD_VERSION=0 | ||
+ | CONFIG_CC_CAN_LINK=y | ||
+ | CONFIG_CC_CAN_LINK_STATIC=y | ||
+ | CONFIG_CC_HAS_ASM_GOTO=y | ||
+ | CONFIG_CC_HAS_ASM_INLINE=y | ||
+ | CONFIG_IRQ_WORK=y | ||
+ | CONFIG_BUILDTIME_TABLE_SORT=y | ||
+ | CONFIG_THREAD_INFO_IN_TASK=y | ||
+ | |||
+ | # | ||
+ | # General setup | ||
+ | # | ||
+ | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
+ | # CONFIG_COMPILE_TEST is not set | ||
+ | CONFIG_LOCALVERSION="" | ||
+ | # CONFIG_LOCALVERSION_AUTO is not set | ||
+ | CONFIG_BUILD_SALT="" | ||
+ | CONFIG_HAVE_KERNEL_GZIP=y | ||
+ | CONFIG_HAVE_KERNEL_BZIP2=y | ||
+ | CONFIG_HAVE_KERNEL_LZMA=y | ||
+ | CONFIG_HAVE_KERNEL_XZ=y | ||
+ | CONFIG_HAVE_KERNEL_LZO=y | ||
+ | CONFIG_HAVE_KERNEL_LZ4=y | ||
+ | CONFIG_HAVE_KERNEL_ZSTD=y | ||
+ | CONFIG_KERNEL_GZIP=y | ||
+ | # CONFIG_KERNEL_BZIP2 is not set | ||
+ | # CONFIG_KERNEL_LZMA is not set | ||
+ | # CONFIG_KERNEL_XZ is not set | ||
+ | # CONFIG_KERNEL_LZO is not set | ||
+ | # CONFIG_KERNEL_LZ4 is not set | ||
+ | # CONFIG_KERNEL_ZSTD is not set | ||
+ | CONFIG_DEFAULT_INIT="" | ||
+ | CONFIG_DEFAULT_HOSTNAME=" | ||
+ | CONFIG_SWAP=y | ||
+ | CONFIG_SYSVIPC=y | ||
+ | CONFIG_SYSVIPC_SYSCTL=y | ||
+ | CONFIG_POSIX_MQUEUE=y | ||
+ | CONFIG_POSIX_MQUEUE_SYSCTL=y | ||
+ | # CONFIG_WATCH_QUEUE is not set | ||
+ | CONFIG_CROSS_MEMORY_ATTACH=y | ||
+ | CONFIG_USELIB=y | ||
+ | CONFIG_AUDIT=y | ||
+ | CONFIG_HAVE_ARCH_AUDITSYSCALL=y | ||
+ | CONFIG_AUDITSYSCALL=y | ||
+ | |||
+ | # | ||
+ | # IRQ subsystem | ||
+ | # | ||
+ | CONFIG_GENERIC_IRQ_PROBE=y | ||
+ | --More--(1%) | ||
+ | [q] | ||
+ | </ | ||
+ | |||
+ | ====1.4 - Compiler le Noyau==== | ||
+ | |||
+ | La compilation du noyau peut prendre beaucoup de temps. La commande utilisée est la suivante : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | ... | ||
+ | dpkg-buildpackage: | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN certs | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN lib | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN usr | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | CLEAN | ||
+ | </ | ||
+ | |||
+ | A l'issu du processus, les paquets du nouveau noyau se trouvent dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | root@debian11:/ | ||
+ | Desktop | ||
+ | Documents | ||
+ | Downloads | ||
+ | </ | ||
+ | |||
+ | ====1.5 - Installer le Noyau==== | ||
+ | |||
+ | Installez maintenant les paquets **deb** : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | </ | ||
+ | |||
+ | Constatez la création d'un nouveau grub.cfg : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | echo ' | ||
+ | linux / | ||
+ | initrd | ||
+ | menuentry ' | ||
+ | echo ' | ||
+ | linux / | ||
+ | initrd | ||
+ | menuentry ' | ||
+ | echo ' | ||
+ | linux / | ||
+ | initrd | ||
+ | </ | ||
+ | |||
+ | ====1.6 - Désinstaller un Noyau==== | ||
+ | |||
+ | Lister les noyaux installés : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | linux-image-5.10.0-13-amd64 | ||
+ | linux-image-5.11.1 | ||
+ | linux-image-amd64 | ||
+ | </ | ||
+ | |||
+ | Le noyau se désinstalle comme tout autre paquet : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree... Done | ||
+ | Reading state information... Done | ||
+ | The following packages will be REMOVED: | ||
+ | linux-image-5.11.1* | ||
+ | 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. | ||
+ | After this operation, 15.1 MB disk space will be freed. | ||
+ | (Reading database ... 118012 files and directories currently installed.) | ||
+ | Removing linux-image-5.11.1 (5.11.1-1) ... | ||
+ | update-initramfs: | ||
+ | Generating grub configuration file ... | ||
+ | Found background image: / | ||
+ | Found linux image: / | ||
+ | Found initrd image: / | ||
+ | done | ||
+ | (Reading database ... 117967 files and directories currently installed.) | ||
+ | Purging configuration files for linux-image-5.11.1 (5.11.1-1) ... | ||
+ | </ | ||
+ | |||
+ | Vérifiez que le fichier grub.cfg a été modifié : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | root@debian11:/ | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | linux-image-5.10.0-13-amd64 | ||
+ | linux-image-amd64 | ||
+ | </ | ||
+ | |||
+ | =====LAB #2 - Mise à Jour du Noyau avec le Gestionnaire des Paquets===== | ||
+ | |||
+ | Afin d' | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | deb http:// | ||
+ | root@debian11:/ | ||
+ | deb-src http:// | ||
+ | </ | ||
+ | |||
+ | Afin de ne faire que des mises à jour du **noyau** à partir de ce dépôt, créez le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | root@debian11:/ | ||
+ | Package: * | ||
+ | Pin: release a=bullseye | ||
+ | Pin-Priority: | ||
+ | |||
+ | Package: linux-image-amd64 | ||
+ | Pin: release a=unstable | ||
+ | Pin-Priority: | ||
+ | |||
+ | Package: * | ||
+ | Pin: release a=unstable | ||
+ | Pin-Priority: | ||
+ | </ | ||
+ | |||
+ | Mettez à jour apt : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | Hit:1 http:// | ||
+ | Hit:2 http:// | ||
+ | Get:3 http:// | ||
+ | Get:4 http:// | ||
+ | Get:5 http:// | ||
+ | Get:6 http:// | ||
+ | Get:7 http:// | ||
+ | Get:8 http:// | ||
+ | Get:9 http:// | ||
+ | Get:10 http:// | ||
+ | Get:11 http:// | ||
+ | Get:12 http:// | ||
+ | Get:13 http:// | ||
+ | Fetched 26.3 MB in 5s (4,955 kB/s) | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree... Done | ||
+ | Reading state information... Done | ||
+ | 2 packages can be upgraded. Run 'apt list --upgradable' | ||
+ | </ | ||
+ | |||
+ | Installez ensuite les mises-à-jour du noyau : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | </ | ||
+ | |||
+ | Re-démarrez votre VM : | ||
+ | |||
+ | < | ||
+ | root@debian11:/ | ||
+ | </ | ||
+ | |||
+ | Connectez-vous de nouveau à la VM et contrôlez la version du noyau : | ||
+ | |||
+ | < | ||
+ | trainee@debian11: | ||
+ | Linux debian11 5.17.0-1-amd64 #1 SMP PREEMPT Debian 5.17.3-1 (2022-04-18) x86_64 GNU/Linux | ||
+ | </ | ||
+ | |||
+ | Déconnectez-vous et re-connectez-vous directement en tant que root. | ||
+ | |||
+ | =====LAB #3 - Gestion des Quotas===== | ||
+ | |||
+ | Sous Linux il est possible de mettre en place des quotas par utilisateur et par groupe. Ceci étant, Linux ne sait pas gérer des quotas par répertoire, | ||
+ | quotas par partition. L' | ||
+ | |||
+ | Commencez par vérifiez que le paquet **quota** est bien installé : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Editez le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | # /etc/fstab: static file system information. | ||
+ | # | ||
+ | # Use ' | ||
+ | # device; this may be used with UUID= as a more robust way to name devices | ||
+ | # that works even if disks are added and removed. See fstab(5). | ||
+ | # | ||
+ | # systemd generates mount units based on this file, see systemd.mount(5). | ||
+ | # Please run ' | ||
+ | # | ||
+ | # <file system> <mount point> | ||
+ | # / was on /dev/sda1 during installation | ||
+ | UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e / | ||
+ | UUID=24f1821e-1d5b-4256-8ee3-c9ee6b382ddc /home | ||
+ | # swap was on /dev/sda5 during installation | ||
+ | UUID=1f9439f5-4b19-49b1-b292-60c2c674cee9 none swap sw 0 0 | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Démontez puis remontez /home : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Vérifiez ensuite que les options soient prises en compte : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | sysfs /sys sysfs rw, | ||
+ | proc /proc proc rw, | ||
+ | udev /dev devtmpfs rw, | ||
+ | devpts /dev/pts devpts rw, | ||
+ | tmpfs /run tmpfs rw, | ||
+ | /dev/sda1 / ext4 rw, | ||
+ | securityfs / | ||
+ | tmpfs /dev/shm tmpfs rw, | ||
+ | tmpfs /run/lock tmpfs rw, | ||
+ | cgroup2 / | ||
+ | pstore / | ||
+ | bpf /sys/fs/bpf bpf rw, | ||
+ | systemd-1 / | ||
+ | mqueue /dev/mqueue mqueue rw, | ||
+ | hugetlbfs / | ||
+ | tracefs / | ||
+ | debugfs / | ||
+ | configfs / | ||
+ | fusectl / | ||
+ | tmpfs /run/user/0 tmpfs rw, | ||
+ | /dev/sdb1 /home ext4 rw, | ||
+ | </ | ||
+ | |||
+ | ====3.1 - La Commande quotacheck==== | ||
+ | |||
+ | Pour activer les quotas sur /home, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | quotacheck: Your kernel probably supports ext4 quota feature but you are using external quota files. Please switch your filesystem to use ext4 quota feature as external quota files on ext4 are deprecated. | ||
+ | quotacheck: Scanning /dev/sdb1 [/home] done | ||
+ | quotacheck: Cannot stat old user quota file / | ||
+ | quotacheck: Cannot stat old group quota file / | ||
+ | quotacheck: Cannot stat old user quota file / | ||
+ | quotacheck: Cannot stat old group quota file / | ||
+ | quotacheck: Checked 7199 directories and 81583 files | ||
+ | quotacheck: Old file not found. | ||
+ | quotacheck: Old file not found. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande quotacheck sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Utility for checking and repairing quota files. | ||
+ | quotacheck [-gucbfinvdmMR] [-F < | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -c, --create-files | ||
+ | -b, --backup | ||
+ | -f, --force | ||
+ | -i, --interactive | ||
+ | -n, --use-first-dquot | ||
+ | -v, --verbose | ||
+ | -d, --debug | ||
+ | -m, --no-remount | ||
+ | -M, --try-remount | ||
+ | continue even if it fails | ||
+ | -R, --exclude-root | ||
+ | -F, --format=formatname | ||
+ | -a, --all check all filesystems | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Bugs to jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | Les quotas ont été activés et les fichier **aquota.user** et **aquota.group** ont été créés dans le répertoire /home : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | total 44 | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x 20 root root 4096 May 1 17:41 .. | ||
+ | -rw------- | ||
+ | -rw------- | ||
+ | drwx------ | ||
+ | drwxr-xr-x 15 trainee trainee | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un utilisateur **fenestros** avec le mot de passe **fenestros** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | New password: fenestros | ||
+ | Retype new password: fenestros | ||
+ | passwd: password updated successfully | ||
+ | </ | ||
+ | |||
+ | ====3.2 - La Commande edquota==== | ||
+ | |||
+ | Mettez en place maintenant un quota de 10Mo pour l' | ||
+ | |||
+ | < | ||
+ | root@debian8: | ||
+ | root@debian8: | ||
+ | root@debian8: | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | Disk quotas for user fenestros (uid 1001): | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Modifiez ce fichier ainsi : | ||
+ | |||
+ | < | ||
+ | Disk quotas for user fenestros (uid 1001): | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **edquota** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | edquota: Usage: | ||
+ | edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... | ||
+ | edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ... | ||
+ | edquota [-rm] -P [-F formatname] [-p projectname] [-f filesystem] projectname ... | ||
+ | edquota [-u|g|-P] [-F formatname] [-f filesystem] -t | ||
+ | edquota [-u|g|-P] [-F formatname] [-f filesystem] -T username|groupname|projectname ... | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -P, --project | ||
+ | -r, --remote | ||
+ | -m, --no-mixed-pathnames | ||
+ | -F, --format=formatname | ||
+ | -p, --prototype=name | ||
+ | --always-resolve | ||
+ | composed only of digits | ||
+ | -f, --filesystem=filesystem | ||
+ | -t, --edit-period | ||
+ | -T, --edit-times | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Bugs to: jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - Pour mettre en place un quota par group, la procédure est similaire. Il suffit d' | ||
+ | </ | ||
+ | |||
+ | ====3.3 - La Commande quotaon==== | ||
+ | |||
+ | Appliquez maintenant les quotas : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **quotaon** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | quotaon: Usage: | ||
+ | quotaon [-guPvp] [-F quotaformat] [-x state] -a | ||
+ | quotaon [-guPvp] [-F quotaformat] [-x state] filesys ... | ||
+ | |||
+ | -a, --all turn quotas on for all filesystems | ||
+ | -f, --off turn quotas off | ||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -P, --project | ||
+ | -p, --print-state | ||
+ | -x, --xfs-command=cmd | ||
+ | -F, --format=formatname | ||
+ | -v, --verbose | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | </ | ||
+ | |||
+ | De cette manière vous avez mis en place un quota **souple** pour fenestros de 8 000 Ko et un quota **stricte** de 10 000 Ko. | ||
+ | |||
+ | Quand l' | ||
+ | |||
+ | Il est à noter que vous pouvez soit mettre en place un quota en taille, soit mettre en place un quota basé sur le nombre d' | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - La commande pour désactivez les quotas est **quotaoff**. | ||
+ | </ | ||
+ | |||
+ | ====3.4 - La Commande repquota==== | ||
+ | |||
+ | Pour visualiser les quotas utilisez la commande **repquota** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | *** Report for user quotas on device /dev/sdb1 | ||
+ | Block grace time: 7days; Inode grace time: 7days | ||
+ | Block limits | ||
+ | User used soft hard grace used soft hard grace | ||
+ | ---------------------------------------------------------------------- | ||
+ | root -- 241004 | ||
+ | trainee | ||
+ | |||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | **Important** - Notez que l' | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **repquota** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | repquota: Utility for reporting quotas. | ||
+ | Usage: | ||
+ | repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] [-O (default | xml | csv)] (-a | mntpoint) | ||
+ | |||
+ | -v, --verbose | ||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -P, --project | ||
+ | -s, --human-readable[=units] | ||
+ | ...). Units can be also specified explicitely by | ||
+ | an optional argument in format [kgt],[kgt] where | ||
+ | the first character specifies space units and the | ||
+ | second character specifies inode units | ||
+ | -t, --truncate-names | ||
+ | -p, --raw-grace | ||
+ | -n, --no-names | ||
+ | -i, --no-autofs | ||
+ | -c, --cache | ||
+ | -C, --no-cache | ||
+ | -F, --format=formatname | ||
+ | -O, --output=format | ||
+ | -a, --all | ||
+ | quotas | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Bugs to jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | ====3.5 - La Commande quota==== | ||
+ | |||
+ | Pour visualiser les quotas d'un utilisateur spécifique, | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Disk quotas for user fenestros (uid 1001): no limited resources used | ||
+ | |||
+ | root@debian11: | ||
+ | |||
+ | fenestros@debian11: | ||
+ | |||
+ | fenestros@debian11: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | Disk quotas for user fenestros (uid 1001): | ||
+ | | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **quota** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | quota: Usage: quota [-guPqvswim] [-l | [-Q | -A]] [-F quotaformat] | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -P projectname ... | ||
+ | quota [-qvswugPQm] [-F quotaformat] -f filesystem ... | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -P, --project | ||
+ | -q, --quiet | ||
+ | -v, --verbose | ||
+ | -s, --human-readable[=units] | ||
+ | ...). Units can be also specified explicitely by | ||
+ | an optional argument in format [kgt],[kgt] where | ||
+ | the first character specifies space units and the | ||
+ | second character specifies inode units | ||
+ | --always-resolve | ||
+ | composed of only digits | ||
+ | -w, --no-wrap | ||
+ | -p, --raw-grace | ||
+ | -l, --local-only | ||
+ | -Q, --quiet-refuse | ||
+ | not respond | ||
+ | -i, --no-autofs | ||
+ | -F, --format=formatname | ||
+ | -f, --filesystem-list | ||
+ | filesystems | ||
+ | --filesystem=path | ||
+ | filesystem, remaining command line arguments | ||
+ | are still treated as user/ | ||
+ | -A, --all-nfs | ||
+ | -m, --no-mixed-pathnames | ||
+ | --show-mntpoint | ||
+ | --hide-device | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Bugs to: jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | ====3.6 - La Commande warnquota==== | ||
+ | |||
+ | La commande **warnquota** vérifie le ou les disques et envoie un message par mail à tout utilisateur qui a dépassé la limite soft. Elle est enrègle générale appelée par un job cron. Cependant elle peut aussi est appelée d'une manière intéractive. | ||
+ | |||
+ | Les options de la commande **warnquota** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | warnquota: Usage: | ||
+ | warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...] | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -s, --human-readable[=units] | ||
+ | GB, ...). Units can be also specified | ||
+ | explicitely by an optional argument in format | ||
+ | [kgt],[kgt] where the first character specifies | ||
+ | space units and the second character specifies | ||
+ | inode units | ||
+ | -i, --no-autofs | ||
+ | -d, --no-details | ||
+ | -F, --format=formatname | ||
+ | -c, --config=config-file | ||
+ | -q, --quota-tab=quotatab-file | ||
+ | -a, --admins-file=admins-file | ||
+ | -I, --ignore-config-errors | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | warnquota: Bugs to jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | ----- | ||
+ | Copyright © 2022 Hugh Norris. |