Closed Bug 1766125 Opened 3 years ago Closed 2 years ago

[Snap] geckodriver cannot start Firefox when profile is located outside of users home directory

Categories

(Testing :: geckodriver, defect, P3)

defect
Points:
2

Tracking

(firefox102 fixed)

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: justinlindsaychapman, Assigned: jgraham)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

(Whiteboard: [bidi-m3-mvp][webdriver:external])

Attachments

(3 files, 1 obsolete file)

Attached image geckodriver_error_firefox.png (deleted) —

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0

Steps to reproduce:

Using python selenium geckodriver combination with ubuntu 22.04 lts, Python version 3.10.4, Selenium 4.1.3 and Geckodriver 3.1

Actual results:

Throws the error
Your Firefox profile cannot be loaded. It may be missing or inaccessible
It is not missing, it is not inaccessible, I am using it right now.
From what I know geckodriver creates a temporary profile if one is specified. I have tried specifying and using unspecified. Geckodriver is on PATH /use/bin and /usr/local/bin I have given full permission to both folders. This was working prior to upgrading to UBUNTU 22.04, the only difference with Firefox is that it is now a snap installation instead of a deb. I am extremely frustrated and have lost days trying to get this working . This effecting my work badly.

Expected results:

geckodriver should have opened a session window

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Adding to Snap tracker. You can consider to use Deb Firefox version from PPA (https://launchpad.net/~ubuntu-mozilla-security/+archive/ubuntu/ppa)

Blocks: snap
Priority: -- → P1
Flags: needinfo?(olivier)

@Martin Stransky. Thank you for the suggestion. I thought it important that this be looked at because out of the box the snap version of ff doesn't work with geckodriver. I did purge the package and installed the deb ppa and package. Things work properly with the deb version of the same browser. Thanks again for your reply.

This has also been reported at: https://github.com/mozilla/geckodriver/issues/2010

@JLChapman, is this an issue that started recently? Can you reproduce it with an older version of geckodriver? It would be good to know if a change in geckodriver or Firefox caused this broken behavior. It's the first time that we hear about that. Thanks.

Martin, could this be a dupe or related to bug 1763436? geckodriver creates the profile in /tmp so it means the profile is not located within the usual home folder.

Flags: needinfo?(stransky)

@Henrik Skupin, this started with the upgrade from Ubuntu 21.10 to 22.04, the from what I understand Canonical are trying to push all their packages as SNAP, it seems that this problem is specific to the SNAP version of firefox. I removed the SNAP version and forced the PPA for the deb version. Geckodriver now works the same way it did prior to upgrade.
So as far a I can see this is an issue that has started with the SNAP packaged firefox. I was able to reproduce over and over up until I removed the SNAP version.
Thank you for your reply.

bug 1763436 seems to be related but not the same issue as I was able to open firefox and use it, it was when using geckodriver that I had the error.

The problem is most likely that geckodriver wants firefox to use a temporary profile in /tmp, which the firefox snap cannot access because it is strictly confined.

That's indeed an unfortunate regression, let's see if a solution can be worked out on the geckodriver issue tracker.

Flags: needinfo?(stransky)

Thank you Oliver! That indeed would be a reasonable explanation for this issue. As listed in our documentation and also mentioned in the issue on GitHub you will have to set the TMPDIR environment variable to a location that the Firefox snap package can access.

We will discuss if there is something that we could do in geckodriver itself in our next weeks triage meeting.

Component: Widget: Gtk → geckodriver
Flags: needinfo?(olivier)
Priority: P1 → --
Product: Core → Testing
Summary: geckodriver can't open a session 'missing profile' ubuntu 22.04 → [Snap] geckodriver cannot start Firefox when profile is located outside of users home directory
Whiteboard: [webdriver:triage]
Version: Firefox 99 → unspecified
Status: UNCONFIRMED → NEW
Ever confirmed: true

@ Henrik Skupin, if indeed it is a permission related error maybe part of the procedure could be to have a more detailed warning/error so when it does arise it is easier to isolate a cause.
Thanks for you reply and input.

This adds a --profile-root argument to geckodriver that sets the
directory in which we create temporary profiles.

This helps workaround an issue with sandboxed Firefox
instances (e.g. those running on snap) where the /tmp inside the
sandbox and outside the sandbox are not the same. Users can set this
to a directory that's visible both in and out of the sandbox so that
both geckodriver and Firefox can access the temporary profile.

Assignee: nobody → james
Status: NEW → ASSIGNED
Blocks: 1750691
Whiteboard: [webdriver:triage]
Severity: -- → S3
Priority: -- → P3
Whiteboard: [bidi-m3-mvp][webdriver:external]
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/ddac654fd884 Update release notes to provide a workaround for snap-packaged Firefox, r=webdriver-reviewers,whimboo
Keywords: leave-open

I've updated the release notes for the 0.31.0 release on Github:
https://github.com/mozilla/geckodriver/releases/tag/v0.31.0

Points: --- → 2
Attachment #9276441 - Attachment description: Bug 1766125 - Rewrite the firefox binary path when geckodriver is used from within snap confinement → Bug 1766125 - Change the default firefox binary path when geckodriver is used from within snap confinement
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/autoland/rev/b398b0763482 Allow setting profile creation directory for geckodriver, r=webdriver-reviewers,whimboo
Regressions: 1769974

Comment on attachment 9276441 [details]
Bug 1766125 - Change the default firefox binary path when geckodriver is used from within snap confinement

Revision D146303 was moved to bug 1769991. Setting attachment 9276441 [details] to obsolete.

Attachment #9276441 - Attachment is obsolete: true

All related patches have been landed. As such closing as fixed. Thanks James!

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: