Unable to delete snapshot if its name contains a plus sign '+'

After naming a snapshot “test+sign”, its removal is painful.
Here is the issue

lxc snapshot ct3 test+sign #OK

lxc delete ct3/test+sign # FAILED
Error: Failed to fetch snapshot "test sign" of instance "ct3" in project "default": No such object

It seems the plus sign gets ‘expanded’ and replaced by a blank character just before processing.

nasty workaround

  • lxd sql global ‘delete from storage_volumes_snapshots where name=“test+sign”’
  • lxd sql global ‘delete from instances_snapshots where name=“test+sign”’
  • then, … deleting the subvolume with BTRFS (or similar command for ZFS)
    • btrfs subvolume delete /POOL1/containers-snapshots/ct3/test+sign

That shouldn’t be too hard to fix. I believe we already had to deal with a few similar cases in the past.

Ah, actually, looks like we’re going to have to outright ban + in snapshot names as such snapshots are rejected by at least ZFS…

1 Like

Some years later… :wink:

Hi, after playing around with snapshots… I wasn’t able to delete a snapshot with a - in its name…

wolf@cloud:~$ incus info ubuntu2204
Name: ubuntu2204
Status: RUNNING
Type: container
Architecture: x86_64
PID: 93366
Created: 2023/10/09 10:48 CEST
Last Used: 2023/10/09 11:00 CEST
...
Snapshots:
+---------------------+-----------------------+----------------------+----------+
|        NAME         |       TAKEN AT        |      EXPIRES AT      | STATEFUL |
+---------------------+-----------------------+----------------------+----------+
| Ubuntu2204-20231009 | 2023/10/09 11:04 CEST | 0001/01/01 00:53 LMT | NO       |
+---------------------+-----------------------+----------------------+----------+


wolf@cloud:~$ incus delete ubuntu2204/Ubuntu2204-20231009
Error: Invalid instance name
wolf@cloud:~$

Maybe it makes no sense to use such long snapshot names, as the are enough infos in the info command… But how to remove it now?

Cheers Rüdiger

incus snapshot delete ubuntu2204 Ubuntu2204-20231009

Oh, yes. Thanks. Sometimes the 1st steps aren’t really easy. For example to reach an container with tcp port 8000 from the outside via port 7777. Difficult to know whats a network name. Is that the name of the bridge. Do i have to insert the remote ip of the server? The examples are showing the variables of the command, but not what they mean…

Greetings from nw germany…

This was my problem to delete…