Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Thursday, January 16, 2020 at 14:49

Last night, I experienced power outage and my laptop has no battery when I was talking on Telegram Desktop on my Neon GNU/Linux operating system. When I turned my laptop on, my Telegram Desktop was in logged out state. It was locked by its own security system. But that means I cannot see chats & groups anymore. The ultimate thing is that my phone is broken so I also cannot access my Telegram Mobile account: I cannot read verification code sent by Telegram official. Fortunately, I managed to recover my Telegram Desktop successfully without phone at all by using my spare operating system in the same laptop. Perhaps you experienced an unfortunate state like me, so I share with you my recovery story below. I wish you can recover your account too!

Subscribe to UbuntuBuzz Telegram Channel to get article updates directly.

All about Telegram: Install Guide | Phone Number Recovery | GNU/Linux Communities |


1. Walkthrough


1. Run second operating system.
2. Run Telegram Desktop that is still normal in that second OS.
2. Open the partition where first operating system exists.
3. Run Terminal in Telegram/ folder in first operating system partition.
4. Run command line ./Telegram -many -workdir ../../.TelegramDesktop/
5. Now 2 different Telegram Desktop are running on the same screen: one normal (second OS) and one broken (first OS).
6. Login to the broken Telegram Desktop (first OS) with your Telegram's phone number.
7. The normal Telegram Desktop (second OS) will receive verification code.
8. Insert verification code to the broken Telegram Desktop (first OS).
9. Telegram Desktop is now fixed successfully.
10. Go back to first operating system and Telegram Desktop should work without asking for login anymore.

Picture 1.1
(Left: broken Telegram from first OS running from command line by using its own workdir | Right: normal Telegram from second OS, Trisquel, receiving verification code)

2. My Conditions


Before doing walkthrough above, note carefully that my conditions are as below:
  • I have 1 laptop.
  • I have 1 phone but it's broken I could not use.
  • I have 2 operating systems (dualboot) in 1 laptop.
  • I installed Telegram Desktop by official package from desktop.telegram.org.
  • I have Telegram Desktop installed in all my OSes. 
  • My first OS is KDE Neon, my second OS is Trisquel GNU/Linux.
  • My broken Telegram Desktop is in the first OS.
  • My Telegram Desktop in the second OS is still normal, I can see all my chats & groups.

In other words, although I do not have phone, I still have a spare normal Telegram instance that can run simultaneously with the broken one. It is the same as having one Telegram desktop and one Telegram mobile running simultaneously. If your condition is different, I'm sorry I do not know if you can perform the walkthrough at all.


3. Things You Need To Know


Every Telegram instance works with a work directory ("workdir"). So, see my case above, when power outage happened, that Telegram will lock itself, and this lock information is stored. Where? Yes, it is stored in that "workdir". If your Telegram executable file is located in directory ~/Downloads/Telegram/, then your workdir is located in directory ~/.TelegramDesktop/. If you have 2 OSes, then you have 2 different Telegram workdirs.

To put it simply, if that workdir says "LOCK" then your Telegram is broken, if it says "UNLOCK" then your Telegram is normal, in its own OS partition.

If you want to recover that broken Telegram, the secret is to run it as a separate instance from another OS but with its own workdir, to write "UNLOCK" into its own workdir. To do that, we need special command line ./Telegram -many -workdir [address_of_workdir] as stated above. When you go back to that Telegram, it runs normal again, and finally you can see all chats & groups just like before.


Picture 3.1
(Left: Trisquel file manager showing Neon OS partition in the directory where Telegram executable stored | Right: Trisquel terminal running the special command line with Neon OS's workdir)


Things To Learn


From this experience, I realized how important is to have laptop battery. Having one broken (like mine) is too dangerous. I wish you all to never experience broken battery nor broken Telegram account forever. Happy messaging!


My Gratitude


I would love to say big thank you to mostafa from Askubuntu.com that answered case like mine in 2017. Your answer saved my Telegram account that I use to teach GNU/Linux & Free Software in Indonesia. You have my gratitude!


This article is licensed under CC BY-SA 3.0.