Snapctl's args are difficult to determine

pstolowski

#1

Back in the day we could run snapctl -h and learn how to use it. However, nowadays it looks like this:

$ snap --version
snap    2.27.5
snapd   2.27.5
series  16
ubuntu  16.04
kernel  4.4.0-93-generic
$ snapctl -h
error: error running snapctl: invalid snap cookie requested

Which requires one to dig into code. Can we get -h back, please?


#2

@niemeyer can we get your input on this?


#3

Yeah, feels reasonable and straightforward.

It’s probably a 5 mins patch by @pstolowski to respect -h before checking for the cookie.


#4

Right. I can confirm a subtle change related to the introducion of ephemeral contexts caused this side-effect. Will fix. Thanks for reporting that @kyrofa!


#5

PR: https://github.com/snapcore/snapd/pull/3907

Funnily enough, we had a spread test, but it was subtly broken (the PR fixes it).


#6

Thank you, @pstolowski! I appreciate your time.


#7

Fix is going in and will be available in 2.29. If you need it earlier, it should be in edge in a few days.


#8

This now seems broken in a similar way:

$ snap --version
snap    2.32.9+17.10
snapd   2.32.9+17.10
series  16
ubuntu  17.10
kernel  4.13.0-37-generic
$ snapctl -h
error: cannot use "-h" with uid 1000, try with sudo

I expect to verify what -h means before I run it with sudo (in case it’s actually some kind of action), and in any case I shouldn’t need elevated privileges to see the help text.


#9

@rbasak Thanks for the report.

@pstolowski Would you mind to check this out when you have a moment?


#10

Sure, will check this.


#11

The PR: https://github.com/snapcore/snapd/pull/5326