Я пытаюсь понять как lxc.id_map
работы, но моя проблема, я не могу даже воспроизвести настройки по умолчанию отображения UID. Это походит что lxc.id_map
Я установил, это будет всегда возвращать ошибку, "Отказавшую для установки идентификационного отображения"..
Я протестировал следование новой установки 16,04 64-разрядных использований всех значений по умолчанию.
Я создал новый контейнер как некорневой пользователь:
lxc launch images:ubuntu/xenial/amd64 u1
Походит на контейнер, запущенный с корня uid=165536:
ggyimesi@lxctest:~$ ps aux | grep init
root 1 0.2 0.1 119756 6076 ? Ss 20:43 0:01 /sbin/init splash
165536 5628 0.0 0.1 37008 5120 ? Ss 20:50 0:00 /sbin/init
ggyimesi 5951 0.0 0.0 21292 1032 pts/17 S+ 20:57 0:00 grep --color=auto init
Таким образом, я остановил контейнер и отредактировал использование конфигурации lxc config edit u1
добавить lxc.id_map
строки как следующее:
architecture: x86_64
config:
raw.lxc: |
lxc.id_map = u 0 165536 65536
lxc.id_map = g 0 165536 65536
volatile.base_image: bff1ac73dada477000de5efbbd84ca12b0761fd4100f13ee39f9345553edb2f3
volatile.eth0.hwaddr: 00:16:3e:e9:ea:b0
volatile.idmap.base: "0"
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":165536,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":165536,"Nsid":0,"Maprange":65536}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":165536,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":165536,"Nsid":0,"Maprange":65536}]'
volatile.last_state.power: RUNNING
devices:
root:
path: /
type: disk
ephemeral: false
profiles:
- default
Теперь контейнеру не удается запуститься:
ggyimesi@lxctest:~$ lxc start u1
error: Error calling 'lxd forkstart u1 /var/lib/lxd/containers /var/log/lxd/u1/lxc.conf': err='exit status 1'
lxc 20170309200441.616 ERROR lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1306 - Path "/sys/fs/cgroup/systemd//lxc/u1" already existed.
lxc 20170309200441.616 ERROR lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1363 - No such file or directory - Failed to create /sys/fs/cgroup/systemd//lxc/u1: No such file or directory
lxc 20170309200441.759 ERROR lxc_start - start.c:lxc_spawn:1171 - Failed to set up id mapping.
lxc 20170309200441.119 ERROR lxc_start - start.c:__lxc_start:1346 - Failed to spawn container "u1".
lxc 20170309200441.643 ERROR lxc_conf - conf.c:run_buffer:405 - Script exited with status 1.
lxc 20170309200441.643 ERROR lxc_start - start.c:lxc_fini:546 - Failed to run lxc.hook.post-stop for container "u1".
lxc 20170309200441.645 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.645 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/systemd//lxc/u1-1
lxc 20170309200441.649 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.649 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/net_cls//lxc/u1-1
lxc 20170309200441.652 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.652 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/perf_event//lxc/u1-1
lxc 20170309200441.654 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.654 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/cpu//lxc/u1-1
lxc 20170309200441.655 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.656 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/devices//lxc/u1-1
lxc 20170309200441.657 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.657 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/blkio//lxc/u1-1
lxc 20170309200441.659 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.659 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/hugetlb//lxc/u1-1
lxc 20170309200441.661 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.661 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/pids//lxc/u1-1
lxc 20170309200441.662 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.662 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/cpuset//lxc/u1-1
lxc 20170309200441.664 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.664 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/memory//lxc/u1-1
lxc 20170309200441.666 ERROR lxc_conf - conf.c:userns_exec_1:4453 - Error setting up child mappings
lxc 20170309200441.666 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1270 - Error destroying /sys/fs/cgroup/freezer//lxc/u1-1
Try `lxc info --show-log u1` for more info
Возможно, я пропускаю что-то, но разве это не должно быть настройкой по умолчанию, т.е. контейнер должен запуститься, как это сделало прежде? Удаление lxc.id_map
строки от конфигурации делают контейнерный запуск без любых ошибок.
Кто-либо мог указать на меня в правильном направлении, почему вышеупомянутая конфигурация не работает?