Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Json files describing the snapshots messed up #313

Open
g0r3 opened this issue Sep 21, 2018 · 13 comments
Open

Json files describing the snapshots messed up #313

g0r3 opened this issue Sep 21, 2018 · 13 comments

Comments

@g0r3
Copy link

g0r3 commented Sep 21, 2018

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
Copy link
Author

g0r3 commented Sep 21, 2018

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.

@KillWolfVlad
Copy link

Arch Linux together with BTRFS

Same problem. Timeshift sometimes breaks info.json.

@ilya40umov
Copy link

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?

@g0r3
Copy link
Author

g0r3 commented Jan 5, 2019

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"
    ]
  }
}

@ilya40umov
Copy link

@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.

@fluffig
Copy link

fluffig commented May 20, 2019

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

@Helium314
Copy link

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

@ondrej17
Copy link

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?

@tuh8888
Copy link

tuh8888 commented Sep 29, 2021

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.

@canslaughter
Copy link

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.

@Anomalocaridid
Copy link

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.

@inverse
Copy link

inverse commented Nov 16, 2021

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

@wmutschl
Copy link

wmutschl commented Mar 1, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests