Printing doesn't work in the Flatpak version of Firefox
Categories
(Core :: Widget: Gtk, defect)
Tracking
()
People
(Reporter: bleisebastian780, Assigned: jhorak)
References
(Blocks 1 open bug)
Details
Attachments
(4 files, 1 obsolete file)
20.95 KB,
text/plain
|
Details | |
48 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-release+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-release-
|
Details | Review |
898 bytes,
patch
|
pascalc
:
approval-mozilla-release+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Steps to reproduce:
I have opened a pdf with firefox and wanted to print it out.
Actual results:
Nothing was printed and I did not receive an error message.
Expected results:
Actually he should have printed
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Printing: Output' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•4 years ago
|
||
Thanks for reporting this!
When you try to print, does the print dialog appear at all? Does printing to PDF work?
Reporter | ||
Comment 3•4 years ago
|
||
Yes the print dialog appears and I can select a printer. When I press the print button, the dialog closes and nothing happens.
Printing in a PDF document works.
Comment 4•4 years ago
|
||
Can you try a standard Firefox build (e.g. from https://www.mozilla.org/en-US/firefox/browsers/) rather than a flatpak-packaged version with the same system and printer? It would be useful to know if it is specifically the flatpak environment that is the problem here.
Reporter | ||
Comment 5•4 years ago
|
||
I downloaded firefox from your link as a TAR, unpacked and started it and it prints perfectly.
I also tested ungoogle-chomium as fltpak and it also prints.
It is only the flatpak from firefox that does not print.
Comment 7•4 years ago
|
||
Seems like a pretty serious flaw in the flatpak Firefox configuration, but as that's not our primary distribution method at this point (AFAIK), I guess that makes it less critical for now.
Comment 8•3 years ago
|
||
Re-tested and this bug still exists in flatpak Firefox 91.0 as described. Anything I can test against this to shine more light on it?
Same problem here. Firefox 94 with Flatpak.
Using Debian 11, Gnome 3.38, Flatpak last version.
No way to print. Even if in Flatseal permissions, the Socket CUPS is enabled.
Please fix. Thanks!
![]() |
||
Updated•3 years ago
|
Assignee | ||
Comment 11•3 years ago
|
||
Part of the problem is in the freedesktop runtime's GTK which does not use the cups print backend module. The only options for the printers are "Print to LPR" and "Print to file" when enumerating printers[1]. This is not a case for the fedora runtime where the printing works.
It seems that the Firefox code is mixing two approaches to the printing:
- it directly asks cups for the printer lists to populate printers in Print dialog
- it uses gtk_print_job_new to start the printing task.
Since the gtk is missing cups backend the print name obtained from cups is not found in the gtk printer enumeration.
Currently the print portal we're trying to use is not working properly with the non system Firefox print dialog [2]. We should only use cups or make the cups gtk print backend available in the runtime.
from flatpak run org.freedesktop.Sdk//20.08
./usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/printbackends
./usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so
./usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/printbackends/libprintbackend-lpr.so
flatpak run org.fedoraproject.Sdk
[📦 org.fedoraproject.Sdk gtk-3.0]$ find /|grep printbackends
find: ‘/proc/tty/driver’: Permission denied
/usr/lib64/gtk-2.0/2.10.0/printbackends
/usr/lib64/gtk-2.0/2.10.0/printbackends/libprintbackend-cups.so
/usr/lib64/gtk-2.0/2.10.0/printbackends/libprintbackend-file.so
/usr/lib64/gtk-2.0/2.10.0/printbackends/libprintbackend-lpr.so
/usr/lib64/gtk-3.0/3.0.0/printbackends
/usr/lib64/gtk-3.0/3.0.0/printbackends/libprintbackend-cups.so
/usr/lib64/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so
/usr/lib64/gtk-3.0/3.0.0/printbackends/libprintbackend-lpr.so
/usr/lib64/gtk-4.0/4.0.0/printbackends
/usr/lib64/gtk-4.0/4.0.0/printbackends/libprintbackend-cloudprint.so
/usr/lib64/gtk-4.0/4.0.0/printbackends/libprintbackend-cups.so
/usr/lib64/gtk-4.0/4.0.0/printbackends/libprintbackend-file.so
flatpak run org.freedesktop.Sdk//21.08
[📦 org.freedesktop.Sdk gtk-3.0]$ find /|grep printbackends
/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/printbackends
/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/printbackends/libprintbackend-file.so
/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/printbackends/libprintbackend-lpr.so
I created issue on the freedesktop: https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/issues/1371
[1] https://searchfox.org/mozilla-central/source/widget/gtk/nsDeviceContextSpecG.cpp#247
[2] https://searchfox.org/mozilla-central/source/widget/gtk/nsDeviceContextSpecG.cpp#280
Comment 12•3 years ago
|
||
The quickest way to fix this before it will be handled in runtime (eventually) is to build libprintbackend-cups in org.mozilla.firefox.BaseApp. See example from chromium flatpak[0] (which is why chromium isn't affected by this issue as it was reported above)
https://github.com/flathub/org.chromium.Chromium/blob/master/org.chromium.Chromium.yaml#L68-L81
Comment 13•3 years ago
|
||
I have submitted a PR to the BaseApp: https://github.com/flathub/org.mozilla.firefox.BaseApp/pull/21
I will merge it soon, and we will be able to test on Friday whether beta version works correctly now.
Comment 14•3 years ago
|
||
I just tried 97.0b3 build from FlatHub Beta repo and could not printing output to a CUPS queue. Should I wait for another build to arrive?
Cheers, Joe.
Comment 15•3 years ago
|
||
The libprintbackend-cups.so is present in the correct location in the current beta build, so it must be something else this time.
[📦 org.mozilla.firefox ~]$ stat /app/lib/gtkmodules/3.0.0/printbackends/libprintbackend-cups.so
File: /app/lib/gtkmodules/3.0.0/printbackends/libprintbackend-cups.so
Size: 158560 Blocks: 312 IO Block: 4096 regular file
Device: 23h/35d Inode: 432063 Links: 3
Access: (0755/-rwxr-xr-x) Uid: (65534/nfsnobody) Gid: (65534/nfsnobody)
Access: 2022-01-05 15:55:33.298462740 +0100
Modify: 2022-01-05 15:55:28.257462622 +0100
Change: 2022-01-21 13:45:31.596967277 +0100
Birth: 2022-01-05 15:55:28.255462622 +0100
Comment 16•3 years ago
|
||
Just to be sure tested the 97.0b8 flatpak. Behavior still appears same as described for this bug:
There no error or print notification after print dialog is submitted from Firefox - the print job just disappears.
No job appears in the CUPS queue - which may not mean anything as I have noticed this can happen with other apps, even when printing is successful. The CUPS printing socket is enabled, as is devices = all for the Flatpak (using Flatseal). Print to PDF is working.
Comment 17•3 years ago
|
||
Printing using the Print System Dialog also fails in same way.
Assignee | ||
Comment 18•3 years ago
|
||
Yes, it's still the problem:
- the backend is installed but not enabled in GtkSettings, the default value is set during runtime build time to GTK_PRINT_BACKENDS which is
lpr,file
:
https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtksettings.c#L1009 - the
/app/lib/gtkmodules
is not in env var GTK_PATH, if it is the GTK check following paths:
/app/lib/gtkmodules/3.0.0/x86_64-unknown-linux-gnu/modules
/app/lib/gtkmodules/3.0.0/modules
/app/lib/gtkmodules/x86_64-unknown-linux-gnu/modules
/app/lib/gtkmodules/modules
To load the cups backend I had to add ~/.config/gtk-3.0/settings.ini
:
[Settings]
gtk-print-backends = lpr,file,cups
So far I was unable to use /app/etc/gtk-3.0
instead. With that the module is trying to be loaded, in my case it ended by
(firefox:1360): Gtk-WARNING **: 15:38:38.603: /usr/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /app/lib/gtkmodules/3.0.0/printbackends/libprintbackend-cups.so)
but that might be my wrong setup.
- in order to print from the firefox print dialog the
widget.use-xdg-desktop-portal.print
must be set to 0, the portal printing is not working ATM.
Comment 19•3 years ago
|
||
Perhaps the following fix from chromium is needed for ff as well: https://github.com/flathub/org.chromium.Chromium/blob/master/org.chromium.Chromium.yaml#L83-L89
Comment 20•3 years ago
|
||
Also "--env=GTK_PATH=/app/lib/gtkmodules" added to manifest, see https://github.com/flathub/org.chromium.Chromium/blob/master/org.chromium.Chromium.yaml#L11
Assignee | ||
Comment 21•3 years ago
|
||
Updated•3 years ago
|
Assignee | ||
Comment 22•3 years ago
|
||
Yes, this is also required, otherwise the module is not loaded. Created a pull request for the BaseApp: https://github.com/flathub/org.mozilla.firefox.BaseApp/pull/22
Assignee | ||
Comment 23•3 years ago
|
||
Added comment to clarify GTK_PATH settings
Depends on D138908
Updated•3 years ago
|
Comment 24•3 years ago
|
||
Comment 25•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Comment 28•3 years ago
|
||
Could this be backported to stable or beta?
The one change here only affects Flatpak packaging.
Assignee | ||
Comment 29•3 years ago
|
||
The fix is not complete, I'll continue to work on it when the org.mozilla.firefox.BaseApp
changes lands. Additional changes needs to be done to the the sources to have it fixed.
Updated•3 years ago
|
Assignee | ||
Comment 30•3 years ago
|
||
With the Firefox flatpak beta (instructions from: https://bryanquigley.com/posts/mindshare/firefox-beta-via-flatpak.html ) updated org.mozilla.firefox.BaseApp
and widget.use-xdg-desktop-portal.print = 0
I'm able to print from the flatpak. when started correctly:
flatpak run --socket=cups --env=GTK_PATH=/app/lib/gtkmodules org.mozilla.firefox//beta
I'm going to remove the print portal from the Firefox sources because it GTK is dealing with it for us.
Assignee | ||
Comment 31•3 years ago
|
||
We no longer need to use the print portal, the gtk is doing that for us
for the system print dialog and the native print dialog uses GtkPrintJob
which sends jobs to the cups print backend.
Comment 32•3 years ago
|
||
Comment 33•3 years ago
|
||
bugherder |
Comment 34•3 years ago
|
||
Would be nice if this could be backported to beta or stable.
Assignee | ||
Comment 35•3 years ago
|
||
Comment on attachment 9265339 [details]
Bug 1712555 Remove obsolete print portal; r=emilio
Beta/Release Uplift Approval Request
- User impact if declined: There's no impact because the patch affects only flatpak where it fixes the print problems.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): It's code removal of the non functional code, so I expect no risk and adding reqired flatpak permission to allow printing by using cups.
- String changes made/needed:
Assignee | ||
Updated•3 years ago
|
Comment 36•3 years ago
|
||
Comment on attachment 9265339 [details]
Bug 1712555 Remove obsolete print portal; r=emilio
Morphing into a mozilla-release request as our last betas were last week. We have already built our Release Candidate, I am keeping this one on my radar as a ride-along if we have reasons to build a RC2 before shipping 98.
Updated•3 years ago
|
Comment 37•3 years ago
|
||
Comment on attachment 9265339 [details]
Bug 1712555 Remove obsolete print portal; r=emilio
Approved as ride-along for RC2.
Updated•3 years ago
|
Comment 38•3 years ago
|
||
Comment on attachment 9265339 [details]
Bug 1712555 Remove obsolete print portal; r=emilio
Then patches don't apply to the release branch.
Updated•3 years ago
|
Comment 39•3 years ago
|
||
The first patch applies cleanly. Here's a better patch for uplift that doesn't need rebasing the second patch.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 40•3 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-release/rev/cceca38bb419
https://hg.mozilla.org/releases/mozilla-release/rev/16f88a38f453
Updated•3 years ago
|
Updated•3 years ago
|
Comment 41•3 years ago
|
||
Reproduced the issue on Firefox 97.0.1 flatpak on Ubuntu 20.04 with the info provided in Comment 0 and a sample pdf.
The issue is fixed on Firefox 98.0 flatpak on the same machine. Couldn't verify on Firefox 99 as there is no flatpak build available to install afaik.
Comment 42•3 years ago
|
||
This is not working with flatpak v99, in ubuntu (xorg) 22.04
No printers are visible. Printing with system dialog shows only the save pdf option.
Comment 43•3 years ago
|
||
When I uninstalled and reinstalled, it worked.
Description
•