I am new to LXC container. Currently, I am trying to build LXC container on a Zedboard booting with PetaLinux. I created the LXC container on my PC and gzip the container in “/home//.local/share/lxc/” to transfer to the zedboard. I tried to start the container using “lxc-start -n my-container -d -l trace -o debug.out” but I received this error.
I tried to change my-container permission using “sudo chown 100000:100000 -R /home//.local/share/lxc/my-container/rootfs” but still receive the same error.
I tried to create the container in the Zedboard instead of transferring the container gzip folder but received another error “WARN: could not reopen tty: Permission denied”
Container configuration file # Template used to create this container: /usr/share/lxc/templates/lxc-download # Parameters passed to the template: # Template script checksum (SHA-1): 740c51206e35463362b735e68b867876048a8baf # For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers: LXC.include = /usr/share/lxc/config/nesting.conf # (Be aware this has security implications)
Distribution configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.include = /usr/share/lxc/config/ubuntu.userns.conf
lxc.arch = x86
Container specific configuration
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
lxc.rootfs = /home/intern/.local/share/lxc/my-container/rootfs
lxc.rootfs.backend = dir
lxc.utsname = my-container
newuidmap and newgidmap
intern@plnx_arm:~$ which newuidmap
/usr/bin/newuidmap
intern@plnx_arm:~$ which newgidmap
/usr/bin/newgidmap
intern@plnx_arm:~$ ls -al /usr/bin/newuidmap
-rwsr-xr-x 1 root root 24608 Dec 9 2016 /usr/bin/newuidmap
intern@plnx_arm:~$ ls -al /usr/bin/newgidmap
-rwsr-xr-x 1 root root 24608 Dec 9 2016 /usr/bin/newgidmap
Thank You for replying. Another thing is that for the rootfs of the container, I have replace it with my own rootfs. I created the LXC container using PC, delete the rootfs and copy my own rootfs into the container. Am I allowed to do this?
I have also tried to run the container as root. By moving the LXC container to /var/lib/lxc/ in the petalinux. And got another error when running lxc-start “failed to attach ‘vethHVE5N0’ to the bridge ‘lxcbr0’: Operation not permitted”. root@plnx_arm:~# lxc-ls -f
root@plnx_arm:~# lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6
my-container STOPPED 0 - - -
root@plnx_arm:~# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0A:35:00:1E:53
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:145 Base address:0xb000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1%768144/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
*root@plnx_arm:~# brctl show
root@plnx_arm:~# brctl show
bridge name bridge id STP enabled interfaces
root@plnx_arm:~#
command “brctl show” show nothing.
The rootfs of the container needs to be shifted to the correct uid and gid for it to be useable. So when you copy the rootfs from another PC you need to make sure that the rootfs is correctly chow()ed. You can do this by doing:
I have tried to change the container rootfs permission using command “sudo chown 100000:100000 -R /home/intern/.local/share/lxc/LXC/rootfs”. However, it still gives the same error.
I take this to mean that you were able to start unprivileged containers after this change. Marking this as solved. If you still experience issues just comment here.