snapcraft --use-lxd should have message about requring sudo

Bug #1865230 reported by Hayden Barnes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

Running $ snapcraft --use-lxd will set up LXD but it will not connect:

hayden@ubuntu:~/ghost-desktop$ snapcraft --use-lxd
Support for 'LXD' needs to be set up. Would you like to do that it now? [y/N]: y
snapd is not logged in, snap install commands will use sudo
lxd 3.21 from Canonical✓ installed
Error: LXD still not running after 30s timeout (Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: permission denied)
Timeout reached waiting for LXD to start.

Then, naturally, you try $ sudo snapcraft --use-lxd but get this:

hayden@ubuntu:~/ghost-desktop$ sudo snapcraft --use-lxd
The LXD provider is offered as a technology preview for early adopters.
The command line interface, container names or lifecycle handling may change in upcoming releases.
Launching a container.
An error occurred with the instance when trying to launch with 'LXD': No storage pool found. Please create a new storage pool.
Ensure that 'LXD' is setup correctly and try again.

The fix is to $ snap remove lxd --purge and then $ sudo snapcraft --use-lxd.

Because using snapcraft --use-lxd without sudo leaves it in an unusable state, perhaps it should fail and exit if --use-lxd is enabled without sudo.

Revision history for this message
Hayden Barnes (haydenb) wrote :
Revision history for this message
Chris Patterson (cjp256) wrote :

`sudo` shouldn't be required when invoking snapcraft. As you can see in the log, snapcraft invokes sudo on your behalf when installing LXD.

However, I think we may need to add/check that the user is in the "lxd" group if not run as sudo? Can you verify that your user is not in the "lxd" group?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.