45

I'm using VS code installed via snap. The latest version has an annoying bug in it and I want to revert to the previous version, but I don't see a way to tell snap to install a specific version. All I see with snap info are the different channels which all yield to the latest version. Also on the Snapcraft website I can't select another version.

In the snap docs it says that I could revert, but this doesn't work for me, as there is no prior version installed.

I can download a snap with the specific version from the VS code website, June 2020 (version 1.47), but I personally would prefer to handle this by snap directly.

There seem to be some people with the same problem, but I didn't find a working answer:

The question summed up is: Is there a possibility to revert to an older snap version and if yes, how to do that?

1
  • Snaps are designed to auto-update to the latest version by design (a lot of devs want their users on the latest version). They do provide users multiple channels including having multiple channel versions installed (a form of version selection, but it's still different).
    – guiverc
    Aug 20, 2020 at 6:44

5 Answers 5

46

For example, installing older version of blender:

sudo snap refresh blender --channel=2.92/stable

How do you know what is the channel value?

snap info blender

will give you something like this:

snap info blender       
name:      blender
summary:   Blender is the free and open source 3D creation suite.

BLA BLA BLA BLA BLA

channels:
  latest/stable:     2.93.5  2021-10-06 (830) 205MB classic
  latest/candidate:  2.93.1  2021-06-23 (206) 205MB classic
  latest/beta:       2.93.0  2021-06-01 (161) 205MB classic
  latest/edge:       ↑                              
  2.93lts/stable:    2.93.5  2021-10-06 (830) 205MB classic
  2.93lts/candidate: 2.93.6  2021-10-25 (935) 205MB classic
  2.93lts/beta:      ↑                              
  2.93lts/edge:      ↑                              
  2.92/stable:       2.92.0  2021-02-25 (111) 196MB classic
  2.92/candidate:    2.92.0  2021-04-21 (134) 173MB classic
  2.92/beta:         2.92.0  2021-02-17  (95) 197MB classic
  2.92/edge:         ↑                              
  2.91/stable:       2.91.2  2021-01-20  (65) 193MB classic
[...]

and here is the magic line:

2.92/stable:       2.92.0  2021-02-25 (111) 196MB classic
2
  • 2
    Unfortunately this only works if there happens to be a channel with an older version of the application. But this isn't the case for some applications (e.g. snap-store).
    – bmaupin
    Nov 29, 2022 at 13:50
  • If you visit the store it also lists the channels (top right corner): snapcraft.io/blender.
    – TWiStErRob
    Sep 9, 2023 at 17:36
10

You can install specific old version in snap that is not the problem. Take a look at this answer for detailed instructions.

Your real problem is that snap repo for Visual studio Code has no old versions, just one latest version:

snap info code
2
  • 1
    Ok, so if vs code would provide old versions, there would be other channels like i.e. "1.47/stable", "1.46/stable" etc.? Aug 20, 2020 at 7:01
  • Yes that is correct. Aug 27, 2020 at 10:46
10

While the other answers are correct in the fact that with snap refresh you can only install those specific versions offered in snap info, that is not what you are actually looking for.

The latest version has an annoying bug in it and I want to revert to the previous version

By default, snap keeps two previous versions of every package cached on your system. Thanks to that, the answer to your problem of returning the snap code to its previous working version is as simple as this:

snap revert code

You can also list all locally available revisions of a snap package and choose which of them to revert to, see this answer.

2
2
# snap info lxd

channels:  
latest/stable:    5.14-7072c7b  2023-06-01 (24918) 178MB - 
latest/candidate: 5.14-7072c7b  2023-05-29 (24918) 178MB -   
latest/beta:      ↑                                         
latest/edge:      git-6bdccb9   2023-06-20 (25013) 181MB -
5.14/stable:      –                                      
5.14/candidate:   5.14-7072c7b  2023-05-31 (24918) 178MB -
5.14/beta:        ↑                                      
5.14/edge:        ↑                                      
5.13/stable:      5.13-8e2d7eb  2023-05-31 (24846) 174MB -
5.13/candidate:   ↑                                      
5.13/beta:        ↑                                      
5.13/edge:        ↑

                               

#  snap install lxd --channel=5.14/candidate

That is "snap info" gives you the list of available versions. To install specific version you should use the information from the first column. In this particular example i install "5.14/candidate" version

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jul 1, 2023 at 12:21
0

While the response given by heslant is generally accurate, noting that the snap list command presents only the two latest versions of a package, it's worth highlighting that a considerable number of cached snaps are actually retained (as pointed out in the linked source by him and by Milan Bojovic, although it haven't received adequate emphasis).

$ snap list lxd --all
Name  Version      Rev    Tracking     Publisher   Notes
lxd   git-5a1faae  25306  latest/edge  canonical✓  held
lxd   git-752650e  25381  latest/edge  canonical✓  disabled,held

In fact, I have the following .snaps in my system:

$ sudo ls -lah  /var/lib/snapd/snaps/
total 8.5G
drwxr-xr-x  3 root    root    4.0K Aug 21 22:07 .
drwxr-xr-x 23 root    root    4.0K Aug 21 18:20 ..
-rw-------  1 root    root    165M May  3 01:15 lxd_24758.snap
-r--r--r--  1 1000000 1000000 170M Aug 21 22:05 lxd_24817.snap <- transferred from other machine (May 3)
-rw-------  1 root    root    174M Jun 16 20:10 lxd_24988.snap
-rw-------  1 root    root    174M Jun 17 02:50 lxd_24994.snap
-rw-------  1 root    root    174M Jun 17 15:45 lxd_24999.snap
-rw-------  1 root    root    174M Jun 19 14:21 lxd_25003.snap
-rw-------  2 root    root    174M Jun 20 02:30 lxd_25009.snap
-rw-------  2 root    root    174M Jun 21 01:15 lxd_25013.snap
-rw-------  2 root    root    174M Jun 21 22:10 lxd_25027.snap
-rw-------  2 root    root    174M Jun 22 07:55 lxd_25042.snap
-rw-------  2 root    root    174M Jun 22 15:16 lxd_25050.snap
-rw-------  2 root    root    174M Jun 22 21:51 lxd_25056.snap
-rw-------  2 root    root    174M Jun 23 03:36 lxd_25063.snap
-rw-------  2 root    root    174M Jun 26 19:55 lxd_25075.snap
-rw-------  2 root    root    174M Jun 28 00:50 lxd_25092.snap
-rw-------  2 root    root    174M Jun 29 04:25 lxd_25097.snap
-rw-------  1 root    root    174M Jul  6 23:11 lxd_25128.snap
-rw-------  1 root    root    176M Jul  7 04:01 lxd_25136.snap
-rw-------  1 root    root    176M Jul  7 11:45 lxd_25144.snap
-rw-------  1 root    root    176M Jul  7 12:41 lxd_25154.snap
-rw-------  2 root    root    176M Jul 11 07:00 lxd_25186.snap
-rw-------  2 root    root    176M Jul 11 13:21 lxd_25197.snap
-rw-------  2 root    root    176M Jul 12 00:45 lxd_25224.snap
-rw-------  2 root    root    176M Jul 12 09:51 lxd_25228.snap
-rw-------  2 root    root    176M Jul 13 07:45 lxd_25234.snap
-rw-------  2 root    root    176M Jul 13 16:11 lxd_25239.snap
-rw-------  2 root    root    176M Jul 14 09:10 lxd_25246.snap
-rw-------  2 root    root    176M Jul 15 18:35 lxd_25253.snap
-rw-------  2 root    root    176M Jul 17 14:45 lxd_25269.snap
-rw-------  2 root    root    176M Jul 18 16:00 lxd_25285.snap
-rw-------  2 root    root    176M Jul 19 10:20 lxd_25292.snap
-rw-------  1 root    root    176M Jul 20 05:30 lxd_25306.snap
-rw-------  1 root    root    176M Jul 20 15:30 lxd_25313.snap
-rw-------  1 root    root    176M Jul 21 07:30 lxd_25319.snap
-rw-------  1 root    root    176M Jul 24 07:01 lxd_25332.snap
-rw-------  1 root    root    176M Jul 26 00:00 lxd_25345.snap
-rw-------  1 root    root    176M Jul 26 14:05 lxd_25357.snap
-rw-------  2 root    root    176M Jul 27 09:10 lxd_25364.snap
-rw-------  2 root    root    176M Jul 27 20:30 lxd_25371.snap
-rw-------  2 root    root    176M Jul 29 10:05 lxd_25376.snap
-rw-------  2 root    root    176M Aug  3 20:10 lxd_25381.snap
drwxr-xr-x  2 root    root    4.0K Apr 10  2020 partial

And the process of reverting is as straightforward as executing a single command:

$ sudo snap install  /var/lib/snapd/snaps/lxd_24817.snap
lxd git-49b9c78 from Canonical✓ installed
$ snap list lxd --all
Name  Version      Rev    Tracking     Publisher   Notes
lxd   git-5a1faae  25306  latest/edge  canonical✓  disabled,held
lxd   git-49b9c78  24817  latest/edge  canonical✓  held

And finally, we can stop auto-updating specific snaps issuing a command:

 sudo snap refresh --hold lxd

P.S. I have searched for this solution to restore a feature that was "fixed" in a recent release, and had a hard time searching for a previous version of snap. Ironically, it was right there, within arm's reach. However, automatic updates for this snap are currently not viable for me (at least for the time being).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .