Ubuntu – LXC: Create privileged container that can execute mknod

lxcpermissionsUbuntu

I'm trying to figure out how to build Ubuntu Core 18 on my Raspberry Pi. It seems like the best way to do this is to use an LXC container. However, I'm getting this error when I snapcraft --destructive-mode the github repo.

[ -e /root/core18/parts/boostrap/install/dev/null ] || mknod -m 666 /root/core18/parts/boostrap/install/dev/null c 1 3
mknod: /root/core18/parts/boostrap/install/dev/null: Operation not permitted
Makefile:12: recipe for target 'install' failed
make: *** [install] Error 1
Failed to run 'make install DESTDIR=/root/core18/parts/boostrap/install' for 'boostrap': Exited with code 2.
Verify that the part is using the correct parameters and try again.

This issue is happening because I'm running in an unprivileged container that is not allowed to execute this command.

One solution seems to be configure the container to give it that permission, but I also want to know how to simply… create a privileged container. This is a dev box. It's not going anywhere 😉

The documentation appears to be outdated, because lxc-create doesn't exist anymore. And I tried simply creating a container as root, but that didn't do anything either.

How do I create a privileged LXC container that can actually craft this snap?

Here's a semi-related forum post

Best Answer

The answer may surprise you:

lxc config set <container_name> security.privileged true

Related Topic