Ubuntu – Why is snap rstore failing with “expected a non-negative integer argument”

snap

I have tried to re-install a snap package and I want my settings back. I did a snap save before removing the snap. Now I am trying to restore the saved snapshot with snap restore and it's failing:

root@josh-workstation:/# snap restore lxd 1
error: invalid argument for snapshot set id: expected a non-negative integer argument (see 'snap help saved')

However I am following the instructions from snap help restore and snap help saved, so… what's the deal?

root@josh-workstation:/# snap help restore
Usage:
  snap restore [restore-OPTIONS] <snap> <id>...

The restore command replaces the current user, system and
configuration data of included snaps, with the corresponding data from
the specified snapshot.

Best Answer

snap help is backwards and the actual command takes the ID first

It should read:

root@josh-workstation:/# snap help restore
Usage:
  snap restore [restore-OPTIONS] <id> [<snap>]...

The restore command replaces the current user, system and
configuration data of included snaps, with the corresponding data from
the specified snapshot.

Running snap restore 1 lxd worked.

root@josh-workstation:/# snap --version
snap    2.44.3
snapd   2.44.3
series  16
ubuntu  18.04
kernel  5.3.0-51-generic
Related Question