Firefox (from snap) on 22.04 LTS does not accept "--profile" argument

I run Firefox from multiple profiles, with scripts to invoke "firefox --profile " to select the particular profile directory. This has worked in every Ubuntu I have tried (MATE, Xubuntu, Lubuntu) as well as Debian, Mint and MX, but with MATE 22.04, Firefox won't accept the "--profile " command line param, gets the following error:

firefox_error

The command line and output follows. I don't know whether those "change mount namespace" errors are significant (what does libreoffice have to do with firefox)?

$ firefox --profile /remote/.config/.mozilla
update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/share/libreoffice/help /usr/share/libreoffice/help none bind,ro 0 0): cannot create directory "/usr/share/libreoffice/help": permission denied
update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/share/xubuntu-docs /usr/share/xubuntu-docs none bind,ro 0 0): cannot open directory "/var/lib": permission denied
Gtk-Message: 12:50:28.044: Failed to load module "appmenu-gtk-module"
Gtk-Message: 12:50:28.046: Failed to load module "canberra-gtk-module"
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.

It is a valid profile directory, in fact Palemoon (Firefox fork) has no trouble with it, as do Firefoxes on other aforementioned OSs. I guess I can use Palemoon as a workaround but would rather use Firefox if possible.

Welcome to Ubuntu MATE community @em_space !

Please report this bug to LaunchPad with

apport-bug firefox

and share its link here.

I've been messing with this, and it looks to be some file protection in either the new Firefox, or with Ubuntu, likely the latter, as I've been getting Firefox updates on 21.04 and it still works.

Normally one can start Firefox with "firefox -P" to manage profiles, creating, deleting, and setting to default. Previous to 22.04, you could create a profile anywhere you had read/write access. On Ubuntu 22.04, it apparently won't let you create a profile anywhere except within your home directory or /tmp. Nor will it read a profile from anywhere other than those places; you get the following:

firefox_error

I've tried this on the Live version as well as installed and get the same behavior.
Is there some new file protection in use here?

Hi, @em_space

I'm just another user here, but I will try to give some hints.

1 - You correctly pointed out, right in the Title of this topic, that you're using the Mozilla Firefox snap application in Ubuntu MATE 22.04 LTS ("Jammy Jellyfish").

2 - You also wrote that:

" (...) Previous to 22.04, you could create a profile anywhere you had read/write access. (...)"

I'm assuming that, before 22.04, you were using the ".deb" version of Firefox and NOT the snap version, am I right?

3 - And you also wrote that:

" (...) On Ubuntu 22.04, it apparently won't let you create a profile anywhere except within your home directory or /tmp. Nor will it read a profile from anywhere other than those places (...)"

Right. I believe that is related to Firefox being a snap application in Ubuntu 22.04 (and no longer a ".deb" application).

I've found the following related bug, reported 4 months ago (in April 2022) for Firefox in Ubuntu 22.04:

... which is marked as being a duplicate of another more general Bug (reported 4 years ago, in June 2018):

As far as I can tell, these issues are related to what is explained in the following web page, found in the Snapcraft documentation:

In that page it's pointed out in the first paragraph that:

" (...) The snap daemon (snapd) requires a user’s home directory ($HOME) to be located under /home on the local filesystem. This requirement cannot currently be changed. (...)"

The rest of that web page explains an workaround, which works by using a "bind mount":

" (...) However, it is possible to bind mount an alternative $HOME location to /home to allow other locations to be found by snapd. This process is outlined below.

:information_source: A bind mount allows a mounted filesystem to be accessible from more than one location at the filesystem level. This is unlike a hard or symbolic link, for instance, which operate as special additional files that point to a destination.

Bind mount home directories

There are two steps to bind mount a home directory to a different location:

  1. the bind mount: create the mount point and run the mount command:
$ sudo mkdir -p /home/$USER
$ sudo mount --bind <original-home-location> /home/$USER
  1. edit /etc/passwd: backup passwd and edit the home location for your user:
$ cp /etc/passwd passwd.backup
$ # sudo edit /etc/passwd with your favourite editor
$ cat /etc/passwd | grep $USER
  ubuntu:x:1000:1000:ubuntu,,,:/home/ubuntu:/bin/bash

The following awk command can be used to edit /etc/passwd (change OLD_HOME to your old home directory):

$ awk -vold=$"OLD_HOME" -vnew=$"/home/$USER" -F: ' BEGIN {OFS = ":"} \
  {sub(old,new,$6);print}' /etc/passwd > passwd.new
$ sudo cp passwd.new /etc/passwd

Log out and back in again, and snap will work from the freshly mounted home location. If you run into difficulties, copy the backup passwd file to /etc/passwd." (...)"

I hope this helps, in some way :slight_smile:

3 Likes

Just as side note UM22.04 here running the Firefox tarball and am at 104.0.1. To test I created a new profile on my desktop and it works. Just information if you need to control where you save it.

Second image is from download page. Version will change depending on when looked at.

Edit: Note above is not a snap. If trying save to a new folder other than Desktop as it will remove other items when you delete the profile.

3 Likes

Well, there it is. Not a bug, but a (mis)feature. Looks like it will be Pale Moon for me should I start using 22.04.

Also-- I tried (on 22.04) removing the snap version of Firefox and installing the .deb. It also wouldn't let me access or create a profile anywhere except my home directory, unless I didn't install the .deb version correctly.

You created a profile under your home directory (/home/mendy/Desktop), which works fine. Create a directory outside /home, give yourself write permission and try creating a profile there (press "Choose Folder" and navigate to the directory you created).

BTW - ricmarques: Thank you for the detailed information you posted; I never would have found it on my own! I tried duckduckgoing for "snap" and "home" and "firefox" but nothing significant turned up.

3 Likes

Just checking in images is this what you want me to do? Created new directory in file system outside of /home. Changed permissions, navigated to that folder and created a new profile which works.
ff1 is changed permissions on new folder
ff2 is new profile created there
Do note in my post I realize you are using snap and said the procedure was not a snap. (IE: using tarball version in place of snap)

3 Likes

I've switched to MX Linux; it doesn't use the snap firefox, and allows a profile from anywhere.
Ubuntu seems to be going the way of Apple and Microsoft in dictating just how you are allowed to use your computer. Hopefully MX will still allow choice going forward. I like their conky integration as well.

BTW - How can I mark this as "solved" in the subject line? I don't see a FAQ showing how.

Click on the green checkmatked box near the bottom of your post

1 Like