Recovering notes from KNotes

I see this post, but it has been automatically closed and I don’t see any way to re-open it:

Like several others, I am trying to recover my KNotes following KNotes’ removal. Of course if I had known KNotes was going away, saving the data would have been easy :slight_smile:

I’ve tried the import from Marknote. It doesn’t work (or find any notes to import).

I’ve looked for the files noted in the first post above. I don’t have “$HOME/.local/share/notes/”, but I do have “$HOME/.local/share/knotes/”. There don’t seem to be any relevant data files there. I’ve looked around using “find . -iname ‘*note*’” but I don’t see anything else relevant.

So I tried to retrieve the data from Akonadi Console, as described here:

There are some KNotes entries (id = 1 “text/x-vnd.akonadi.note” from mimetypetable), but my notes (or at least the main one I care about) are not found in the extracted data. I’ve done ‘strings’ and ‘od -c’ on it, but my note is not there as far as I can tell.

Anyone have any suggestions on how to recover my data?

I’m becoming a firm believer in storing stuff like this (or at least backups) in simple plain text :slight_smile:

  1. Try using the akonadiconsole
  2. Move to Kate, and use plain text or markdown, saved as files.

Yeah, I tried Akonadi Console, and extracted the data as described in the second link above (from Bogey Jammer on Stack Exchange). I do see recent entries in there (see below) but nothing that looks like the content of my notes. Perhaps the note bodies are now stored some different way in the database, but I didn’t see anything that looked like it.

5 1 Subject: List
Content-Type: text/html; charset=“utf-8”
Content-Transfer-Encoding: quoted-printable
Date: Tue, 18 Mar 2025 22:37:44 -0400
From: knotes@kde4
MIME-Version: 1.0
X-Cursor-Position: 471\

My main problem is not finding some other tool to use, but recovering my precious KNotes content :slight_smile:

To clarify, I guess the Stack Exchange suggestion doesn’t explicitly use Akonadi Console, but that’s what I used since I was already using it to see what I could see and it was convenient. I just did the extract using the DB Console tab.

SELECT pimitemtable.id, pimitemtable.mimeTypeId, parttable.data INTO OUTFILE '/tmp/outraw.txt' FROM pimitemtable JOIN parttable ON pimitemtable.id = parttable.pimItemId WHERE pimitemtable.mimeTypeId = 1;

Install KNotes:

zypper addrepo https://download.opensuse.org/repositories/KDE:Unstable:Applications/KDE_Unstable_Frameworks_openSUSE_Factory/KDE:Unstable:Applications.repo
zypper refresh
zypper install knotes

After restoring your notes save them with another application.

Thanks for all of your help and suggestions.

The first thing I did when I noticed that KNotes was gone was to install KNotes for TW from the KDE:Unstable repo you mention above. I also tried versions from several community repos:

https://software.opensuse.org/package/knotes

I installed KNotes from the KDE:Unstable repo again just now. When I try to launch KNotes, I get:

knotes: symbol lookup error: /lib64/libKPim6AkonadiNotes.so.6: undefined symbol: _ZNK5KMime7Content8contentsEv

I guess this is expected, since KNotes isn’t supported anymore. None of the other community repo versions I tried worked either.

I don’t see any differences in files when I do

find . -iname '*note*'

…and I also don’t see any differences when I look at Akonadi Console. I re-extracted the data from parttable, but there are no differences (ran ‘diff’). Since I don’t know how the bodies of the notes are stored, I don’t know where else to look.

I also tried Marknote import on KNotes again, but same lack of any imported data.

Is there anything else I can do, given that KNotes will not run?

Also to be fair, I haven’t installed the very latest updates (since March 18 or so). Do you think that would make a difference?

https://forum.artixlinux.org/index.php/topic,7255.0.html

Alright, I’m happy to report that I’ve successfully recovered all of my KNotes data. I will provide notes below in the hope that it may help someone else.

The version of KNotes I have installed now is 25.03.70, from the KDE:Unstable repo listed above. It doesn’t run. I don’t know which version(s) of KNotes I last had installed and under which I created my notes, but I used KNotes for many, many years (more than ten), and was using it until the latest updates that removed it. I never lost data (and still haven’t). I know there have been some changes over the years in how the data is stored. All I can tell you is what I observe from my own TW installed system. It appears that I have data stored under versions 12 and 25, based on the directory structure I see.

KNotes data is stored in the Akonadi DB and some files in the user’s home directory. The relevant entries have pimitemtable.mimeTypeId = 1. Each note has its own pimitemtable.id. parttable.partTypeId types 3, 5, 6, 7, and 8 are populated in my data. You can find descriptions in parttypetable.

Note names, for example, can be found in partTypeId 6 and 7.

The most relevant is partTypeId 5. This contains either the data for the note (MIME-encoded, I think), OR a filename in the user’s $HOME where the data is stored. I’m not sure what determines which way the data is stored – maybe the size of the note? How recently is was modified? Anyway, it’s stored in one of those two ways.

The file names, when the notes are stored that way, look like 12_r343 and 25_r309 on my system. I’m guessing the first part (12 and 25) is the KNotes version, and perhaps the other part is some revision number. Not sure, but it’s some unique filename.

Those files are found, on my system, in directories corresponding to the KNotes version under which they were originally created (I guess). In any case, for my most recent note that I care about the most, which was created under version 25, the data file 25_r309 is found here:

$HOME/.local/share/akonadi/file_db_data/25/25_r309

Your file names will of course differ, but the directory structure where they’re found should be the same.

I tried several ways of extracting the MIME-encoded data with utilities and other tools, but in the end I just ended up editing it by hand. It was simpler for those not steeped in MIME encoding :slight_smile:

1 Like

As a side note, given that I have confirmed that all of my KNotes data is still there on my system, it appears that the Marknote import function for KNotes is broken :grinning:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.