'snap install' neither updates to the request channel, nor returns an error, if snap is already installed

Bug #1959563 reported by Björn Tillenius
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Wishlist
Unassigned

Bug Description

Sometimes you want to make sure a snap uses a specific channel in a script. A common attempt is:

  snap install --channel=latest/stable lxd

Now that works if lxd isn't installed. But if lxd is installed and tracking a different channel, that command will succeed, but it won't refresh to the requested channel.

root@test:~# snap info lxd | grep installed
installed: 4.0.8 (21835) 70MB -
root@test:~# snap info lxd | grep latest/stable
  latest/stable: 4.22 2022-01-26 (22292) 79MB -
root@test:~# snap install --channel=latest/stable lxd
snap "lxd" is already installed, see 'snap help refresh'
root@test:~# echo $?
0
root@test:~# snap info lxd | grep installed
installed: 4.0.8 (21835) 70MB -

I do know about 'refresh'. But given that the 'install' didn't produce an error, you often won't catch it, until you notice that something else is not working as expected.

At the very least, it would be nice if it would produce an error, so you can catch it early. But it would also be nice to have a way to ensure a snap is tracking a certain channel, which works both when the snap is installed, and when it's not installed.

oot@test:~# snap version
snap 2.53.4
snapd 2.53.4
series 16
ubuntu 20.04
kernel 5.13.0-27-generic

Tags: maas
tags: added: maas
Revision history for this message
Paweł Stołowski (stolowski) wrote :

That's technically easy to change and I can see how this simplifies the scenario you described, but I fear that is a behavior change that may break someone, so not sure we will want to change this, to be discussed.

Changed in snapd:
status: New → Triaged
importance: Undecided → Low
importance: Low → Wishlist
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.