Following the LXC instructions for Basic unprivileged usage in the Ubuntu LTS Server Guide I wanted to create an unprivileged container using lxc-create 3.0.2 on a fresh VM running Ubuntu 18.04.1 LTS in the Hetzner Cloud, but it failed.
peter@usrv:~$ lxc-create -t download -n u1
Error creating container u1
peter@usrv:~$
When I tried to log I’ve got some more meaningful information:
peter@usrv:~$ lxc-create -t download -n u2 -o lxc-u2.log
lxc-create: u2: confile.c: parse_line: 2243 Unknown configuration key "lxc.id_map"
lxc-create: u2: parse.c: lxc_file_for_each_line_mmap: 103 Failed to parse config: lxc.id_map = u 0 165536 65536
lxc-create: u2: conf.c: chown_mapped_root: 3132 No uid mapping for container root
lxc-create: u2: lxccontainer.c: do_storage_create: 1286 Error chowning "/home/peter/.local/share/lxc/u2/rootfs" to container root
lxc-create: u2: conf.c: suggest_default_idmap: 4750 You must either run as root, or define uid mappings
lxc-create: u2: conf.c: suggest_default_idmap: 4751 To pass uid mappings to lxc-create, you could create
lxc-create: u2: conf.c: suggest_default_idmap: 4752 ~/.config/lxc/default.conf:
lxc-create: u2: conf.c: suggest_default_idmap: 4753 lxc.include = /etc/lxc/default.conf
lxc-create: u2: conf.c: suggest_default_idmap: 4754 lxc.idmap = u 0 165536 65536
lxc-create: u2: conf.c: suggest_default_idmap: 4755 lxc.idmap = g 0 165536 65536
lxc-create: u2: lxccontainer.c: do_lxcapi_create: 1867 Failed to create (none) storage for u2
Error creating container u2
peter@usrv:~$
Creating a priviledged containers works as expected.
Next, using the same configuration steps and data, I tried the operation on a fresh installed Ubuntu 16.04.5 LTS VM with lxc-create 2.0.8 and it worked!