timeshift icon indicating copy to clipboard operation
timeshift copied to clipboard

Json files describing the snapshots messed up

Open g0r3 opened this issue 6 years ago • 13 comments

I am using Arch Linux together with BTRFS. For managing the snapshots I use timeshift. Today, after going back to earlier snapshots twice. But after the second time I noticed, that none of the snapshots was visible anymore. Starting timeshift via cli showed me following error messages:

/dev/sdb3 is mounted at: /mnt/timeshift/backup, options: rw,relatime,ssd,discard,space_cache,subvolid=5,subvol=/
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.586: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.586: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.587: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.587: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.588: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.588: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.589: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.589: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.590: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:6401): Json-CRITICAL **: 17:09:56.590: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
Device : /dev/sdb3
UUID   : f188b276-72df-4961-b99c-0aadd0268997
Path   : /mnt/timeshift/backup
Mode   : BTRFS
Device is OK
1 snapshots, 659.9 GB free

Num     Name                 Tags  Description  
------------------------------------------------------------------------------
0    >  2018-09-21_17-00-01  D                  

The last one was a snapshot immediately created after logging back in after reverting to an earlier snapshot.

On further investigation I found out, that all the json files in /mnt/timeshift/backup/timeshift-btrfs/snapshots/ don't contain any data: image

Is this a known issue? Can I use the old, still present snapshots with "fake" metadata json files in order to use them?

g0r3 avatar Sep 21 '18 15:09 g0r3

For completeness: Yes, the snapshots don't care about which json exactly is located in the folder. Just drop any json inside of the snapshot you need and you will be able to reuse it.

g0r3 avatar Sep 21 '18 16:09 g0r3

Arch Linux together with BTRFS

Same problem. Timeshift sometimes breaks info.json.

KillWolfVlad avatar Oct 09 '18 14:10 KillWolfVlad

I have just encountered the same issue (No snapshots are shown in UI, and cli tool reports a similar error):

sudo timeshift --list
/dev/sda3 is mounted at: /mnt/timeshift/backup, options: rw,relatime,ssd,space_cache,subvolid=5,subvol=/
E: JSON data must be UTF-8 encoded

(process:13850): Json-CRITICAL **: 22:32:06.748: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:13850): Json-CRITICAL **: 22:32:06.749: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:13850): Json-CRITICAL **: 22:32:06.749: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:13850): Json-CRITICAL **: 22:32:06.750: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
E: JSON data must be UTF-8 encoded

(process:13850): Json-CRITICAL **: 22:32:06.750: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed
Device : /dev/sda3
UUID   : 66688e50-6ae0-4a63-8fd7-534461d7c1ea
Path   : /mnt/timeshift/backup
Mode   : BTRFS
No snapshots on this device
First snapshot requires: 0 B

Is there any workaround for this? Should I just drop all of those snapshots manually? If so, how should I do it? If not, how can I recover them?

ilya40umov avatar Jan 04 '19 21:01 ilya40umov

It should be possible to create new snapshot. Then you can use the info.json from there. If not: here is one of mine. For me it worked just replacing the damaged json with a working one.

  "created" : "1544955020",
  "sys-uuid" : "46b1f5a5-00b4-4ce1-a181-dc815668c599",
  "sys-distro" : "arch",
  "app-version" : "18.9.1",
  "file_count" : "0",
  "tags" : "ondemand",
  "comments" : "",
  "live" : "false",
  "type" : "btrfs",
  "subvolumes" : {
    "@home" : [
      "@home",
      "839",
      "291924873216",
      "5621964800",
      "46b1f5a5-00b4-4ce1-a181-dc815668c599"
    ],
    "@" : [
      "@",
      "838",
      "18277564416",
      "239136768",
      "46b1f5a5-00b4-4ce1-a181-dc815668c599"
    ]
  }
}

g0r3 avatar Jan 05 '19 09:01 g0r3

@g0r3 thanks! I've created a snapshot from UI, copied and edited the info.json to other snapshots, and then deleted all of the old ones. However, I'm extremely curious as to why this happened in the first place. Is this a bug in Timeshift or btrfs? If it's the latter, then we might need to report it further, as I'm new concerned I used it instead of ext4 where I never had any situations like this.

ilya40umov avatar Jan 06 '19 19:01 ilya40umov

Me, I also have this issue using timeshift with btrfs snapshots. In March I freshly installed Linux Mint 19 (mate) and activated timeshift taking regularly snapshots of system volume as well as of the home volume. Now it is the second time that timeshift "loses" all information about its snapshots. The first time, which was about five or six weeks ago, it failed taking a snapshot and the whole system froze. After reboot the snapshots did exist in /mnt/timeshift/backup/timeshift-btrfs/snapshots but there were no more links to them in the directories snapshots-. I didn't check the info.json of the snapshots but deleted them all and started all over. Yesterday the system froze again when taking a snapshot. After reboot the snapshots were correctly listed by timeshift but the system froze again taking the next snapshot (I set it up to hourly snapshots). Today I started the system again, all snapshots available. With the next snapshot to take the system froze and after that one, the snapshots aren't listed anymore. I still have the symlinks in the interval directories but all the info.json are garbage. For now I deactivated timeshift as it's making the system more insecure than having no backup at all. Any solution or hint pointing to a stable setup would be appreciated!

--edit-- currently using timeshift v18.9.1 as delivered with LM19

fluffig avatar May 20 '19 11:05 fluffig

I just experienced a similar issue, apparently json files got corrupted. This was probably after a system crash that happend just before this issue, there is one empty log file with a timestamp that is close to the time of the crash.

I found no snapshots in the GUI, the log file of the boot snapshot contains 11 consecutive lines: E: JSON data must be UTF-8 encoded and later after the line Removing snapshots (incomplete): all 11 previously existing timeshift snapshots were removed completely (no way of just replacing some json files). One of the removed snapshots had a timestamp corresponding to the empty log file mentioned above, so I assume the problem was caused by the crash occurring while creating a snapshot.

Anyway, is there a way to keep timeshift from automatically (against the schedule!) removing all previous snapshots?

Using timeshift 19.08.1-3 on Manjaro 18.1.4

Helium314 avatar Dec 29 '19 08:12 Helium314

I experienced the same problem on Linux Mint 20 with Timeshift v20.03. The file info.json was corrupted, so I replaced it with the snippet given by @g0r3 (with some changes) and now Timeshift detects the snapshot. Obviously, it is a bug. Any progress on resolving it?

ondrej17 avatar Aug 30 '20 19:08 ondrej17

I also just experienced this bug. Not sure what lead up to it. I restored from a snapshot, rebooted, then deleted some other snapshots. One of them gave me an error that it didn't successfully delete. Using timeshift-autsnap, my system started to try deleting snapshots with corrupted info.json's but experienced read-only filesystem errors.

tuh8888 avatar Sep 29 '21 01:09 tuh8888

In my case, the Timeshift GUI (Linux Mint) failed to properly restore some files from a snapshot created using rsync mode. By researching the first error I came across with, I was able to find one of the missing files. Then I inspected the snapshot and the file IS there, intact. I know this because I compared it with the source code for that program and it matched perfectly.

I'm going to boot from another OS and try to rsync everything back together. Wish me luck.

canslaughter avatar Oct 02 '21 05:10 canslaughter

This happened to me (or at least I only noticed it) today. Timeshift also at some point automatically deleted my snapshots with the borked info.json files even though I could boot from them with GRUB and kept me from rolling back to a known good state after an update gave me black screens on login. So now I might have to do a fresh install if I can't find a different solution. Please at the very least make Timeshift show a warning by default instead of deleting the snapshots.

Anomalocaridid avatar Oct 22 '21 17:10 Anomalocaridid

Happened to me today and unfortunately lost all my snapshots. Do we know what the root cause of this is?

So the process to recover is:

  • to create a fresh snapshot
  • copy that info.json from the snapshot
  • modify it to match the correctness of the corrupted snapshots

inverse avatar Nov 16 '21 20:11 inverse

Maybe it is important to point out that even though the info.json file is corrupted, your snapshots and data are totally fine and okay! If you need to quickly restore something you can follow my restore steps for btrfs snapshots here.

wmutschl avatar Mar 01 '22 11:03 wmutschl