Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

error: snapctl requires SNAP_CONTEXT environment variable #1294

Closed
marianoguerra opened this issue Oct 18, 2016 · 7 comments
Closed

error: snapctl requires SNAP_CONTEXT environment variable #1294

marianoguerra opened this issue Oct 18, 2016 · 7 comments

Comments

@marianoguerra
Copy link

following the getting started guide from the readme when I try running snapctl I get that error

error: snapctl requires SNAP_CONTEXT environment variable

googling there's no information about that env variable and what value it should have

@candysmurf
Copy link
Contributor

@mantri, would you please let us know which release of Snap has you used and the steps for reproducing this error?

@marianoguerra
Copy link
Author

download latest release from releases page (v0.16.1-beta) unpack, run

snapd --plugin-trust 0 --log-level 1

and try to run any command with snapctl from the getting started guide.

using ubuntu 16.04

@candysmurf
Copy link
Contributor

@marianoguerra, I was not able to reproduce your issue on ubuntu14.04. We'll see on ubuntu 16.04.

@nanliu
Copy link
Contributor

nanliu commented Oct 18, 2016

Looks like ubuntu core snapd packaging added a snapctl command:
http://www.ubuntuupdates.org/package/core/xenial/universe/updates/snapd

$ sudo apt-get install snapd
Reading package lists... Done
Building dependency tree... Done
The following additional packages will be installed:
  apparmor liblzo2-2 snap-confine squashfs-tools ubuntu-core-launcher
Suggested packages:
  apparmor-profiles apparmor-profiles-extra apparmor-docs apparmor-utils
The following NEW packages will be installed:
  liblzo2-2 snap-confine snapd squashfs-tools ubuntu-core-launcher
The following packages will be upgraded:
  apparmor
1 upgraded, 5 newly installed, 0 to remove and 143 not upgraded.
Need to get 28.9 kB/6,862 kB of archives.
After this operation, 33.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 snap-confine amd64 1.0.43-0ubuntu1~16.04.1 [28.9 kB]
Fetched 28.9 kB in 0s (60.2 kB/s)
Preconfiguring packages ...
Selecting previously unselected package liblzo2-2:amd64.
(Reading database ... 59628 files and directories currently installed.)
Preparing to unpack .../liblzo2-2_2.08-1.2_amd64.deb ...
Unpacking liblzo2-2:amd64 (2.08-1.2) ...
Preparing to unpack .../apparmor_2.10.95-0ubuntu2.2_amd64.deb ...
Unpacking apparmor (2.10.95-0ubuntu2.2) over (2.10.95-0ubuntu2) ...
Selecting previously unselected package snap-confine.
Preparing to unpack .../snap-confine_1.0.43-0ubuntu1~16.04.1_amd64.deb ...
Unpacking snap-confine (1.0.43-0ubuntu1~16.04.1) ...
Selecting previously unselected package ubuntu-core-launcher.
Preparing to unpack .../ubuntu-core-launcher_1.0.43-0ubuntu1~16.04.1_amd64.deb ...
Unpacking ubuntu-core-launcher (1.0.43-0ubuntu1~16.04.1) ...
Selecting previously unselected package squashfs-tools.
Preparing to unpack .../squashfs-tools_1%3a4.3-3ubuntu2_amd64.deb ...
Unpacking squashfs-tools (1:4.3-3ubuntu2) ...
Selecting previously unselected package snapd.
Preparing to unpack .../snapd_2.15.2ubuntu1_amd64.deb ...
Unpacking snapd (2.15.2ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up liblzo2-2:amd64 (2.08-1.2) ...
Setting up apparmor (2.10.95-0ubuntu2.2) ...
Installing new version of config file /etc/apparmor.d/abstractions/dbus-session-strict ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Files /var/lib/dpkg/info/apparmor.md5sums and /var/lib/apparmor/profiles/.apparmor.md5sums differ
Setting up snap-confine (1.0.43-0ubuntu1~16.04.1) ...
Setting up ubuntu-core-launcher (1.0.43-0ubuntu1~16.04.1) ...
Setting up squashfs-tools (1:4.3-3ubuntu2) ...
Setting up snapd (2.15.2ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

$ snapctl
error: snapctl requires SNAP_CONTEXT environment variable

This command does not appear to be documented, nor does it include a man page. snapctl command was introduced to Ubuntu snapd package for version 2.13 on 2016-08-29. This is unfortunately clobbering the snapctl command you downloaded.

cc: @mjbrender we may need to rename our binaries...

@marianoguerra
Copy link
Author

yep, found out the same before seeing the last comment, I never installed snapd so it seems to come by default, I had your snap after this one in the path so it was picking it up instead of yours.

at least a note in the getting started section about setting path correctly and being careful with copying this binaries in /usr/bin

@lynxbat
Copy link
Contributor

lynxbat commented Oct 18, 2016

Reopening because your comment on catching this in getting started section is valid. We also like hints in the error message also which would help here. We will close this when we resolve both. Thanks for catching this.

@mbbroberg
Copy link
Contributor

Issue is documented in #1284 - thanks again for bringing this up @marianoguerra. Also, so good to see you in here!

#1344 will handle the resulting binary names.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants