Can lxc-execute be run on the already created container?
uname -a is
Linux topas-dev 4.15.0-153-generic #160-Ubuntu SMP Thu Jul 29 06:54:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Configuration file used:
lxc.log.level = 1
lxc.log.file = applog.txt
lxc.idmap = u 0 231072 1002
lxc.idmap = g 0 231072 1003
lxc.idmap = u 1002 1002 1
lxc.idmap = g 1003 1003 1
lxc idmap = u 1004 232075 64533
lxc.idmap = g 1005 232076 64532
lxc.console.path = none
/var/lib/lxc/demo$ lxc-execute -n demo -l trace -f config -o /tmp/z.txt – ls -lh /home
lxc-execute: demo: start.c: lxc_spawn: 1716 Operation not permitted - Failed to allocate new network namespace id
lxc-execute: demo: conf.c: lxc_setup: 3574 No such file or directory - Unable to open lxc.init.static
lxc-execute: demo: start.c: do_start: 1234 Failed to setup container “demo”
lxc-execute: demo: sync.c: __sync_wait: 59 An error occurred in another process (expected sequence number 5)
lxc-execute: demo: start.c: __lxc_start: 1910 Failed to spawn container “demo”
lxc-execute: demo: tools/lxc_execute.c: main: 240 Failed run an application inside container
Why is lxc-execute failing? with same config file lxc-start command works without errors
To answer your question: Yes, it works by creating a new container using lxc-init in the process. From your error logs, I can see that multiple idmap entries might be causing those errors. You can read more about the command here: Linux Containers - LXC - Manpages - lxc-execute.1
Did you try with simple idmap config with 2 entries, i.e. the output from sudo grep YOUR_USERNAME /etc/sub{uid,gid}