karma-firefox-launcher
karma-firefox-launcher copied to clipboard
Firefox snap has no access to /tmp profiles path
When running Firefox as snap, he does't have access to the /tmp
directory and therefore firefox cannot load the profile. It was really hard to debug, because FIrefox doesn't fail to start in -headless
mode and therefore there is just a karma timeout.
FIrefox solves that by putting tmp files into ~/Downloads/firefox.tmp/
.
I did not understand the problem. Can you clarify and provide repro steps?
Repro: Install Firefox as snap (linux) and remove other installed Firefox. When running as snap, Firefox has very limited access to the filesystem, as described in the issue description.
Create a file in /tmp, say using xfce4-screenshooter
$ ls -l /tmp/Screenshot_2022-08-22_11-19-13.jpg
-rw-rw-r-- 1 me mygroup 87400 Aug 22 11:19 /tmp/Screenshot_2022-08-22_11-19-13.jpg
Try to open the file in Firefox
file:///tmp/Screenshot_2022-08-22_11-19-13.jpg
Reports the following
File not found
Firefox can’t find the file at /tmp/Screenshot_2022-08-22_11-19-13.jpg.
Check the file name for capitalisation or other typing errors.
Check to see if the file was moved, renamed or deleted.
Potentially firefox in a snap thinks /tmp is stored in ~/Downloads/firefox.tmp
firefox prevents access to folders like /var, /etc, /opt. but with /tmp it fakes it. Going to "/" does not show all directories either -- creating a root directory "/test", and even chmod/chowning to the user, does not update. This might be because firefox snapshots it on bootup?
Firefox does allow access to /var/tmp, which is updated.
It's inconsistent and not very well explained.
Any fix for this? Running into it in Karma+Firefox now, Ubuntu 22.04, Firefox 104.0.2:
What's your karma config for launching Firefox?
Hi. So this seems to be the issue I am facing after all.
Unfortunately it seems Firefox from apt is also broken to some extent, just differently so no longer a workaround :( https://askubuntu.com/questions/1435994/broken-mozilla-firefox-no-text-displays-font-issue
Would be really nice if https://github.com/karma-runner/karma-firefox-launcher/pull/47 could be fixed/merged.
Thanks in advance.
Would be really nice if #47 could be fixed/merged.
I went to go and update #47 for merging but I noticed we already have the profile
option for specifying the path to an existing profile. Is that enough? Or do we also need a profileName
option for loading a profile by name instead?
Many thanks for your reply. I confirm the profile option works correctly.
customLaunchers: {
'FirefoxHeadless': {
base: 'Firefox',
flags: [ '-headless' ],
profile: require('path').join(__dirname, 'tmp'),
}
},
I leave this as an exercise to a future reader to define a good, possibly random, location and clean up after test suite completes, if necessary. This should make us able to workaround this annoying bug that Ubuntu snap has.
Firefox does allow access to /var/tmp, which is updated.
Cheers for the workaround! I like to have my downloads saved to /tmp
, which I've been unable to do on Firefox snap, but /var/tmp
is the next best thing. :)