On GET v2/snaps "channel" property is empty on preinstalled snaps

Bug #1864938 reported by Robert Liu on 2020-02-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
High
Samuele Pedroni

Bug Description

Description:
When using REST API to query the installed snaps ("GET v2/snaps"), the "channel" fields are empty for those snaps which are preinstalled and not refreshed. However, "snap list" command gives a correct output.

Image:
http://cdimage.ubuntu.com/ubuntu-core/18/beta/20200226.1/

Reproduce method:
Run the ubuntu core image through KVM, and use cURL to query the snap list.
$ sudo snap install toolbox --devmode # for debugging
$ snap list --all
$ sudo timeout -s 2 2 toolbox.curl -N -s -0 --unix-socket /run/snapd.socket "http:/localhost/v2/snaps" | toolbox.jq . > get-v2-snaps.json

Output:
$ snap list --all
Name Version Rev Tracking Publisher Notes
core18 20200124 1668 latest/beta canonical* base
pc 18-2 36 18/beta canonical* gadget
pc-kernel 4.15.0-89.89 403 18/beta canonical* kernel
snapd 2.43.3 6434 latest/beta canonical* snapd,disabled
snapd 2.44~pre1+git1315.gc9529d2 6608 latest/beta canonical* snapd
toolbox 0.5.47 817 latest/stable ondra devmode

# part of the "v2/snaps" output
    {
      "id": "CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6",
      "summary": "Runtime environment based on Ubuntu 18.04",
      "description": "The base snap based on the Ubuntu 18.04 release.\n",
      "name": "core18",
      "publisher": {
        "id": "canonical",
        "username": "canonical",
        "display-name": "Canonical",
        "validation": "verified"
      },
      "developer": "canonical",
      "status": "active",
      "type": "base",
      "version": "20200124",
      "channel": "",
      "tracking-channel": "latest/beta",
      "ignore-validation": false,
      "revision": "1668",
      "confinement": "strict",
      "private": false,
      "devmode": false,
      "jailmode": false,
      "contact": "",
      "mounted-from": "/var/lib/snapd/snaps/core18_1668.snap",
      "install-date": "2020-02-27T01:02:15.761212397Z"
    },
    {
      "id": "PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4",
      "title": "snapd",
      "summary": "Background service that manages and maintains installed snaps",
      "description": "**Note: you do not need to install _snapd_ manually if you already have _snap_ installed.**\n\nSnaps are app packages for desktop, cloud and IoT th
at update automatically, are easy to install, secure, cross-platform and dependency-free. They're being used on millions of Linux systems every day.\n\nAlongside its var
ious service and management functions, snapd:\n- provides the _snap_ command that's used to install and remove snaps and interact with the wider snap ecosystem\n- implem
ents the confinement policies that isolate snaps from the base system and from each other\n- governs the interfaces that allow snaps to access specific system resources
outside of their confinement\n\nFor general details, including _installation_ and _Getting started_ guides, head over to our _Snap documentation_: https://snapcraft.io/
docs\n\nIf you want to build your own snaps, start with our _Creating a snap_ documentation: https://snapcraft.io/docs/creating-a-snap\n\n**Get involved**\n\nThis is an
_open source_ project and we warmly welcome community contributions, suggestions, and constructive feedback. If you're interested in contributing, please take a look at
our _Code of Conduct_ first.\n\n- to report an issue, please file _a bug report_ (https://bugs.launchpad.net/snappy/+filebug) on our _Launchpad issue tracker_ (https://b
ugs.launchpad.net/snappy/)\n- for suggestions and constructive feedback, create a post on the _Snapcraft forum_ (https://forum.snapcraft.io/c/snapd)\n- to build snapd ma
nually, or to get started with snapd development, see _HACKING.md (https://raw.githubusercontent.com/snapcore/snapd/master/HACKING.md)\n\n**Get in touch**\n\nWe're frie
ndly! We have a community forum at https://forum.snapcraft.io where we discuss feature plans, development news, issues, updates and troubleshooting. You can chat in real
time with the snapd team and our wider community on the _#snappy_ (https://webchat.freenode.net/?channels=snappy) IRC channel on _freenode_ (https://freenode.net/).\n\nF
or news and updates, follow us on _T1witter_ (https://twitter.com/snapcraftio) and on _Facebook_ (https://www.facebook.com/snapcraftio).\n\nThe snapd source code can be f
ound on GitHub: https://github.com/snapcore/snapd",
      "icon": "https://dashboard.snapcraft.io/site_media/appmedia/2019/09/snapd.png",
      "installed-size": 28184576,
      "name": "snapd",
      "publisher": {
        "id": "canonical",
        "username": "canonical",
        "display-name": "Canonical",
        "validation": "verified"
      },
      "developer": "canonical",
      "status": "active",
      "type": "snapd",
      "version": "2.44~pre1+git1315.gc9529d2",
      "channel": "latest/beta",
      "tracking-channel": "latest/beta",
      "ignore-validation": false,
      "revision": "6608",
      "confinement": "strict",
      "private": false,
      "devmode": false,
      "jailmode": false,
      "contact": "",
      "license": "GPL-3.0",
      "mounted-from": "/var/lib/snapd/snaps/snapd_6608.snap",
      "website": "https://snapcraft.io",
      "media": [
        {
          "type": "icon",
          "url": "https://dashboard.snapcraft.io/site_media/appmedia/2019/09/snapd.png",
          "width": 460,
          "height": 460
        },
        {
          "type": "screenshot",
          "url": "https://dashboard.snapcraft.io/site_media/appmedia/2019/09/Screenshot_20190924_115756_hLcyetO.png",
          "width": 956,
          "height": 648
        },
        {
          "type": "screenshot",
          "url": "https://dashboard.snapcraft.io/site_media/appmedia/2019/09/Screenshot_20190924_115824_2v3y6l8.png",
          "width": 956,
          "height": 648
        },
        {
          "type": "screenshot",
          "url": "https://dashboard.snapcraft.io/site_media/appmedia/2019/09/Screenshot_20190924_115055_Uuq7KIb.png",
          "width": 1023,
          "height": 834
        },
        {
          "type": "screenshot",
          "url": "https://dashboard.snapcraft.io/site_media/appmedia/2019/09/Screenshot_20190924_125944.png",
          "width": 956,
          "height": 648
        }
      ],
      "install-date": "2020-02-27T01:02:39.436069431Z"
    }

Robert Liu (robertliu) wrote :
Michael Vogt (mvo) on 2020-03-12
Changed in snapd:
status: New → Triaged
importance: Undecided → High
Michael Vogt (mvo) wrote :

I looked into this now. It's a bit of an open question if it's a bug because technically we did not talk to the store yet so we don't have channel information. However it's also a bit strange to return "" here. I will lean on Samuele to decide what we should do. Something like https://github.com/snapcore/snapd/compare/master...mvo5:snapstate-local-install-channel?expand=1 might help.

Robert Liu (robertliu) wrote :

@mvo,

Thanks for your efforts. I also think this may not be a real issue. At this moment, I can take the "tracking-channel" as a fallback if the "channel" is empty. But, it would be helpful that the API document describes the definitions and behaviors of the keys and values clearly.

Changed in snapd:
assignee: nobody → Samuele Pedroni (pedronis)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers