"firefox --version" problem when run via snap on Ubuntu
Categories
(Firefox Build System :: Third Party Packaging, defect)
Tracking
(Not tracked)
People
(Reporter: eggert, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0
Steps to reproduce:
This is Ubuntu 21.10 on x86-64. The "firefox" command is /snap/bin/firefox, which is a symlink to /usr/bin/snap. I am running snapd 2.53+21.10ubuntu1. The Firefox user agent string is "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0".
When I run the shell command "firefox --version" I get error messages. I'll also show my attempts to debug the situation from the shell.
As you can see from my debug info I do have a .bashrc file. This file is not executable and it shouldn't be executable as it's not intended to be a standalone command. It has worked just fine for decades, when I log in via Bash or run Bash in the usual way.
For what it's worth, the command /snap/firefox/912/usr/lib/firefox/firefox works fine.
I filed a bug report with Ubuntu here:
https://bugs.launchpad.net/bugs/1959845
and they said it's a bug with the snap packaging of Firefox and suggested I file a bug report here.
Actual results:
$ firefox --version
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
/bin/bash: /home/eggert/.bashrc: Permission denied
Mozilla Firefox 96.0.3
$ ls -l $HOME/.bashrc
-r--r--r-- 1 eggert eggert 420 Apr 25 2002 /home/eggert/.bashrc
$ env | grep en_US.utf8
LC_ALL=en_US.utf8
$ locale
LANG=C
LANGUAGE=
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8
$ /snap/firefox/912/usr/lib/firefox/firefox --version
Mozilla Firefox 96.0.3
Expected results:
"firefox --version" should output the line "Mozilla Firefox 96.0.3" with no other diagnostics.
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' 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
|
||
This is definitely unexpected. FWIW, I'm not seeing that here on my system running Ubuntu 21.10. And I do have a non-executable .bashrc
file in my home directory.
Are these /bin/bash: …
messages output on stdout, or stderr?
Updated•4 years ago
|
Reporter | ||
Comment 3•4 years ago
|
||
(In reply to Olivier Tilloy from comment #2)
Are these
/bin/bash: …
messages output on stdout, or stderr?
They are sent to stderr.
I tried to debug things a bit more. I can't use strace -f
because snap won't let you do that. There's a similar bug, though not the same one, if I run Firefox as root, which I can strace. Here's a bit of the debug output. The "cannot change locale" is coming from the Bash that's running /snap/firefox/912/snap/command-chain/desktop-launch, evidently because snapd doesn't do locales well. When running as root I don't get the .bashrc warning, perhaps because Bash is more paranoid as root.
$ sudo strace -f -o /tmp/tr firefox --version
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
mkdir: cannot create directory '/run/user/0': Permission denied
Mozilla Firefox 96.0.3
514-day $ grep -E '^45141 (exec|write\(2,)' /tmp/tr
45141 execve("/snap/bin/firefox", ["firefox", "--version"], 0x7ffc5c983fa0 /* 16 vars */) = 0
45141 execve("/snap/core/current/usr/bin/snap", ["firefox", "--version"], 0xc000178870 /* 16 vars */ <unfinished ...>
45141 execve("/usr/lib/snapd/snap-exec", ["/usr/lib/snapd/snap-exec", "firefox", "--version"], 0x19a06c0 /* 35 vars */) = 0
45141 execve("/snap/firefox/912/snap/command-chain/snapcraft-runner", ["/snap/firefox/912/snap/command-c"..., "/snap/firefox/912/snap/command-c"..., "/snap/firefox/912/firefox.launch"..., "--version"], 0xc0000da840 /* 40 vars */ <unfinished ...>
45141 execve("/snap/firefox/912/snap/command-chain/desktop-launch", ["/snap/firefox/912/snap/command-c"..., "/snap/firefox/912/firefox.launch"..., "--version"], 0x55d9044d2ce8 /* 42 vars */) = 0
45141 write(2, "/bin/bash: warning: setlocale: L"..., 73) = 73
45141 write(2, "/snap/firefox/912/snap/command-c"..., 127) = 127
45141 execve("/snap/firefox/912/firefox.launcher", ["/snap/firefox/912/firefox.launch"..., "--version"], 0x559687d6c9c0 /* 70 vars */) = 0
45141 execve("/snap/firefox/912/usr/lib/firefox/firefox", ["/snap/firefox/912/usr/lib/firefo"..., "--version"], 0x560f6e6433a8 /* 70 vars */) = 0
Reporter | ||
Updated•4 years ago
|
Comment 4•4 years ago
|
||
Note that snapd has an option to let you strace an application:
snap run --strace firefox --version 2> firefox.trace
Reporter | ||
Comment 5•4 years ago
|
||
(In reply to Olivier Tilloy from comment #4)
snap run --strace firefox --version 2> firefox.trace
Running Firefox that way causes it to not output the "/bin/bash: /home/eggert/.bashrc: Permission denied" message, so it'll be hard to debug that particular failure via this strace option. However, Firefox still outputs the "/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)" message, and perhaps we can debug that one. Here's a sample shell session that may help. /snap/firefox/912/snap/command-chain/desktop-launch
is a /bin/bash
script that appears to cause Bash to look in the wrong places for the en_US.utf8 locale. My system does have locale files in the right places, but apparently snap makes these files invisible.
$ snap run --strace firefox --version 2> firefox.trace
Mozilla Firefox 96.0.3
$ grep -m 20 -E '^(\[[^]]*] )?(exec|write\(2)|/locale/' firefox.trace
[pid 397378] execve("/snap/firefox/912/snap/command-chain/snapcraft-runner", ["/snap/firefox/912/snap/command-c"..., "/snap/firefox/912/snap/command-c"..., "/snap/firefox/912/firefox.launch"..., "--version"], 0xc00016c2c0 /* 87 vars */ <unfinished ...>
execve("/snap/firefox/912/snap/command-chain/desktop-launch", ["/snap/firefox/912/snap/command-c"..., "/snap/firefox/912/firefox.launch"..., "--version"], 0x560ac2702588 /* 88 vars */) = 0
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "/bin/bash: warning: setlocale: L"..., 73/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_COLLATE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US/LC_COLLATE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en.utf8/LC_COLLATE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en/LC_COLLATE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en_US/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/en.utf8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
$ ls -lL /usr/lib/locale/locale-archive /usr/share/locale/locale.alias
-rw-r--r-- 1 root root 9844704 Dec 17 01:55 /usr/lib/locale/locale-archive
-rw-r--r-- 1 root root 2996 Mar 31 2021 /usr/share/locale/locale.alias
Reporter | ||
Comment 6•4 years ago
|
||
Oh, and a couple more things. Using the C locale makes the setlocale message go away. The .bashrc message remains.
$ LC_ALL=C firefox --version
/bin/bash: /home/eggert/.bashrc: Permission denied
Mozilla Firefox 96.0.3
I have quite a few locale directories in my snaps, many of which lack en_US.UTF-8 and/or en_US.utf8 subdirectories. I don't know which directories are being used here so I'll try to list them all. My environment has LC_ALL='en_US.utf8'
but if I change it to LC_ALL='en_US.UTF-8'
I still get a diagnostic "/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)".
$ find /snap -name locale -type d -o -name 'en_US.*' 2>/dev/null
/snap/chromium/1895/usr/share/X11/locale
/snap/chromium/1895/usr/share/X11/locale/en_US.UTF-8
/snap/chromium/1878/usr/share/X11/locale
/snap/chromium/1878/usr/share/X11/locale/en_US.UTF-8
/snap/zoom-client/167/usr/lib/locale
/snap/zoom-client/167/usr/lib/locale/en_US.iso885915
/snap/zoom-client/167/usr/lib/locale/en_US.utf8
/snap/zoom-client/167/usr/share/X11/locale
/snap/zoom-client/167/usr/share/X11/locale/en_US.UTF-8
/snap/zoom-client/167/usr/share/locale
/snap/zoom-client/168/usr/lib/locale
/snap/zoom-client/168/usr/lib/locale/en_US.iso885915
/snap/zoom-client/168/usr/lib/locale/en_US.utf8
/snap/zoom-client/168/usr/share/X11/locale
/snap/zoom-client/168/usr/share/X11/locale/en_US.UTF-8
/snap/zoom-client/168/usr/share/locale
/snap/core20/1328/usr/lib/locale
/snap/core20/1328/usr/share/locale
/snap/core20/1270/usr/lib/locale
/snap/core20/1270/usr/share/locale
/snap/gnome-system-monitor/174/usr/share/locale
/snap/gnome-system-monitor/169/usr/share/locale
/snap/core/11993/usr/lib/locale
/snap/core/11993/usr/share/locale
/snap/core/12603/usr/lib/locale
/snap/core/12603/usr/share/locale
/snap/gnome-3-38-2004/87/usr/lib/locale
/snap/gnome-3-38-2004/87/usr/lib/locale/en_US.iso885915
/snap/gnome-3-38-2004/87/usr/lib/locale/en_US.utf8
/snap/gnome-3-38-2004/87/usr/share/X11/locale
/snap/gnome-3-38-2004/87/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-38-2004/87/usr/share/hunspell/en_US.aff
/snap/gnome-3-38-2004/87/usr/share/hunspell/en_US.dic
/snap/gnome-3-38-2004/87/usr/share/locale
/snap/gnome-3-38-2004/76/usr/lib/locale
/snap/gnome-3-38-2004/76/usr/lib/locale/en_US.iso885915
/snap/gnome-3-38-2004/76/usr/lib/locale/en_US.utf8
/snap/gnome-3-38-2004/76/usr/share/X11/locale
/snap/gnome-3-38-2004/76/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-38-2004/76/usr/share/hunspell/en_US.aff
/snap/gnome-3-38-2004/76/usr/share/hunspell/en_US.dic
/snap/gnome-3-38-2004/76/usr/share/locale
/snap/snap-store/558/usr/share/X11/locale
/snap/snap-store/558/usr/share/X11/locale/en_US.UTF-8
/snap/snap-store/558/usr/share/hunspell/en_US.aff
/snap/snap-store/558/usr/share/hunspell/en_US.dic
/snap/snap-store/558/usr/share/locale
/snap/snap-store/547/usr/share/X11/locale
/snap/snap-store/547/usr/share/X11/locale/en_US.UTF-8
/snap/snap-store/547/usr/share/locale
/snap/gnome-3-26-1604/104/usr/lib/aspell/en_US.multi
/snap/gnome-3-26-1604/104/usr/lib/locale
/snap/gnome-3-26-1604/104/usr/lib/locale/en_US.iso885915
/snap/gnome-3-26-1604/104/usr/lib/locale/en_US.utf8
/snap/gnome-3-26-1604/104/usr/share/X11/locale
/snap/gnome-3-26-1604/104/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-26-1604/104/usr/share/locale
/snap/gnome-3-26-1604/102/usr/lib/aspell/en_US.multi
/snap/gnome-3-26-1604/102/usr/lib/locale
/snap/gnome-3-26-1604/102/usr/lib/locale/en_US.iso885915
/snap/gnome-3-26-1604/102/usr/lib/locale/en_US.utf8
/snap/gnome-3-26-1604/102/usr/share/X11/locale
/snap/gnome-3-26-1604/102/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-26-1604/102/usr/share/locale
/snap/core18/2284/usr/lib/locale
/snap/core18/2284/usr/share/locale
/snap/core18/2253/usr/lib/locale
/snap/core18/2253/usr/share/locale
/snap/gnome-3-34-1804/77/usr/lib/aspell/en_US.multi
/snap/gnome-3-34-1804/77/usr/lib/locale
/snap/gnome-3-34-1804/77/usr/lib/locale/en_US.iso885915
/snap/gnome-3-34-1804/77/usr/lib/locale/en_US.utf8
/snap/gnome-3-34-1804/77/usr/share/X11/locale
/snap/gnome-3-34-1804/77/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-34-1804/77/usr/share/locale
/snap/gnome-3-34-1804/72/usr/lib/aspell/en_US.multi
/snap/gnome-3-34-1804/72/usr/lib/locale
/snap/gnome-3-34-1804/72/usr/lib/locale/en_US.iso885915
/snap/gnome-3-34-1804/72/usr/lib/locale/en_US.utf8
/snap/gnome-3-34-1804/72/usr/share/X11/locale
/snap/gnome-3-34-1804/72/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-34-1804/72/usr/share/locale
/snap/gnome-3-28-1804/145/usr/lib/aspell/en_US.multi
/snap/gnome-3-28-1804/145/usr/lib/locale
/snap/gnome-3-28-1804/145/usr/lib/locale/en_US.iso885915
/snap/gnome-3-28-1804/145/usr/lib/locale/en_US.utf8
/snap/gnome-3-28-1804/145/usr/share/X11/locale
/snap/gnome-3-28-1804/145/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-28-1804/145/usr/share/locale
/snap/gnome-3-28-1804/161/usr/lib/aspell/en_US.multi
/snap/gnome-3-28-1804/161/usr/lib/locale
/snap/gnome-3-28-1804/161/usr/lib/locale/en_US.iso885915
/snap/gnome-3-28-1804/161/usr/lib/locale/en_US.utf8
/snap/gnome-3-28-1804/161/usr/share/X11/locale
/snap/gnome-3-28-1804/161/usr/share/X11/locale/en_US.UTF-8
/snap/gnome-3-28-1804/161/usr/share/locale
Comment 7•3 years ago
|
||
I cant reproduce when not forcing a LC_ALL
my default being fr_FR.UTF-8
. Even completely chmod'ing 000 my ~/.bashrc
does not repro, I always have a correct version. Please note the warning
issued by bash
is on stderr
.
Even with LC_ALL=fr_FR.UTF-8
I get the warning about setlocale
.
Can you still repro? I'm not sure how much we can fix there
Comment 8•3 years ago
|
||
Please note setlocale
issues are also reported by other snap packages.
Comment 9•3 years ago
|
||
I'm going to close as invalid, this is completely unrelated to firefox and snap. Please reopen if it is still an issue.
Reporter | ||
Comment 10•3 years ago
|
||
I don't see how to reopen this bug report so I plan to file a new bug report. I am still seeing the problem with Ubuntu 22.04 LTS, Mozilla Firefox 102.0.1.
Updated•3 years ago
|
Comment 11•3 years ago
|
||
(In reply to Paul Eggert from comment #10)
I don't see how to reopen this bug report so I plan to file a new bug report. I am still seeing the problem with Ubuntu 22.04 LTS, Mozilla Firefox 102.0.1.
Could be useful if you replied to the needinfo from one month ago also? And as I mentionned, it's really not a bug on our side ...
Reporter | ||
Comment 12•3 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #11)
Could be useful if you replied to the needinfo from one month ago also?
Unfortunately I was at another location a month ago where I am not running recent Ubuntu, and I could not easily reproduce the problem until I returned to the original location.
it's really not a bug on our side ...
As I mentioned when I reported the problem to Ubuntu they said it wasn't a bug on their side and suggested I file a bug report here.
However, as I understand it, this is a problem with the snap packaging of Firefox not with Firefox per se. Do you happen to know who's in charge of Firefox's snap packaging? Assuming it is someone at Ubuntu, I'm inclined to file a followup bug report with Ubuntu.
Comment 13•3 years ago
|
||
(In reply to Paul Eggert from comment #12)
(In reply to Alexandre LISSY :gerard-majax from comment #11)
Could be useful if you replied to the needinfo from one month ago also?
Unfortunately I was at another location a month ago where I am not running recent Ubuntu, and I could not easily reproduce the problem until I returned to the original location.
it's really not a bug on our side ...
As I mentioned when I reported the problem to Ubuntu they said it wasn't a bug on their side and suggested I file a bug report here.
However, as I understand it, this is a problem with the snap packaging of Firefox not with Firefox per se. Do you happen to know who's in charge of Firefox's snap packaging? Assuming it is someone at Ubuntu, I'm inclined to file a followup bug report with Ubuntu.
Let's be clear: as mentionned, the setlocale issue is known and unrelated to us and happens with other snap packages, so I'd say it's a snapd-level issue (sandboxing?).
The .bashrc
seems to come from your system, I can't repro on a snap build as well.
Reporter | ||
Comment 14•3 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #13)
the setlocale issue is known and unrelated to us and happens with other snap packages, so I'd say it's a snapd-level issue (sandboxing?).
Yes, that sounds reasonable.
Is there a Mozilla or other bug report number for the setlocale issue? I can add info about it to the Ubuntu bug report I just filed about this.
The
.bashrc
seems to come from your system, I can't repro on a snap build as well.
Oh, I forgot to mention something that may well be relevant: I have ENV and BASH_ENV set to point to that file:
$ env | grep bashrc
ENV=/home/eggert/.bashrc
BASH_ENV=/home/eggert/.bashrc
Comment 15•3 years ago
|
||
(In reply to Paul Eggert from comment #14)
(In reply to Alexandre LISSY :gerard-majax from comment #13)
the setlocale issue is known and unrelated to us and happens with other snap packages, so I'd say it's a snapd-level issue (sandboxing?).
Yes, that sounds reasonable.
Is there a Mozilla or other bug report number for the setlocale issue? I can add info about it to the Ubuntu bug report I just filed about this.
I'd say https://github.com/snapcore/snapd/ ? But I dont know for sure
The
.bashrc
seems to come from your system, I can't repro on a snap build as well.Oh, I forgot to mention something that may well be relevant: I have ENV and BASH_ENV set to point to that file:
$ env | grep bashrc ENV=/home/eggert/.bashrc BASH_ENV=/home/eggert/.bashrc
Try unsetting those for testing ?
Reporter | ||
Comment 16•3 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #15)
I'd say https://github.com/snapcore/snapd/ ?
Yes, that's where I just just filed the Ubuntu bug report.
Try unsetting those for testing ?
Unsetting BASH_ENV
fixes the "Permission denied" diagnostic. The locale diagnostics remain.
Comment 17•3 years ago
|
||
(In reply to Paul Eggert from comment #16)
(In reply to Alexandre LISSY :gerard-majax from comment #15)
I'd say https://github.com/snapcore/snapd/ ?
Yes, that's where I just just filed the Ubuntu bug report.
Try unsetting those for testing ?
Unsetting
BASH_ENV
fixes the "Permission denied" diagnostic. The locale diagnostics remain.
Right, so it's not something that we can fix on firefox itself.
Comment 18•3 years ago
|
||
Since you mention you also see the issue on Chromium on the ubuntu bug you filed, I'm tempted to close this, I really dont see what we can do if it's a snap issue (not snap packaging mistake).
Reporter | ||
Comment 19•3 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #18)
I'm tempted to close this
Sounds good to me. If it turns out to be a Firefox issue (unlikely) I can circle back later.
Comment 20•3 years ago
|
||
Of course!
Updated•3 years ago
|
Comment 21•3 years ago
|
||
Just upgraded to ubuntu 22.04 LTS and as part of the upgrade my firefox binary was transitioned to a snap ... which doesn't work
I was able to make it work by running xhost + but this is not a viable long term solution.
It sounds like you shouldn't be closing this bug report yet.
Comment 22•3 years ago
|
||
(In reply to malcolmvincent from comment #21)
Just upgraded to ubuntu 22.04 LTS and as part of the upgrade my firefox binary was transitioned to a snap ... which doesn't work
That kind of statement is unactionable, so there is nothing we can do unless you are willing to share and document « doesn't work »
I was able to make it work by running xhost + but this is not a viable long term solution.
That sounds absolutely unrelated to the present issue, and I highly doubt it's related to Firefox or it's Snap packaging. But without any information, hard to really tell.
It sounds like you shouldn't be closing this bug report yet.
Please read the history, you will understand the present issue was just not one on Firefox side.
If you have an issue, please file a new bug blocking snap
meta-bug and make sure to Cc
me.
Description
•