telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.23k stars 5.2k forks source link

Flatpak - Login impossible #27207

Closed powellnorma closed 10 months ago

powellnorma commented 10 months ago

Steps to reproduce

  1. Clean Environment
  2. flatpak install flathub org.telegram.desktop
  3. flatpak run org.telegram.desktop

Expected behaviour

  1. A QR Code should be shown/generated
  2. The "Or log in using your phone number" should screen work

Actual behaviour

  1. A QR Code should be shown, but instead it loads endlessly
  2. When using "Or log in using your phone number", after I have typed in the number I can't press "next" - Only a "clicked" animation is shown, but nothing happens at all

Note: Using the "native" version instead of the flatpak version works fine! I think it might have to do with Config Error: No 'Date' header received. - Thats the last thing that is getting logged, and similar to https://github.com/telegramdesktop/tdesktop/issues/26321 - And this is not logged for the "native" version.

Operating system

fedora 37

Version of Telegram Desktop

4.12.2

Installation source

Flatpak

Crash ID

No response

Logs

[..]
[2023.12.09 14:51:59] Config Error: No 'Date' header received.
ghost commented 10 months ago

Dupe of https://github.com/telegramdesktop/tdesktop/issues/27197?

ilya-fedin commented 10 months ago

Dupe of #27197?

27197 is about non-working 'keep disabled' button, I don't see any mention of the button here.

ilya-fedin commented 10 months ago

@powellnorma is it possible you have some system proxy settings? I bet the flatpak package can't read them due to being sandboxed.

ilya-fedin commented 10 months ago

Perhaps this is really a dup of #26321.

powellnorma commented 10 months ago

is it possible you have some system proxy settings?

No, that is not the case

ilya-fedin commented 10 months ago

No, that is not the case

Are you sure? Maybe you have set long time ago and forgot about that? Check env | grep -i proxy and the DE's proxy configuration dialog.

powellnorma commented 10 months ago

Are you sure

Yes.

env | grep -i proxy

Does not output anything.

I also can reach the internet fine when I do this:

flatpak enter org.telegram.desktop sh
curl https://telegram.org

I have tested it again, this time a QR Code got generated. But I am not sure how stable it is.. Seems like this bug only happens irregularly.

ilya-fedin commented 10 months ago

The error means the client is having problem with accessing the hard-coded DoH servers. It might be a problem with your ISP.

roworu commented 10 months ago

Just faced the same issue on latest Ubuntu 23.10 + flatpak and snap packages. What is strange - is that DEB package taken from here: https://launchpad.net/~atareao/+archive/ubuntu/telegram Works absolutely fine. As I can see, they are a bit outdated, could this signalize that Telegram recently switched to some logins servers, my ISP unable connect to?

ilya-fedin commented 10 months ago

Weird guess: maybe the server started to throttle the flatpak/snap api key? They use the same but unofficial API key.

yueguobin commented 10 months ago

I encountered the same issue where the QR code kept loading, and from the logs, I saw "Qt: Session management error: Could not open network socket". Therefore, I gave up on installing Telegram via Flatpak.

:~> flatpak run org.telegram.desktop 
Gtk-Message: 22:43:04.356: Failed to load module "canberra-gtk-module"
Qt: Session management error: Could not open network socket
QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
roworu commented 10 months ago

@ilya-fedin , Could you please advise on whether we should wait for the Telegram servers to stop throttling API keys for Snap/Flatpak, or should I contact the packagers? It's not very clear to me whom this issue should be addressed to. 😞

ilya-fedin commented 10 months ago

I'm one of the packagers. I don't have server developers contacts so I don't know regarding whether they will stop or not. What I know for sure is there's no way to fix it if it's really due to API keys. At least unless flathub/snapcraft CI owners would allow to provide secrets to hide the API keys.

Samirako3d commented 10 months ago

From Flatseal Enable D-Bass System Bus and it will work

hideki2k02 commented 10 months ago

From Flatseal Enable D-Bass System Bus and it will work

Tested on Fedora and its working flawlessly after doing this.

ilya-fedin commented 10 months ago

I don't think this can really help cause tdesktop doesn't use the system bus

wonka929 commented 9 months ago

I can confirm the same thing. Same Actual behaviour, fixed activating D-Bass System Bus from Flatseal.

This should be addressed BTW

ilya-fedin commented 9 months ago

I don't believe that. I would rather assume the fact you change settings helps rather than actual access.

wonka929 commented 9 months ago

Ok, what i know is just that i have changed that permission and now it works.

bristledev commented 9 months ago

Confirmed enabling D-Bus system bus with Flatseal fixes the login issue.

buser8303 commented 9 months ago

I'm not a very advanced Linux user, but is this bring any security implications? I compared system bus pcaps between flatpak with D-BUS system enabled and pcaps with telegram from pacman and it looks very similar. Can you please confirm that I don't exposure system more to flatpak with D-BUS system enabled in compare with telegram from pacman? Thank you.

ilya-fedin commented 9 months ago

You do exposure, the application has entire control on your system with such access and can run arbitrary commands via e.g. the systemd interface.

buser8303 commented 9 months ago

thank you. Interesting, since the version from pacman write to dbus the same messages, does it mean that this version by default can

"control on your system with such access and can run arbitrary commands via e.g. the systemd interface. "

? I just want to understand which version should I use, or it doesn't matter.

ilya-fedin commented 9 months ago

thank you. Interesting, since the version from pacman write to dbus the same messages, does it mean that this version by default can

Well, tdesktop code doesn't use system bus at all. So you're giving entire access to your system for nothing.

buser8303 commented 9 months ago

I'm not sure, I use "bustle" to listen system bus and both versions, pacman and flatpak writes there actively. ( to session and to system bus )

ilya-fedin commented 9 months ago

can you provide a record? tdesktop uses session bus, yes, but not system bus.

buser8303 commented 9 months ago

redacted for privacy reasons that's record right after I start telegram from flatpak ( the same from pacman )

ilya-fedin commented 9 months ago

@buser8303 why do you think it's telegram? these requests don't look related to telegram, maybe it's some system component doing in response to telegram launch?

buser8303 commented 9 months ago

hm, I didn't think this way, but maybe you are right. Strange that it still required to enable socket on "telegram" to make it work.

ilya-fedin commented 9 months ago

Well, I don't believe it's required. As I already said:

I would rather assume the fact you change settings helps rather than actual access.

Perhaps there's some bug in flatpak sandbox that makes it malfunction when there's no permission override. I can't explain this any other way.

buser8303 commented 9 months ago

perhaps, but so far it looks like no additional systembus calls were initiated by telegram, so I likely ok to just remove and use the version from pacman. Thank you.

ilya-fedin commented 9 months ago

what if you disconnect and reconnect to the network after Telegram start instead of giving permission?

fuomag9 commented 9 months ago

Can confirm, enabling system dbus fixed both the missing QRcode AND the login issue on a FRESH ubuntu 22.04 install

makgiber1984 commented 8 months ago

I have the same problem, I use LinuxMint 21.3 and there is no way to log in. The QR does not appear and neither does the phone number. The version of the Linux mint system is very outdated. I am new to Linux and I don't know how to do what you say about D-bass system bus? . Can you explain it? Thank you.

ilya-fedin commented 8 months ago

Please try this

what if you disconnect and reconnect to the network after Telegram start instead of giving permission?

makgiber1984 commented 8 months ago

It doesn't do anything by disconnecting the network either....

ilya-fedin commented 8 months ago

Hmm, a person from #27450 said it helps..

makgiber1984 commented 8 months ago

Hmm, una persona de 27450 dijo que ayuda..

Thank you so much. Now it seems to be working, first opening Telegram offline, and then connecting it. Not the other way around.

Thank you.

dudeskeeroo commented 8 months ago

I may be wrong, but I suspect this happens because my nvidia drivers are shambolic after suspend/resume. I unloaded some modules and tried telegram again and the QR code appeared.

sudo rmmod nvidia_uvm nvidia_drm nvidia_modeset

I'm not sure which module is at fault, but I've been using this hack for many apps that fail after suspend, especially electron apps that need graphics acceleration.

victoria-n-w commented 8 months ago

can confirm, starting telegram while disconnected, and then connecting resutls in the QR code being shown.

Logs from running flatpak run org.telegram.desktop:

Gtk-Message: 22:18:42.824: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:18:42.824: Failed to load module "pk-gtk-module"
Gtk-Message: 22:18:42.825: Failed to load module "canberra-gtk-module"
Gtk-Message: 22:18:42.825: Failed to load module "pk-gtk-module"
Qt: Session management error: Could not open network socket
QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
camgaertner commented 8 months ago

It seems broken still, why's this closed? Same for me:

Qt: Session management error: Could not open network socket
QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
ilya-fedin commented 8 months ago

@camgaertner there's an open issue about that. I don't remember its number though.

ilya-fedin commented 8 months ago

Hmm, a person from #27450 said it helps..

Here it is

camgaertner commented 8 months ago

Hmm, a person from #27450 said it helps..

Here it is

Not sure if the issue is the same, but symptoms are similar.

In this issue, we are all getting this very suspicious network-related error:

Qt: Session management error: Could not open network socket

but the linked issue doesn't have it. Anyways, I'll follow the other issue, thanks for the info.

ilya-fedin commented 8 months ago

Qt: Session management error: Could not open network socket

This means Qt is unable to connect to the session manager. That's quite expected given that flatpak blocks access to XSMP.

ong-andrew commented 8 months ago

Another solution:

  1. Uninstall the flatpak version
  2. Install the snap version
  3. Run telegram-desktop
  4. Wait forever for it to load
  5. Once logged in, goto Settings -> Advance -> Enable OpenGL rendering (uncheck this)
  6. Restart telegram-desktop

Viola!