You are not logged in.
Hello,
I'm running arch 6.2.9 with xorg, i3 4.22, and firefox 111.0.1 as default browser.
I'm running almost identical systems on two machines -- laptop with integrated intel graphics and desktop with amd cpu and gpu.
I have recently started experiencing the following problem. If firefox is not already running, and I click on a link from an external app (discord, slack, etc), firefox doesn't open; a process starts, but there is no graphical output, and firefox does not respond further. I need to execute "killall firefox" several times before being able to open the browser again. This issue does NOT happen if firefox is already open.
I have tried the following fixes, without success:
https://bbs.archlinux.org/viewtopic.php … 2#p2093672;
https://bbs.archlinux.org/viewtopic.php?id=257535;
I have also tried replacing xdg-open with mimeo.
Has anyone been able to resolve a similar issue? Thanks!
[Solved] Currently using solution posted by @ache in #18. Hopefully bug will be fixed with next firefox update.
Last edited by cvmd (2023-04-18 09:44:34)
Offline
Remove xf86-video-intel if installed and make sure you launch your session correctly: https://wiki.archlinux.org/title/Xinit#xinitrc
Offline
Thanks for the suggestion; unfortunately it doesn't fix the issue.
I do not have xf86-video-intel installed on either of my machines (the intel or amd one).
I start i3 with the `exec startx` command from my .bash_profile.
My .xinitrc file is just a copy of /etc/X11/xinit/xinitrc with `exec i3` added to the bottom.
Offline
I click on a link from an external app (discord, slack, etc)
This means flatschpak stuff only?
Regular applications that don't run in a container work fine?
Is firefox itself a snapdockflatschpak installation?
pacman -Qs portal
My .xinitrc file is just a copy of /etc/X11/xinit/xinitrc with `exec i3` added to the bottom.
That's not possible, that xinitrc would then terminate at "exec xterm". Please post the actual file.
https://wiki.archlinux.org/title/Flatpa … g_to_start
--
Ifff this is not a flatschpak related situation:
Instead of clicking a link™, try
killall firefox # make sure all processes are gone
firefox https://www.archlinux.org
killall firefox # make sure all processes are gone
xdg-open https://www.archlinux.org
How does either behave?
Do you get some error messages?
Offline
Thanks. It's not only flatpak. For example, both firefox and Signal are installed with
pacman -S firefox signal-desktop
, and the issue exists with Signal links as well.
Here's the output of `pacman -Qs`.
ps1 ~> pacman -Qs portal
local/xdg-desktop-portal 1.16.0-1
Desktop integration portals for sandboxed apps
local/xdg-desktop-portal-gnome 43.1-1
A backend implementation for xdg-desktop-portal for the GNOME desktop environment
local/xdg-desktop-portal-gtk 1.14.1-1
A backend implementation for xdg-desktop-portal using GTK
ps1 ~> pacman -Qs firefox
local/dump_syms 2.2.0-1
Symbol dumper for Firefox
local/firefox 111.0.1-1
Standalone web browser from mozilla.org
Here's my .xinitrc:
#!/bin/bash
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec i3
Trying to open links from terminal works fine, with the following warning:
ps1 ~> killall firefox
firefox: no process found
ps1 ~> firefox https://www.archlinux.org
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
ps1 ~> xdg-open https://www.archlinux.org
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection
Additionally, if I set brave as my default browser, external links work fine with brave, and everything works as expected. Issue seems to be confined to firefox, and only when it is not already running.
Last edited by cvmd (2023-04-07 15:49:59)
Offline
local/xdg-desktop-portal-gnome 43.1-1
local/xdg-desktop-portal-gtk 1.14.1-1
Wild guess: since you're not on gnome, get rid of xdg-desktop-portal-gnome
(You'll only need one impl)
Also check the journal after failing to open a link and see whether some flatschpak/portal nonsense goes into a frenzy at this point.
Offline
Thanks -- I removed xdg-desktop-protal-gnome -- did not help.
I don't think it's a flatpak issue either. To make sure, I just removed flatpak entirely:
ps1 ~> sudo pacman -Runs flatpak
error: target not found: flatpak
and rebooted. Issue still persists. If I click a signal link and firefox is not already running, xdg-open spawns lots of firefox processes, but nothing happens on screen. I need to run `killall firefox` twice to be able to open it again.
Looking at jounrnalctl after clicking an external link (and breaking firefox) I don't see any new entries after the action of clicking on the link.
Offline
xdg-open spawns lots of firefox processes, but nothing happens on screen
Trying to open links from terminal works fine
If you launch the opening process (signal) from an interactive shell and then try to open a link, does that behave any better?
Offline
No luck -- opening signal from the shell and clicking on a link runs into the same issue.
Offline
Btw, as I noted, the issue does not happen if I set brave as my default browser.
To test, I just installed and set librewolf as default. The same issue happens with librewolf. It seems this is something related to how firefox-based browser interact with the rest of my system...
Offline
Fwwi, https://bbs.archlinux.org/viewtopic.php?id=284339
That doesn't explain why calling xdg-open isn't affected (what would make debugging this a hell lot easier)
stracing some fat client like signal is gonna be a PITA
What happens if you shadow ff w/ /usr/local/bin/firefox
#!/bin/sh
/usr/bin/firefox "$@"
(don't forget to chmod +x it and make sure /usr/local/bin is preferred in your $PATH)
Offline
No luck -- I placed the script above in /home/ps1/bin and placed this first in my $PATH. Issue persists.
ps1 ~> which firefox
/home/ps1/bin/firefox
I also downloaded xfce and the issue exists there as well, so it looks like it's not i3 specific...
I'm starting to think it's a firefox bug, as similar issues seem to crop up across distros as well:
https://superuser.com/questions/1770799 … -but-fails
Offline
"good" - let's upgrade the script a bit
#!/bin/sh
date >> /tmp/firefox.xdg.dbg # make sure that this script is actually invoked
echo $@ >> /tmp/firefox.xdg.dbg # and log the parameters
/usr/bin/firefox "$@" & # fork firefox
exit 0 # and exit w/ "success"
Offline
OK, so that's what happens when I click on a link twice (with a bit of waiting). Eventually I try to also start firefox normally and get the "Firefox is running but not responding" error.
I also tried to do the below by starting "/usr/bin/firefox --safe-mode" with identical results.
ps1 ~ [1]> cat /tmp/firefox.xdg.dbg
Sat 8 Apr 16:41:16 EEST 2023
https://archlinux.org/
Sat 8 Apr 16:41:34 EEST 2023
https://archlinux.org/
Sat 8 Apr 16:41:44 EEST 2023
Sat 8 Apr 16:42:06 EEST 2023
Offline
Try to explciitly import XAUTHORITY, USER & DISPLAY in that script:
https://gist.github.com/AladW/de1c5676d93d05a5a0e1
And run
/usr/bin/firefox "$@" > /tmp/firefox.more.dbg 2>&1 & # fork firefox and redirect output into a file
Offline
Thank you, that seems to have done the trick!
Any idea why these variables are not set by xdg-open / firefox as they should be?
Any chance I can set them somewhere else, so I can start firefox with default .desktop / bin files?
Thanks again!
Offline
First off all we should figure which and why they're not set and/or to what
#!/bin/sh
echo $XAUTHORITY - $USER - $DISPLAY >> /tmp/firefox.xdg.dbg
pid=$(pgrep -t tty$(fgconsole) xinit)
pid=$(pgrep -P $pid -n)
import_environment() {
(( pid )) && for var; do
IFS='=' read key val < <(egrep -z "$var" /proc/$pid/environ)
printf -v "$key" %s "$val"
[[ ${!key} ]] && export "$key"
done
}
import_environment XAUTHORITY USER DISPLAY
exec /usr/bin/firefox "$@"
The let's see
tr '\0' '\n' < /proc/$(pidof i3)/environ
Offline
Hello \o
I already reported the bug on Firefox 1 month ago.
Everything is here:
<https://bugzilla.mozilla.org/show_bug.cgi?id=1820896>
tldr: To fix the issue you have to edit /usr/bin/firefox and redirect stderr to /dev/null (or anywhere else, just redirect it).
Then, be sure that when you can xdg-open, you call first /usr/bin/firefox and not /usr/lib/firefox. You have to check /usr/share/application/firefox.desktop (there is multiple Exec line, be careful) AND ~/.local/share/application/...firefox...
The bug is also in Gentoo and is not reproducible with gnome-shell (¯\_(ツ)_/¯).
Should I open a bug in the Arch Linux bug tracker ?
PS: One my machine, the bug isn't related to environment variable (I think) but only about the redirection. I'm going to try the fix of @seth.
Last edited by ache (2023-04-09 07:00:11)
Offline
Redirection is indeed what fixes the bug!
I played around with @seth's suggestion and it's not actually setting the variables, but rather this line `/usr/bin/firefox "$@" > /tmp/firefox.more.dbg 2>&1 &` that fixes the issue. The part about setting variables is unneeded.
Now I'm just following @ache's solution of editing /usr/bin/firefox and /usr/../firefox.desktop.
Thanks again both @seth and @ache. This has been driving me mad for over a month! Hope the bug is fixed next firefox update...
I consider my question answered now.
Last edited by cvmd (2023-04-09 10:04:26)
Offline
This bug drive me crazy too ! Imagine when I understood that was the redirection of stderr that make it works ! ?
@seth: It seems that you may be more accustomed to this kind of bug. Do you have any suggestion about why a REDIRECTION of stderr can make a software works. ?
Tomorrow I will try to `strace` the firefox process but I'm not sure that it will be possible since `strace` will close stderr of the firefox process, doesn't it ?
Offline
This bug drive me crazy too ! Imagine when I understood that was the redirection of stderr that make it works ! ?
I haven't noticed this with firefox yet, but I had it some time ago with calibre. The issue may be that the stderr filedescriptor received is not writable / invalid / is not recognized correctly by the application and it is missing proper error handling for that case. Then the application may crash or hang while trying to write to it. If you redirect stderr you give the application a filedescriptor to another location that works.
Last edited by progandy (2023-04-09 16:33:46)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
The crazy part is that xdg-open works from a terminal, the calling client would have to close stderr independently from that and then it's affecting quite some clients who would all engange in the same behavior.
Failure on unexpectedly closed FDs is, as progandy suggested, not uncommon.
I'd be less surprised that FF stumbles over that (the mozilla bug suggests it's because of a gl testing subprocess) than the other clients (apparently) closing stderr (instead of redirecting it to /dev/null or similar)
To be sure:
firefox 2>&-
fails for you?
Offline
Nice @seth ! Thank you !
Thank you too @progandy, I think that is exactly what happens.
So no, `firefox 2>&-` doesn't. But :
firefox >&- 2>&-
Does hands. I have to close the two.
This is clearly an understanding in how the problem works.
Now I can use :
xdg-open https://ache.one >&- 2>&-
To trigger the bug exactly as if you had click from a Discord / Signal / Slack link ! That is the bug !
(You have to use `pkill firefox` or `killall firefox` multiple times before it called an alternative browser).
So “When stderr AND stdout are close, Firefox hangs (blocks itself)”. The two have to be closed. Can someone reproduces the bug from her/his side with :
xdg-open https://bbs.archlinux.org >&- 2>&-
? I will try to investigate further.
Last edited by ache (2023-04-09 19:33:26)
Offline
the calling client would have to close stderr independently from that and then it's affecting quite some clients who would all engange in the same behavior.
Those all seem to be electron clients, electron may just close all filedescriptors. (Edit: Looking at the code, that does not seem to be the case by default).
Maybe xdg-open should contain a code block like this to guard against closed FDs
if command -v perl >/dev/null 2>&1 ;
then
if ! perl -e 'use Fcntl; my $var=fcntl(STDERR, &F_GETFL, 0); ($var & (O_WRONLY | O_RDWR)) or exit(1);' ;
then
exec 2>/dev/null
fi
if ! perl -e 'use Fcntl; my $var=fcntl(STDOUT, &F_GETFL, 0); ($var & (O_WRONLY | O_RDWR)) or exit(1);' 2>&-
then
exec >/dev/null
fi
fi
Last edited by progandy (2023-04-09 19:55:30)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Those all seem to be electron clients, electron may just close all filedescriptors.
Indead, there are.
Offline