1

Snap automatic updates can now be disabled with $ sudo snap refresh --hold.

This can be seen in this other thread and this blog post and from the mouth of the horse itself.

My Ubuntu 22.04 is up to date but I get an error when running the command. Any idea why?

$ sudo apt update
...
All packages are up to date.

$ sudo snap refresh All snaps up to date.

$ sudo snap refresh --hold error: unknown flag `hold'

Daniel
  • 3,980
  • 4
  • 29
  • 36
  • 1
    There is no --hold option in snap AFAIK. Did you look at the man documentation? – FedKad Dec 21 '22 at 15:38
  • @FedKad: I did look at the man pages and there's no --hold option. But if you look at the linked thread there are answers there suggesting it's use. – Daniel Dec 21 '22 at 15:57
  • 1
    ... your "mouth of the horse" link describes it as "The new hold feature" so perhaps it is not available in your version? According to the roadmap it was added in 2.58, whereas Ubuntu 22.04 has 2.56.2 – steeldriver Dec 21 '22 at 17:10
  • @steeldriver: Ah, you're right! It's 2.58 in roadmap and I have 2.57.6 ($ snap --version). Strange that others are mentioning the use of --hold in relation to Ubuntu. Maybe they're using Ubuntu 22.10 or another distro but still dropping comments on AskUbuntu. – Daniel Dec 21 '22 at 19:32
  • @steeldriver: I'll accept your comment as an answer since it explains why --hold isn't working in 22.04. – Daniel Dec 21 '22 at 19:36
  • @Daniel I added an answer for the record – steeldriver Dec 21 '22 at 21:06
  • 1
    snap --version at Ubuntu 22.10 is snap 2.57.6 snapd 2.57.6. – FedKad Dec 22 '22 at 09:55

2 Answers2

2
sudo snap refresh snapd --edge

or if you don't have snapd installed as a snap:

sudo snap install snapd --edge

And after that --hold and --unhold flags will be at your service!

Daniel
  • 21
1

Quoting from the third link in your question:

Refresh hold

The new hold feature allows system administrators and end users to stop or postpone their snap updates for as long as necessary.

Searching around a bit, The snapd roadmap indicates that the refresh --hold feature was added in version 2.58. Meanwhile, Ubuntu 22.04 currently provides 2.56 at the latest:

$ apt policy snapd
snapd:
  Installed: 2.56.2+22.04ubuntu1
  Candidate: 2.56.2+22.04ubuntu1
  Version table:
 *** 2.56.2+22.04ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.55.3+22.04 500
        500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages

So, your version simply doesn't support the feature.


In Ubuntu 22.10:

$ apt policy snapd
snapd:
  Installed: 2.57.5+22.10ubuntu0.1
  Candidate: 2.57.5+22.10ubuntu0.1
  Version table:
 *** 2.57.5+22.10ubuntu0.1 500
        500 http://archive.ubuntu.com/ubuntu kinetic-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu kinetic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.57.4+22.10ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu kinetic/main amd64 Packages

So, even Ubuntu 22.10 does not have this option.

FedKad
  • 10,515
steeldriver
  • 136,215
  • 21
  • 243
  • 336