Failed to run Firefox in headless mode under Ubuntu
Anyone succeed with running Firefox in headless mode under Ubuntu?
I tried:
firefox --headless --safe-mode -P headless https://quan.hoabinh.vn
but got this error:
[12545] Sandbox: CanCreateUserNamespace() unshare(CLONE_NEWPID): EPERM
- You are running in headless mode.
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
I installed Firefox as from "https://packages.mozilla.org/apt" repo.
Opaite Mbohovái (7)
Tried:
firefox --headless --safe-mode --profile ~/.mozilla/firefox-headless/ h ttps://quan.hoabinh.vn
but still not work.
And how do you recognize "not work"? Did the URL not get requested (probably telling by server logs)?
According to bugzilla.mozilla.org/1693011 the RenderCompositorSWGL log is expected to be printed; however it's not related to functioning or not. The browser says "You are running in headless mode." so you probably are?
Yes, I checked the Nginx logs on the server and did not see the requests. Also, tried with `--screenshot /tmp/screenshots/`, not see any files created in "/tmp/screenshots/".
And the profile is otherwise able to launch, remembers its settings between restarts from this path etc. when you run it repeatedly as:
firefox --profile ~/.mozilla/firefox-headless/ --no-remote --new-instance
and it's not getting stuck on some onboarding and similar?
Yes, this command
``` firefox --profile ~/.mozilla/firefox-headless/ --no-remote --new-instance ```
seems to remember its settings when I run repeatedly.
Since the profile launches normally and remembers its settings, have you tried running the same command with --headless added to that working profile command and checking whether the request then appears in the Nginx logs?
Hmh this works as expected on Darwin:
firefox --profile ~/tmp --no-remote --new-instance --headless --screenshot ~/tmp.png https://example.net
but I tried Ubuntu in CI (where we normally use Xvfb) and I don't see the file there: github.com/janbrasna/kitsune/actions/runs/31789959250/job/94734405121#step:2:10 — however checking logs the site got hit anyway, so YMMV: