Tâche #31932
Scénario #32000: Traitement express MEN (14-16)
Erreur lors du gen_conteneur en mode CDROM
100%
Description
Après installation des paquets eole-lxc-controller ssmtp sur une aca.eolebase FIAvecCdrom
Test squash : https://dev-eole.ac-dijon.fr/squash/test-cases/1181/info
Related issues
Associated revisions
Add correct options to take care of apparmor cache
fix: #31932
Add -T for not reading cache
Add -W for writing cache
History
#1 Updated by Matthieu Lamalle almost 2 years ago
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Lancement des conteneurs -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Start Systemd service lxc-net [ OK ] Start Systemd service lxc [ OK ] root - Impossible de démarrer le conteneur : mail
root@eolebase:~# tail -n5 /var/log/lxc-mail.log lxc-start mail 20210315114218.679 ERROR cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1264 - Failed to create cgroup "(null)" lxc-start mail 20210315114218.680 ERROR cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1264 - Failed to create cgroup "(null)" lxc-start mail 20210315114218.680 ERROR cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1264 - Failed to create cgroup "(null)" lxc-start mail 20210315114218.681 ERROR cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1264 - Failed to create cgroup "(null)" lxc-start mail 20210315114218.681 ERROR cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1264 - Failed to create cgroup "(null)"
#2 Updated by Emmanuel GARETTE almost 2 years ago
- Parent task deleted (
#31861)
#3 Updated by Emmanuel GARETTE almost 2 years ago
- Tracker changed from Tâche to Demande
- Subject changed from SC-T10-001, erreur lors du gen_conteneur to Erreur lors du gen_conteneur en mode CDROM
#4 Updated by Emmanuel GARETTE almost 2 years ago
- Target version deleted (
Prestation Cadoles MEN 2021 11-13)
#5 Updated by Joël Cuissinat almost 2 years ago
- Description updated (diff)
#6 Updated by Joël Cuissinat almost 2 years ago
- Parent task set to #32000
#7 Updated by Joël Cuissinat almost 2 years ago
- Related to Tâche #31933: Mettre à jour SC-T10 added
#8 Updated by Laurent Flori almost 2 years ago
- Status changed from Nouveau to En cours
#9 Updated by Laurent Flori almost 2 years ago
- Assigned To set to Laurent Flori
#10 Updated by Laurent Flori almost 2 years ago
C'est un problème avec le profile apparmor pour le cdrom (lxc-container-default-with-cdrom) si on désactive celui ci la conteneur démarre sans problème apparent.
Le profil apparmor avec cdrom n'est jamais chargé (on ne peut pas le charger à la main non plus). On peut s'en assurer avec la commande
root@eolebase:~# apparmor_status apparmor module is loaded. 17 profiles are loaded. 17 profiles are in enforce mode. /usr/bin/lxc-start /usr/bin/man /usr/lib/NetworkManager/nm-dhcp-client.action /usr/lib/NetworkManager/nm-dhcp-helper /usr/lib/connman/scripts/dhclient-script /usr/sbin/ntpd /usr/sbin/tcpdump /{,usr/}sbin/dhclient lsb_release lxc-container-default lxc-container-default-cgns lxc-container-default-with-mounting lxc-container-default-with-nesting man_filter man_groff nvidia_modprobe nvidia_modprobe//kmod 0 profiles are in complain mode. 1 processes have profiles defined. 0 processes are in enforce mode. 0 processes are in complain mode. 1 processes are unconfined but have a profile defined. /usr/sbin/ntpd (1000) root@eolebase:~#
Je n'ai pas trouvé la solution dans la documentation mais dans les fichiers de configuration eux-mêmes:
# Do not load this file. Rather, load /etc/apparmor.d/lxc-containers, which # will source all profiles under /etc/apparmor.d/lxc
et dans le fichier /etc/apparmor.d/lxc-containers:
l'entrée "#include <lxc>" est commentée. Si on la décommente et qu'on relance le service avec
systemctl restart apparmor.service, on a bien:
apparmor module is loaded. 18 profiles are loaded. 18 profiles are in enforce mode. /usr/bin/lxc-start /usr/bin/man /usr/lib/NetworkManager/nm-dhcp-client.action /usr/lib/NetworkManager/nm-dhcp-helper /usr/lib/connman/scripts/dhclient-script /usr/sbin/ntpd /usr/sbin/tcpdump /{,usr/}sbin/dhclient lsb_release lxc-container-default lxc-container-default-cgns lxc-container-default-with-cdrom <--- C'est ce qu'on cherche lxc-container-default-with-mounting lxc-container-default-with-nesting man_filter man_groff nvidia_modprobe nvidia_modprobe//kmod 0 profiles are in complain mode. 16 processes have profiles defined. 16 processes are in enforce mode. /usr/sbin/ntpd (1004) /usr/lib/systemd/systemd (836) lxc-container-default-with-cdrom /usr/lib/systemd/systemd-journald (881) lxc-container-default-with-cdrom /usr/lib/systemd/systemd-resolved (914) lxc-container-default-with-cdrom /usr/sbin/cron (916) lxc-container-default-with-cdrom /usr/bin/dbus-daemon (917) lxc-container-default-with-cdrom /usr/bin/python3.8 (919) lxc-container-default-with-cdrom /usr/sbin/rsyslogd (920) lxc-container-default-with-cdrom /usr/lib/systemd/systemd-logind (922) lxc-container-default-with-cdrom /usr/sbin/agetty (927) lxc-container-default-with-cdrom /usr/sbin/agetty (928) lxc-container-default-with-cdrom /usr/sbin/agetty (929) lxc-container-default-with-cdrom /usr/sbin/agetty (930) lxc-container-default-with-cdrom /usr/sbin/agetty (931) lxc-container-default-with-cdrom /usr/sbin/sshd (932) lxc-container-default-with-cdrom /usr/sbin/exim4 (944) lxc-container-default-with-cdrom 0 processes are in complain mode. 0 processes are unconfined but have a profile defined.
Une question demeure, comment les autres profils lxc sont-ils chargés sans que cette ligne d'include soit active dans le fichiers de configuration.
Et j'ai la réponse finalement:
le profil arrive plus tard que les profils par défaut et n'est pas traité de la même façon. Si je copie le fichier de profil dans le répertoire /etc/apparmor.d/lxc/ avant d'installer eole-lxc-controller et ssmtp, à la fin de l'installation il est bien chargé comme les autres.
Et finalement pour resoudre le problème, il n'y a même pas besoin de redémarrer le démon apparmor:
après l'installation, faire la commande suivante suffit (mercci au postinst du paquet liblxc-common ;-) ):
apparmor_parser -r -T -W /etc/apparmor.d/lxc-containers
aa-status (ou apparmor_status) confirme que 18 profiles sont chargés dont lxc avec cdrom
#11 Updated by Joël Cuissinat almost 2 years ago
Bizarrement, jenkins dit que ça passait jusqu'à la semaine dernière : https://dev-eole.ac-dijon.fr/jenkins/job/2.8.1/job/test-eolebase-lxc-001-2.8.1-amd64/
#12 Updated by Laurent Flori almost 2 years ago
- Status changed from En cours to Résolu
- % Done changed from 0 to 100
Appliqué par commit eole-common:aaba38fd7b62499566c75f397583b43e7762df23.
#13 Updated by Fabrice Barconnière almost 2 years ago
OK
------------------------------------------------------------------------ Lancement des conteneurs ------------------------------------------------------------------------ Start Systemd service lxc-net [ OK ] Start Systemd service lxc [ OK ]
#14 Updated by Fabrice Barconnière almost 2 years ago
- Status changed from Résolu to Fermé
- Remaining (hours) set to 0.0