[lxc-users] Trying to create a lxc container for running Visual Studio Code

Peter Carlsson peter.jm.carlsson at gmail.com
Sun Feb 7 22:19:57 UTC 2021


Hello!

I am new to lxc and just signed up to this mailing list.

As root I have created a lxc container and installed code-insiders to
run Visual Studio Code inside the container.

After reading an article I added the following lines to the containers
config and verified that the UID/GID match host user UID/GID:

# Container's UID/GID 0-65535 are mapped to host's 100000-165535,
# but UID/GID 1000 on the container is mapped to host's UID/GID 1000.
lxc.idmap = u 0 100000 1000
lxc.idmap = g 0 100000 1000
lxc.idmap = u 1000 1000 1
lxc.idmap = g 1000 1000 1
lxc.idmap = u 1001 101001 64535
lxc.idmap = g 1001 101001 64535

When I try as user with UID 1000 to start the container I get:

lxc-start -n VisualStudioCode -F
  lxc-start: VisualStudioCode: tools/lxc_start.c: main: 214 You lack access to /home/peter/.local/share/lxc

When I try as root to start the container I get:

lxc-start -n VisualStudioCode -F
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: mkdir_eexist_on_last: 1219 File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc/VisualStudioCode"
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: create_path_for_hierarchy: 1243 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: cgfsng_payload_create: 1321 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: mkdir_eexist_on_last: 1219 File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc/VisualStudioCode-1" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: create_path_for_hierarchy: 1243 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-1" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: cgfsng_payload_create: 1321 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-1" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: mkdir_eexist_on_last: 1219 File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc/VisualStudioCode-2"
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: create_path_for_hierarchy: 1243 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-2" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: cgfsng_payload_create: 1321 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-2" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: mkdir_eexist_on_last: 1219 File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc/VisualStudioCode-3" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: create_path_for_hierarchy: 1243 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-3" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: cgfsng_payload_create: 1321 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-3" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: mkdir_eexist_on_last: 1219 File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc/VisualStudioCode-4" 
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: create_path_for_hierarchy: 1243 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-4"
  lxc-start: VisualStudioCode: cgroups/cgfsng.c: cgfsng_payload_create: 1321 Failed to create cgroup "/sys/fs/cgroup/unified//lxc/VisualStudioCode-4" 
  lxc-start: VisualStudioCode: conf.c: lxc_map_ids: 3023 newuidmap failed to write mapping "newuidmap: uid range [0-1000) -> [100000-101000) not allowed": newuidmap 26576 0 100000 1000 1000 1000 1 1001 101001 64535 
  lxc-start: VisualStudioCode: start.c: lxc_spawn: 1720 Failed to set up id mapping.
  lxc-start: VisualStudioCode: start.c: __lxc_start: 1951 Failed to spawn container "VisualStudioCode"
  lxc-start: VisualStudioCode: conf.c: lxc_map_ids: 3023 newuidmap failed to write mapping "newuidmap: uid range [0-1000) -> [100000-101000) not allowed": newuidmap 26612 0 100000 1000 65536 0 1
  lxc-start: VisualStudioCode: conf.c: userns_exec_1: 4391 Error setting up {g,u}id mappings for child process "26612"
  lxc-start: VisualStudioCode: tools/lxc_start.c: main: 330 The container failed to start
  lxc-start: VisualStudioCode: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options

I am running Debian Buster with lxc version 3.1.0.

Obviously I am doing something wrong in my configuration or how I use lxc.

Any help would be appreciated.

Best regards,
Peter Carlsson


More information about the lxc-users mailing list