Delete E2EE Master Keys

What are the names of the master keys, so I can delete them?

The filename is the masterkey ID with a “.md” extension.

What’s a safe way to delete them?

If there will never be a way to delete them, why can’t we simply “Export” them? We store them safely, locally, and if we need them we import them. I’m no developer by any means. I have no idea how much work would go into something like that. I’m just tossing out an idea to overcome the safety issue.
I too have the orange bar on my Windoze client. I even uninstalled everything, on all devices, and removed registry entries from Windoze and deleted the files from Dropbox. Yet when I install the Windoze client, it still has the orange bar. I know I missed a file somewhere. I even used Revo Uninstaller to locate and remove all files. It missed it too.

2 Likes

For those that wish to completely remove the master keys, here are the steps to do so:
Export your data by selecting File/Export/JEX.
Under the General Tab in Options you will see a line that says Notes and settings are stored in:
Make Note of this and the Synchronization target on the next tab.
Select File/Quit to exit Joplin.
Delete or rename the Notes and settings are stored in: folder and the synchronization files Example:
~/.config/joplin.desktop and Dropbox/Apps/Joplin.
Restart Joplin. Verify that it opens with only the about documents. Your data should not be included.
Select File/Import/JEX and import your data.
Now you may reconfigure your Encryption and Synchronization settings as you wish.

5 Likes

Something else maybe worth remembering: when starting over again - having deleted/renamed old config folders and imported your jex backup. If you want to use encryption - set it up on one device only and wait for the other devices to fully sync and find the master key, then you can enter the password. If you attempt to set up encryption on two or more devices you end up with two or more different master keys.
If the fragment of the master key you can see in Encryption config on each device do not agree, you are dealing with more than one master key

6 Likes

I am indicating a +1 vote for the plea to identify ways to ease or avoid this problem because it just happened to me also, and I notice the frequency of postings appears to be increasing of people encountering this problem.

Perhaps it is because people are growing increasingly happy with Joplin, and using it for more and more notes on more and more devices (I know I am :slight_smile:). I now have joplin running on a mobile, on a home laptop, a work laptop, and a virtual machine. And I have been bitten twice now by (apparently) entering the encryption password on one of those devices before the appropriate time. I am going to try to go to the sync target, and remove the offending master key .md files, as Laurent suggests.

If the solution is robust, perhaps you could put a note in the FAQ and possibly in the encryption page indicating what to do to fix it.

Thanks,

Phil

3 Likes

I opted for Laurent’s ill-advised suggestion above of deleting the master key .md files directly from the Dropbox source (where I keep my sync content). It worked beautifully in the end but there are caveats and it can certainly be dicey. I just wanted to add my notes here for others who may want to try this in the future. Sorry for the length of this post, but this is a finicky process that I wanted others to be able to attempt.

Before you Begin:

  • Like Laurent warns, you could corrupt your entire note “database” doing this. You have been warned!
  • Only start this process if you are getting rid of ALL your master keys and starting fresh. If you are only removing some master keys, this will surely break more things than it will help.
  • There are objects that sync in the background BEYOND just notes. Especially when using mobile apps. So just because all of your notes are unencrypted doesn’t mean that all objects are unencrypted.
  • Ensure that ALL of your installations of Joplin have encryption successfully disabled before starting this. Double and triple check everything, re-sync multiple times, close and re-open the apps multiple times just in case. Especially on Windows, ensure you kill the background process too. Can never be too careful.
  • For added data integrity, export all your content from one of your installations before you begin in case something goes wrong.

My Process

  1. Disable encryption on ALL installations of Joplin. (See note about mobile apps in caveat below)
  2. Sync, re-sync, close, re-open, re-sync… do it a lot on all of them as it seems to take a bit to catch up with all the changes going on.
  3. Close and disconnect all the Joplin apps while changing the sync source. On mobile apps, make sure you Force Stop the app. On Windows, make sure you close the background process in the tray.
  4. Record the IDs of all the master keys from all of your Joplin installations. They are listed in the Encryption Settings. It’s good to know the passwords that match these keys too.
  5. Find the matching [masterkeyid].md files in your sync source location and MOVE them to a backup location. DO NOT DELETE them yet as you may need to put them back if anything goes wrong.
  6. Open ONE instance of Jopin and re-sync. Completely close that instance, open it again and re-sync again. This should remove the master keys from the encryption settings. Double check this.
  7. Once the above step is successful, repeat this for ALL Joplin instances BEFORE re-enabling encryption anywhere.
  8. After confirming all master keys are successfully removed and you can still read all of your notes, close all instances of Joplin once more.
  9. Choose one instance in which to re-enable encryption and create a single new master key. Re-sync and wait for ALL the notes to sync and stabilize.
  10. Open ALL other Joplin instances and re-sync. DO NOT re-enable encryption manually here as you will end up with multiple keys again. Wait for the sync to pull down the one master key and enter the password for each instance of Joplin.
  11. Once everything is synced and finalized you should be good to go with a single master key.

CAVEAT TO KEEP IN MIND ON MOBILE
I had uninstalled Joplin from one of my Android phones during this process assuming I could reinstall it fresh after everything was settled. However, it did not remove the saved data and settings when uninstalled. Thus on re-installing the app it brought back up some old settings and attempted to re-sync some background files using a master key that I was trying to remove. This forced the master key to be noted with an error saying that it was missing from the source. I thought I had hosed EVERYTHING at this point. Luckily, since I had saved the removed .md master key files, I was able to replace the master key in the content, unlock it with the password, and then successfully disable encryption again in the app. But then I had to clear everything out all over again and re-do a bunch of these steps. So if you remove Joplin from Android with this goal in mind, make sure you explicitly clear the data and cache first before uninstalling the app.

I know it is a lot of work, but for perfectionist types like myself (and likely any others who have searched into this topic), it is rewarding.

7 Likes

Could it be that the reinstalled Android app recovered its settings from Google Backup? Or was it from userspace storage left-over folder? (sdcard/Android/data..)

P.S. I did a factory reset on my SGS 7 and hoped Google Backup would actually restore settings of all my newly installed apps, but that did not happen :frowning: - most probably because I had Google Drive app disabled and Google Backup may rely on it (although it id not really complain at all).

Luckily for me, I had saved the password to the master key of Joplin so I did not have to go through the painfull process of manual removal (I do not encrypt my notes, just tried that at some point in the past).

It was most definitely the left over Android/data storage. I do not use Google Drive or Cloud backups. I believe the old practice of Android deleting stored user data when an app is uninstalled is no longer in play. I should have manually deleted the stored data before uninstalling the app.

The @markwdickson’s solution worked like a charm ! All masters keys deleted, re-sync now with only one key on all my devices.

Thanks !

1 Like

I made the following:

  1. Export all notes in JEX format.
  2. Delete “JoplinProfile” folder.
  3. Open Joplin and import all notes fom the JEX backup.
  4. Enable Encryption with a new master-key (different from those used before exporting backup in JEX).
  5. Sync, reopen Joplin several times, etc.

After that everything function well, except that the Joplin provides a message " Some items cannot be decrypted. Set the password". In the Status it indicates:
Encryption is: Enabled
Decrypted items: 1539 / 1541

So, there are 2 notes “not crypted”. The 1 note, according to the discussion above, is the .md fle for old master key. Indeed, I found this file among the files in Nextcloud folder. So, in theory I could just delete it from Nexcloud and after the next Sync it will be removed also from the Joplin local database.

However, the difference is 2 files (1539 - 1541). I wonder what is the second file? How it is possible to find the second “not encrypted” file and delete it? Or wheter the message " Some items cannot be decrypted. Set the password" could be supressed in the Joplin interface?

1 Like

Thank you for the advice, I had to do it twice at my desktop computer, my laptop and my mobile. After following your advice it finally worked.

Hey! Joplin is the best tool i have found for my notices and i love it. But this issue is not low prio. So many people have problems with multiple keys. Please implement something to avoid adding more than one password (i didnt notice this behaviour at the beginning) and/or it should be possible to delete keys. Please.

1 Like

In addition to what Laurent advises against mucking with beneath his “Otherwise:” comment…

…I found that in order to completely remove the yellow banner prompting for password entry, I also had to delete all files that were created and encrypted with the new master key (i.e., the Joplin initial “welcome” files) that I accidentally created when I setup a new Joplin desktop client on a new device.

THE FOLLOWING IS NOT RECOMMENDED, however these are the steps that I had to take to completely remove the new “offending” master key from my synchronized repository and all clients.

  1. I configured my sync utility to temporarily replicate my Joplin files to a folder on my laptop, where I could run grep, inspect the headers of the encrypted files, and remove all unwanted files.
  2. cd ~/<SyncDir>/Joplin
  3. Identify the OffendingMasterKeyID (32 hex chars) from the Joplin desktop app | Tools | Options | Encryption, based on the create time
  4. Check the timestamp: ls -l <OffendingMasterKeyID>.md and cat the file (replace the angle brackets and everything in between with the actual offending master key ID)
  5. Key step to remove the banner: search for other files encrypted with the offending master key: grep -l <OffendingMasterKeyID> *.md
  6. This should just show just a few *.md files, if this was the accidentally created key
  7. Remove the offending master key:
rm <OffendingMasterKeyID>.md
  1. Remove the files encrypted with the offending master key:
for f in `grep -l <OffendingMasterKeyID> *.md`; do echo $f; rm -f $f; done
  1. Once the files are synchronized with the target, and each device, then this will remove the offending master key .md file and all associated encrypted files from each device.
  2. On the new client device, the key was still referenced as Active (implying that new notes created on the device would be created with the “offending key,” even though the <key>.md file was removed from all clients.), so I simply nuked the Joplin desktop directory (rm -rf ~/.config/joplin-desktop) and reinitialized the client, this time taking care to only enter the master password after the first synchronization and prompt for the password for the one true master key.
2 Likes

Radical solution to remove the master keys that Joplin creates (Windows only)

  1. Save a backup copy in a JEX file, in, File - Export - JEX - Joplin Export File.

  2. Uninstall Joplin from all devices.

  3. Go to “C:\Users\User\AppData\Local\Programs” and check that the Joplin folder is no longer there.

  4. Go to this address “C:\Users\User” and delete the “.config” folder (you can pass a cleaning program like Glary Utilities).

  5. Go to the file hosting page you have, I have Nextcloud, and check “View hidden files”, bottom left in Settings. Enter the folder you created for Joplin and delete all files (leave 0 KB).

  6. Install Joplin downloaded again from the GitHub page.

  7. Go to Synchronization and choose Nextcloud, put the WebDav address and your Nextcloud username and password.

  8. Go to Encryption and Enable encryption, put a password that is not the previous one, and wait for the ID of the device where Joplin is installed to come out.

  9. Import the backup copy in, File - Import - JEX - Joplin Export File.

  10. Wait for the import to finish.

  11. It will be synchronized with Nextcloud.

  12. Do the same steps on other devices and put the encryption password where appropriate.

1 Like

Heh heh, so much hate, so little pull requests. Cmon guys if its so easy just put in a PR, its all javascript. :slight_smile:

That being said, this annoys me as well, but i understand with 198 open issues in github and an outstanding 61 PRs, the maintainers likely have their hands full. Additionally those of us enabling e2ee are a minority, and also the kind of people expected to submit PRs... just sayin

2 Likes

I’m on Ubuntu linux 18.04 / 20.04 and Android 9, using Dropbox for sync. After I accidentally deleted my Dropbox sync area I faced several problems, among them I also contracted the annoying message to update a missing master key.

I still definetely wish for a better way to handle master keys, but here’s how I started over (read it all before deciding to try or not):

  1. PC: File > Export > RAW to /local/backup/folder/of/choice/ (local to safely unencrypt for a while).

  2. PC: Backup everything (local folders, config files, exported notes - everything!)

  3. PC: Close Joplin and remove config folders: /home/user/.joplin/, /home/user/.config/Joplin/, /home/user/.config/joplin-desktop/

  4. Phone: Move to app settings for Joplin, clear data and cache.

  5. Phone: Uninstall Joplin (I restarted the phone, but that might not be necessary).

  6. Wipe sync area /Dropbox/Apps/Joplin/ and doublecheck that it really is empty (otherwise the next instance of Joplin might reuse some of the data, creating duplicates).

  7. PC: Reinstall Joplin, set sync to /local/sync/folder/of/choice/

  8. PC: File > Import > RAW from /local/backup/folder/of/choice/

  9. PC: Enable encryption, wait for the process to finish.

  10. PC: Change sync method to ‘Dropbox’, follow instructions and wait for the sync to finish! Depending on the number of notes, this process (and the previous) might be time-consuming.

  11. Phone: If 1-9 was successful, reinstall Joplin. Sync (and wait!), enter master password (and wait!).

  12. PC: Remove the now unnecessary unencrypted /local/sync/folder/of/choice/

Note: This method does lose version history, if that is important to keep you most likely have to tinker either with the database or the files on the sync area as described elsewhere in this thread.

3 Likes

I know this is an old topic, but it seems to still have activity, so I wanted to share. I had this same issue, having a key for a mobile device I no longer use that I did not have a password for. What I did to remove it is simply open the database and delete the record for the key I no longer wanted. All seems just fine.

2 Likes

Can you provide some details on how you did open the DB? Exactly where is the db located? What tool did you use to open the DB? And, what SQL did you use to delete the keys?

Thank you.