snap install with correct name and wrong channel gives misleading error

Bug #1665787 reported by Mark Shuttleworth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
Fix Released
Undecided
Unassigned
snapd
Fix Released
Medium
Unassigned

Bug Description

Just saw this:

$ sudo snap install etcd --channel=3.1/stable
error: cannot install "etcd": snap not found

The issue is that there is only a beta snap in that track. While snap 'find' can ignore snaps that don't have a latest/stable release, 'install' should give a more useful error in this case. For example:

$ sudo snap install etcd --channel=3.1/stable
error: no suitably stable build of etcd 3.1 released
Try 'snap info etcd' to see what is available

Revision history for this message
Mark Shuttleworth (sabdfl) wrote :

To be clear, this is in the case where:

 * the snap exists
 * the track exists
 * there is a release in a less-stable channel
 * but no release in the requested stability, or more stable, in that track

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

A simple case is where you don’t specify the track, and there is no stable build in latest. For example, snapcraft, which (at the time of writing) is in candidate:

 😌 14:57:16@~> sudo snap install snapcraft
error: snap "snapcraft" not found

Probably we shouldn’t mention the track in that case, because someone who isn’t familiar with tracks at all might think that “snapcraft latest released” (for example) was a typo. Maybe:
    error: No stable release of snapcraft
    Use "snap info snapcraft" to list other releases
vs.
    error: No stable release of etcd 3.1
    Use "snap info etcd" to list other releases
vs.
    error: "fhqwhgads": snap not found

Michael Vogt (mvo)
Changed in snapd:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Michael Vogt (mvo) wrote :

To fix this ideally we would get a bit of support from the store.

The reply when a snap is not available at all is:
"""
{
    "error_list": [
        {
            "code": "resource-not-found",
            "message": "No snap named 'no-such-snap' found in series '16'."
        }
    ],
    "errors": [
        "No snap named 'no-such-snap' found in series '16'."
    ],
    "result": "error"
}
"""

and the reply when it is available in a different channel *or* for a different architecture is:
"""
{
    "error_list": [
        {
            "code": "resource-not-found",
            "message": "Snap 'test-snapd-number-version' (aCbVk0mvv6bqWTG0mybHA60K2g8kWQMg) has no published revisions in the given context."
        }
    ],
    "errors": [
        "Snap 'test-snapd-number-version' (aCbVk0mvv6bqWTG0mybHA60K2g8kWQMg) has no published revisions in the given context."
    ],
    "result": "error"
}
"""

Ideally the store would provide us a machine readable hint about the condition beyond "message".

Something like: "not-found-reason":"no-such-snap|not-in-specificed-channel|not-for-this-architecture".
Then we can easily tell the user what to do. Without store support we can fix it too, the cost is just an additional roundtrip for a 404 (i.e. query again with "channel=any" basicly).

Revision history for this message
Michael Vogt (mvo) wrote :

I pushed a RFC PR https://github.com/snapcore/snapd/pull/4443 with the extra roundtrip for discussion.

Changed in snapd:
status: Triaged → In Progress
Changed in snapd:
status: In Progress → Fix Released
Changed in snapstore:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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