Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot take screenshot on gnome 41 + wayland #1910

Closed
tim-hm opened this issue Sep 19, 2021 · 58 comments · Fixed by #1958 or #2035
Closed

Cannot take screenshot on gnome 41 + wayland #1910

tim-hm opened this issue Sep 19, 2021 · 58 comments · Fixed by #1958 or #2035
Labels
Bug It's a bug Upstream There's a problem with upstream code.

Comments

@tim-hm
Copy link

tim-hm commented Sep 19, 2021

Flameshot version
Flameshot v0.10.1 (d142888)
Compiled with Qt 5.15.2

Describe the bug
When running flameshot gui on gnome 41 + wayland nothing happens.

Output from running dbus-monitor --session sender=org.flameshot.Flameshot is here

To Reproduce
Install gnome 41 + wayland + Arch + flameshot, and then run flameshot gui in terminal

Expected behavior
The on screen gui should launch to take a screenshot

System Information

$neofetch --stdout
OS: Arch Linux x86_64
Host: Z390 AORUS PRO WIFI
Kernel: 5.14.6-zen1-1-zen
Uptime: 19 mins
Packages: 1160 (pacman), 4 (flatpak)
Shell: fish 3.3.1
Resolution: 3840x2160
DE: GNOME 41.0
WM: Mutter
WM Theme: Adwaita
Theme: Adwaita-dark [GTK2/3]
Icons: Adwaita [GTK2/3]
Terminal: tmux
CPU: Intel i9-9900K (16) @ 5.000GHz
GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590
Memory: 13319MiB / 64246MiB
@tim-hm tim-hm changed the title Cannot take screenhost on gnome 41 + wayland Cannot take screenshot on gnome 41 + wayland Sep 19, 2021
@mmahmoudian mmahmoudian added the Unconfirmed Bug The bug is not confirmed by anyone else. label Sep 20, 2021
@pashtet422
Copy link

same story on fedora 35, gnome 41 and wayland

@mmahmoudian
Copy link
Member

Ok, since we have two people with the same issue on two different distro, let's do some testing. I would appreciate if both of you file the steps and report back the output here:

  1. Open two terminals and keep them open
  2. In the first terminal run:
pkill flameshot
flameshot
  1. In the second terminal run:
flameshot gui

According to your posts nothing should happen, but you will see some output in the first terminal. Please provide us that output.

Additionally, @pashtet422 please provide the following:

  • Your Flameshot version
  • how have you installed it (compiling from source, RPM, Flatpak, Snap, ...)

@mmahmoudian mmahmoudian added the Waiting For Info Addressing the issue or merging the PR is halted and we are waiting for more info to be provided. label Sep 25, 2021
@ivocavalcante
Copy link

ivocavalcante commented Sep 25, 2021

Was about to add a "+1" on this, but executed your procedure above, and it worked. So, it's my understanding that, on order to flameshot gui to work, the daemon should already be running; is that so? Reading the docs, it wasn't clear - and I was under the impression that running flameshot gui would start a one-shot capture, regardless of the daemon.

Using latest stable Snap version, BTW.

@mmahmoudian
Copy link
Member

@ivocavalcante all flameshot gui does is to call DBus and ask the daemon to start in gui mode. Therefore if you want to have single command, you are better to call flameshot ; flameshot gui. As far as I understand, it is in the implementation that the flameshot gui starts the daemon if it is not already in the background. This behavior is definitely the case with the normal packages but I have not tried this with Snaps and Flatpaks.

@tim-hm
Copy link
Author

tim-hm commented Sep 25, 2021

Does it have anything to do with the dbus changes mentioned in this kooha issue?

@pashtet422
Copy link

pashtet422 commented Sep 27, 2021

1st terminal:

pkill flameshot
flameshot
QSettings::value: Empty key passed
QSettings::value: Empty key passed
QSettings::setValue: Empty key passed
QSettings::value: Empty key passed
QSettings::setValue: Empty key passed

2nd terminal:
nothing, but i received a system notification witch says "Unable to capture screen"

Flameshot v0.10.1
Compiled with Qt 5.15.2
Flameshot was compiled from source

@mmahmoudian
Copy link
Member

@pashtet422 Can you confirm that you are using Gnome and Wayland?

@pashtet422
Copy link

Yes, i'm using Fedora 35 with gnome 41.0 and wayland. Flameshot has been crashed after update from Fedora 34 to 35.

@pashtet422
Copy link

Upd: i've tried to recompile from source again and a problem still exists

@mmahmoudian
Copy link
Member

might be related to #1622 or #675

@borgmanJeremy
Copy link
Contributor

borgmanJeremy commented Oct 7, 2021

@mmahmoudian I reproduced this issue today on Fedora35, but it works on Fedora34. Given the other report about Gnome41 on arch, I think we should conclude Gnome41/ mutter made a change to the screenshot API.

Edit: I cant reproduce this on Arch with gnome 41....

From fedora:
image

I can reproduce this independent of flameshot:
image

@borgmanJeremy
Copy link
Contributor

Okay, I posted the details on the upstream package: https://bugzilla.redhat.com/show_bug.cgi?id=2009460

@mmahmoudian mmahmoudian added Bug It's a bug Upstream There's a problem with upstream code. and removed Waiting For Info Addressing the issue or merging the PR is halted and we are waiting for more info to be provided. Unconfirmed Bug The bug is not confirmed by anyone else. labels Oct 7, 2021
@borgmanJeremy borgmanJeremy linked a pull request Oct 11, 2021 that will close this issue
@borgmanJeremy borgmanJeremy reopened this Oct 12, 2021
@borgmanJeremy
Copy link
Contributor

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970

@saboya
Copy link

saboya commented Oct 16, 2021

@borgmanJeremy
Copy link
Contributor

@saboya Thanks, I added this to the README.

@mmahmoudian What are your thoughts on this. We have essentially two options.

  1. Keep this extension as a requirement going forward
  2. Switch to the public DBUS portal, but this requires users to click an allow prompt on each and every screenshot.

@ramottamado
Copy link

@saboya Thanks, I added this to the README.

@mmahmoudian What are your thoughts on this. We have essentially two options.

  1. Keep this extension as a requirement going forward
  2. Switch to the public DBUS portal, but this requires users to click an allow prompt on each and every screenshot.

Hello, I'm the author of said extension. Basically, that extension works by enabling unsafe_mode from Mutter global context (which you can always do from LG or from your own extension, just see the source code itself).

The problem is this mode is (surprise!) unsafe for end users, since this enable arbitrary code executions (just like ol' GNOME 3 days) by abusing Eval() dbus method.

Since security is a big issue, and nobody wants some rogue apps, scripts or extensions running malicious codes on their machine because an extension just open up the possibility to, I've since inactivated the extension, but you can still install the extension from the source code.

@mmahmoudian
Copy link
Member

mmahmoudian commented Oct 17, 2021

Thank you @ramottamado and @saboya for your input.

@borgmanJeremy This is indeed a dilemma which MacOS, iOS and Android have solved ages ago by asking user for certain permissions once and white listing that software for that permission. Tbh, to me it seems we are facing a monopoly that only the softwares Gnome wants can work without interruption and annoyance and all other softwares should face all sorts of challenge. Their excuse for changing DBus seems legit and I mostly agree, but due to bad implementation or their shortsightedness they immediately created a monopoly for their own applications which are hardcoded in the allow list (as Florian Müllner mentioned in the Gnome's gitlab repo.

Regardless, considering that the extension is inactivated, we have no choice but to go with the flow. I suggest that we implement a part that detects this situation, then we open a window for the user with enough text and link so that they know the faulty party is not Flameshot. I really don't know if we should point the finger to Gnome or Wayland, but nonetheless imho it is crucial that the user knows why they are getting spammed with popups and to know it is not bad design by us, but rather bad design by merge-request 1970 of gnome shell.

@yaayes
Copy link

yaayes commented Dec 25, 2021

Hi, Thanks for this tool it help a lot. I really missed it after I've upgraded from Fedora 34 to 35. I still can't use it even with the version v0.10.2

❯ flameshot --version
Flameshot v0.10.2
Compiled with Qt 5.15.2

OS:

OS: Fedora release 35 (Thirty Five) x86_64 
Host: NBLB-WAX9N M1230 
Kernel: 5.15.10-200.fc35.x86_64 
Resolution: 1920x1080 
DE: GNOME 41.2 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: gnome-terminal 
CPU: Intel i5-10210U (8) @ 4.200GHz 
GPU: Intel CometLake-U GT2 [UHD Graphics] 
Memory: 11916MiB / 15732MiB 

@mmahmoudian
Copy link
Member

@yajo @yaayes we just pre-released a new version (v11.0) and we will be testing it for the next few weeks. It would be nice if you can give it a try and see if you still have issues with running Flameshot.

@yaayes
Copy link

yaayes commented Dec 26, 2021

Hi @mmahmoudian, thanks for the working on this tool. It's a great tool. I just installed the pre-release, but the same error still occurred. I can help test this release until the issue is resolved, just ping me!

~ 
❯ flameshot --version
Flameshot v11.0.0 ()
Compiled with Qt 5.15.2

~ 
❯ flameshot gui
flameshot: error: The configuration contains an error. Falling back to default.
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
flameshot: info: Screenshot aborted.

@mmahmoudian
Copy link
Member

mmahmoudian commented Dec 26, 2021

@yaayes thanks for treating the new pre-release. Let's then get some more information from you to better understand the situation. Please tell us the following:

  1. How did you install it? (Using the rpm or snap or flatpak or AppImage it compile from source)
  2. What is exactly the issue you are expecting (basically what works and what doesn't work)
  3. Follow the following steps and let me know the output of terminals:
    • kill Flameshot (pkill flameshot)
    • open two terminals
    • in the first one run flameshot
    • In the second terminal run flameshot gui (I assume this is where things doesn't work for you)

@yajo
Copy link

yajo commented Dec 27, 2021

I installed https://github.com/flameshot-org/flameshot/releases/download/v11.0.rc1/org.flameshot.Flameshot-11.0.rc1.x86_64.flatpak directly.

I ran your commands. In 1st term:

> flatpak run org.flameshot.Flameshot
Qt: Session management error: None of the authentication protocols specified are supported

2nd terminal:

> flatpak run org.flameshot.Flameshot gui
Qt: Session management error: None of the authentication protocols specified are supported
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
flameshot: info: Screenshot aborted.

What happens under Wayland:

Captura.del.escritorio.de.27-12-21.09.25.59.mp4

@borgmanJeremy
Copy link
Contributor

Do you have xdg-desktop-portal installed?

@yajo
Copy link

yajo commented Dec 28, 2021 via email

@xvitaly
Copy link
Contributor

xvitaly commented Dec 28, 2021

And what about xdg-desktop-portal-gnome? It must be installed too in order to use the org.gnome.Shell.Screenshot interface:

A backend implementation for xdg-desktop-portal that is using various pieces of GNOME infrastructure, such as the org.gnome.Shell.Screenshot or org.gnome.SessionManager D-Bus interfaces.

@yajo
Copy link

yajo commented Dec 29, 2021

Also there:

> /usr/libexec/xdg-desktop-portal-gnome --version
xdg-desktop-portal-gnome 41.1

@gormih
Copy link

gormih commented Jan 3, 2022

Not affected.
Please reopen.

@mmahmoudian
Copy link
Member

@gormih

Not affected. Please reopen.

You lost me. What is not affected? Please add a sentence or two to clarify your point.

@gormih
Copy link

gormih commented Jan 3, 2022

@gormih

Not affected. Please reopen.

You lost me. What is not affected? Please add a sentence or two to clarify your point.

$ dnf list installed | grep xdg-desktop-portal
xdg-desktop-portal.x86_64 1.12.1-1.fc35 @updates
xdg-desktop-portal-gnome.x86_64 41.1-1.fc35 @anaconda
xdg-desktop-portal-gtk.x86_64 1.12.0-1.fc35 @updates
xdg-desktop-portal-wlr.x86_64 0.5.0-1.fc35 @updates

$ dnf list installed | grep flameshot
flameshot.x86_64 0.10.2-3.fc35 @updates

$ dbus-monitor --session sender=org.flameshot.Flameshot

signal time=1641208268.285705 sender=org.freedesktop.DBus -> destination=:1.126 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.126"
signal time=1641208268.285761 sender=org.freedesktop.DBus -> destination=:1.126 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.126"
method call time=1641208273.669242 sender=:1.130 -> destination=org.freedesktop.DBus serial=13 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.a11y.Bus',arg1=''"
method call time=1641208273.669455 sender=:1.130 -> destination=org.freedesktop.DBus serial=14 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameHasOwner
string "org.a11y.Bus"
method call time=1641208273.669650 sender=:1.130 -> destination=org.freedesktop.DBus serial=15 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.a11y.Bus'"
method call time=1641208273.669791 sender=:1.130 -> destination=org.freedesktop.DBus serial=16 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.a11y.Bus"
method call time=1641208273.669983 sender=:1.130 -> destination=org.a11y.Bus serial=17 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
string "org.a11y.Status"
string "ScreenReaderEnabled"
method call time=1641208273.670652 sender=:1.130 -> destination=org.a11y.Bus serial=18 path=/org/a11y/bus; interface=org.freedesktop.DBus.Properties; member=Get
string "org.a11y.Status"
string "IsEnabled"
method return time=1641208273.672612 sender=:1.130 -> destination=:1.127 serial=19 reply_serial=2
method call time=1641208273.675601 sender=:1.130 -> destination=org.freedesktop.portal.Desktop serial=20 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1641208273.680533 sender=:1.130 -> destination=org.freedesktop.DBus serial=21 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641208273.680583 sender=:1.130 -> destination=org.freedesktop.DBus serial=22 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.freedesktop.portal.Desktop"
method call time=1641208273.680762 sender=:1.130 -> destination=org.freedesktop.DBus serial=23 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.freedesktop.portal.Desktop"
method call time=1641208273.681027 sender=:1.130 -> destination=org.freedesktop.DBus serial=24 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.portal.Desktop',path='/org/freedesktop/portal/desktop/request/1_130/346812dcd6b742bd9805d96f6292e231',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1641208273.681061 sender=:1.130 -> destination=org.freedesktop.DBus serial=25 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641208273.681102 sender=:1.130 -> destination=org.freedesktop.DBus serial=26 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.freedesktop.portal.Desktop"
method call time=1641208273.681216 sender=:1.130 -> destination=org.freedesktop.portal.Desktop serial=27 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
string ""
array [
dict entry(
string "handle_token"
variant string "346812dcd6b742bd9805d96f6292e231"
)
dict entry(
string "interactive"
variant boolean false
)
]
method call time=1641208276.708830 sender=:1.130 -> destination=org.freedesktop.portal.Desktop serial=28 path=/org/freedesktop/portal/desktop/request/1_130/346812dcd6b742bd9805d96f6292e231; interface=org.freedesktop.portal.Request; member=Close
method call time=1641208276.709696 sender=:1.130 -> destination=org.freedesktop.Notifications serial=29 path=/org/freedesktop/Notifications; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method call time=1641208276.712065 sender=:1.130 -> destination=org.freedesktop.DBus serial=30 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641208276.712114 sender=:1.130 -> destination=org.freedesktop.DBus serial=31 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.freedesktop.Notifications"
method call time=1641208276.713197 sender=:1.130 -> destination=org.freedesktop.Notifications serial=32 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
string "flameshot"
uint32 0
string "flameshot"
string "Уведомление Flameshot"
string "Не удалось захватить экран"
array [
]
array [
]
int32 5000
method call time=1641208276.755435 sender=:1.130 -> destination=org.freedesktop.DBus serial=33 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641208276.755616 sender=:1.130 -> destination=org.freedesktop.DBus serial=34 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
string "type='signal',sender='org.freedesktop.portal.Desktop',path='/org/freedesktop/portal/desktop/request/1_130/346812dcd6b742bd9805d96f6292e231',interface='org.freedesktop.portal.Request',member='Response'"
method call time=1641208276.755653 sender=:1.130 -> destination=org.freedesktop.DBus serial=35 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641208276.755745 sender=:1.130 -> destination=org.freedesktop.DBus serial=36 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.portal.Desktop'"
method call time=1641208276.756105 sender=:1.130 -> destination=org.freedesktop.DBus serial=37 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
method call time=1641208276.756397 sender=:1.130 -> destination=org.freedesktop.DBus serial=38 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=GetNameOwner
string "org.freedesktop.Notifications"
method call time=1641208276.757379 sender=:1.130 -> destination=org.freedesktop.Notifications serial=39 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
string "flameshot"
uint32 0
string "flameshot"
string "Уведомление Flameshot"
string "Не удалось захватить экран"
array [
]
array [
]
int32 5000
method call time=1641208276.773226 sender=:1.130 -> destination=org.freedesktop.DBus serial=40 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.Notifications'"
signal time=1641208276.898188 sender=:1.130 -> destination=(null destination) serial=41 path=/; interface=org.flameshot.Flameshot; member=captureFailed
uint32 4269929705

@karshPrime
Copy link

I've tried to run a few other screenshot utilities, like: Shutter, maim and xfce4-screenshooter, and can confirm this is a Gnome issue and not flameshot issue.

@Maxzor
Copy link

Maxzor commented Jan 28, 2022

TL;DR, this is a complex topic regarding modern Gnome-shell, no one did a good job so far at reducing the complexity for the audience.

Can you please dear Flameshot developers try to sum up what is the issue with flameshot on gnome 41 wayland? I read this thread and it is still not quite clear, even if @mmahmoudian post helps:
Did gnome disallow access to DBus for others by default? [yes for a private API] Why in the hell would they do that? [for security] What technical challenges are there, where is this going? [see next paragraph] Flameshot is an awesome piece of software, and seing it work so bad on this setup is sad.

P.S. reading a bit more in this issue at Gnome-shell and this subsequent one at flatpak/xdg-desktop-portal, cannot you store in a gnome-keyring session the DBus authorization from a public gnome-shell API?

@mmahmoudian
Copy link
Member

mmahmoudian commented Jan 28, 2022

@TestingPlant
Copy link

A workaround for the permission prompt is by forking xdg-desktop-portal-gnome and simply removing the dialog. Here's a fork which does this.

Disclaimer: I maintain the above fork, and this solution likely won't work with sandboxing software such as Flatpak.

@adamwojt
Copy link

@TestingPlant
How to install on Ubuntu ?

@karshPrime
Copy link

@TestingPlant How to install on Ubuntu ?

sudo apt-get install flameshot should do it, or just look for flameshot on ubuntu's gui app-store

@mmahmoudian
Copy link
Member

@TestingPlant

How to install on Ubuntu ?

Please read this: https://flameshot.org/docs/installation/installation-linux/

@TestingPlant
Copy link

@TestingPlant How to install on Ubuntu ?

If you're asking about my fork, I don't support Ubuntu because it'd take a lot of time to backport and test my patch on all of the GNOME versions Ubuntu supports. If you have any more questions, make sure to ask on this issue tracker, not here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It's a bug Upstream There's a problem with upstream code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.