URL: https://linuxfr.org/forums/linux-general/posts/utilisation-de-lxc-en-mode-non-privilegie Title: Utilisation de LXC en mode non privilégié Authors: ache Date: 2021年12月13日T15:44:55+01:00 License: CC By-SA Tags: lxc et virtualisation Score: 1 Bonjour, Je souhaite utiliser des conteneurs lxc en tant que simple utilisateur (utilisateur non privilégié). Je n'ai aucun problème étant root, mais je n'arrive pas du tout à configurer la translation d'uid et d'id de groupe. Lorsque j'essaye de créer un conteneur lxc j'ai ce message : ```sh $ lxc-create -n ml -t download -- --dist ubuntu lxc-create: ml: conf.c: lxc_map_ids: 3654 newuidmap failed to write mapping "newuidmap: uid range [0-1) -> [100000-100001) not allowed": newuidmap 27943 0 100000 1 1000 1000 1 lxc-create: ml: conf.c: userns_exec_mapped_root: 5529 Error setting up {g,u}id mappings for child process "27943" lxc-create: ml: lxccontainer.c: do_lxcapi_create: 1805 Invalid argument - Failed to create container ml ``` J'essaye tant bien que mal de comprendre comment fonctionne le fichier /etc/subuid mais rien n'est claire pour moi. ```sh $ man subuid Each line in /etc/subuid contains a user name and a range of subordinate user ids that user is allowed to use. This is specified with three fields delimited by colons (« : »). These fields are: [...] ``` Ok donc mon utilisateur `ache` doit pouvoir utiliser l'ensemble des utilisateurs du conteneur, l'uid 0 inclut. Donc en lisant la documentation, ce fichier ne me semble pas déconnant, je n'aurais pas `1000` utilisateur sur mon conteneur : ache:0:2000 Manifestement, je n'ai pas compris quelque chose, ou je n'ai rien compris du tout. Mon uid est 1000, tout comme l'id de mon groupe principal. Quelqu’un pourrait m'expliquer ? Merci. ____ PS: Après quelques tentatives, sans vraiment bien comprendre. En utilisant : ache:0:100001 Dans subuid et subgid, j'ai cette erreur : ```sh lxc-create -n ml -t download -- --dist ubuntu lxc 20211213163145.370 ERROR conf - conf.c:lxc_map_ids:3654 - newuidmap failed to write mapping "newuidmap: uid range [1001-66537) -> [101001-166537) not allowed": newuidmap 83559 0 100000 1000 1000 1000 1 1001 101001 65536 Failed to write id mapping for child process lxc 20211213163145.371 ERROR utils - utils.c:lxc_drop_groups:1345 - Operation not permitted - Failed to drop supplimentary groups lxc 20211213163145.371 ERROR utils - utils.c:lxc_switch_uid_gid:1320 - Invalid argument - Failed to switch to gid 0 lxc-create: ml: lxccontainer.c: create_run_template: 1618 Failed to create container from template lxc-create: ml: conf.c: lxc_map_ids: 3654 newuidmap failed to write mapping "newuidmap: uid range [1001-66537) -> [101001-166537) not allowed": newuidmap 83561 0 100000 1000 1000 1000 1 1001 101001 65536 lxc-create: ml: conf.c: userns_exec_full: 5315 error setting up {g,u}id mappings for child process "83561" lxc-create: ml: lxccontainer.c: container_destroy: 2989 Error destroying rootfs for ml lxc-create: ml: tools/lxc_create.c: main: 317 Failed to create container ml ``` Il réussit quand même à créer le container `ml` mais il ne se lance pas : ```sh lxc-start -n ml lxc-start: ml: lxccontainer.c: wait_on_daemonized_start: 867 Received container state "ABORTING" instead of "RUNNING" ``` logfile : ```sh lxc-start ml 20211213163234.942 ERROR conf - conf.c:lxc_map_ids:3654 - newuidmap failed to write mapping "newuidmap: uid range [1001-66537) -> [101001-166537) not allowed": newuidmap 83960 0 100000 1000 1000 1000 1 1001 101001 65536 lxc-start ml 20211213163234.943 ERROR start - start.c:lxc_spawn:1790 - Failed to set up id mapping. lxc-start ml 20211213163234.943 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:867 - Received container state "ABORTING" instead of "RUNNING" lxc-start ml 20211213163234.943 ERROR lxc_start - tools/lxc_start.c:main:306 - The container failed to start lxc-start ml 20211213163234.943 ERROR lxc_start - tools/lxc_start.c:main:309 - To get more details, run the container in foreground mode lxc-start ml 20211213163234.943 ERROR lxc_start - tools/lxc_start.c:main:311 - Additional information can be obtained by setting the --logfile and --logpriority options lxc-start ml 20211213163234.943 ERROR start - start.c:__lxc_start:2073 - Failed to spawn container "ml" ```

AltStyle によって変換されたページ (->オリジナル) /