I have installed lxd from a snap package on an ubuntu 14.04 server and executed an initial lxd init
apparently the lxd.lxc [command] commands require to be run with sudo.
So, are those containers created privileged ones by default? how would you run unprivileged containers with a snapped lxd?
First a quick note, the LXD snap should have automatically setup an alias from âlxcâ to âlxd.lxcâ so you donât need to type âlxd.lxcâ constantly
LXD is a daemon and always runs as root, this is unrelated to privileged vs unprivileged containers where the difference is on whether root in the container is real root or not.
Anyone who can talk to LXD can create containers. By default those containers are unprivileged but itâs just a matter of setting security.privileged=true on a LXD container and restarting it to then have it be privileged.
LXD will allow members of the âlxdâ group to interact with the daemon, this lets you give non-root users the ability to talk to LXD. Do note that this is pretty much equivalent to handing root access to those users since they can configure LXD to run privileged containers and pass any character/block device or disk path into them.
Anyway, to get this going with the snap package. Just create the group on your system with âgroupadd --system lxdâ, then add your user to the group and lastly, restart the LXD daemon with âsystemctl restart snap.lxd.daemon.serviceâ. The snap will detect that the group exists and pass ââgroup lxdâ to the daemon which will have it allow connections from anyone whoâs in the âlxdâ group.
true, noticed that as well in the meantime, thank god[quote=âstgraber, post:2, topic:387â]
to get this going with the snap package. Just create the group on your system with âgroupadd --system lxdâ, then add your user to the group and lastly, restart the LXD daemon with systemctl restart snap.lxd.daemon.service. The snap will detect that the group exists and pass ââgroup lxdâ to the daemon which will have it allow connections from anyone whoâs in the âlxdâ group.
[/quote]
ok. For now I get the same lxd group error after having followed that procedure though
will try whether restarting the server does any good to it
btw ⊠isnât it that the lxd group getâs created by lxd init with a âconventionalâ (apt install) installation of lxd (at lease I canât remember to have to create a âlxdâ group manually on any of the previous (conventional) trialâs I ran.
EDIT: stopping and restarting the lxd daemon a couple of times has now actually done the trick ⊠thanks
The âlxdâ group is created by the packaging script on a non-snap install. There are no equivalent to those scripts in the snap world (itâs considered to be one of its features) so we canât have the lxd snap automatically create the group, or at least we canât do this in a clean way
snapd on Ubuntu 14.04 still uses systemd for the snaps. Itâs running its own systemd instance just for that. The rest of your system will still be using upstart.