Yes, you can restart specific snap by using snap restart nameOfTheSnap command.
Thanks ā back then I have given up on this and just tried using the apt-repository of firefox instead, but this was also annoying because even after pinning the apt version, after every automatic update ubuntu would enable the snap version which does not work, requiring a manual apt update to make it work again ![]()
Anyways, because more snap-only programs have the same problem I wanted to re-try fixing this problem with snap itself. My home directory is really in /data (/data/johann) where /data is a different device than where /home is mounted. However /home/johann is still configured as my $HOME but /home/johann is just a symbolic link to /data/johann.
So I tried to solve the problem using: sudo snap set system homedirs=/data/ (tried both with and withou sudo), but after this, when I try to run e.g. firefox I get the error:
cannot perform operation: mount --rbind /data/ /tmp/snap.rootfs_fgX5Wd//data/: Permission denied
My snapd version is 2.67.1+24.04
Have you tried using a bind mount instead of a symlink?
I have given up again and went back to manually configuring installation from an apt repo, since I discovered that on top of all those problems snap installations of Firefox also make the settings show the message āYour browser is being managed by your organizationā preventing some changes which is absurd.
I cannot express how much I hate the way how Canonical forces snap on their users.
Some suggestions
- I hate that Canonical does not provide any current full browser (i.e. chromium/firefox based) via apt
- I hate how badly the firefox snap on Ubuntu is usable (with my workflows)
which ones are currently not working due to that message?
I cannot remember but I had several occasions where the only available option is snap (if the problem with the home directory exists, it prevents all snap apps from working, apparently), or where the apt version is MUCH older than the snap version. With Firefox there is the additional problem that even IF one jumps through all the hops of manually working around the snap limitations still in place, the Firefox profile looks like an āorganizational profileā where it is not possible for the user to change all settings. It is also not possible to user separate profiles with snap Firefox using the āāprofileā option. I did manage to get snap going using the bind mount workaround but I still decided not to use the snap version of firefox for these reasons. It feels just like on MS Windows getting limited like that and having things forced on users like that. If the whole snap fiasco continues like that I am really considering switching to a distro which does not force their users to use limiting and flawed solutions like that.
That message should only be shown when /etc/firefox has policies at the system level. Most people using the Firefox snap do not see that, so it could be worth looking there to see whats going on.
My entire LXD setup was down for a day due to this issue. Tried for 6 hours to fix it. Then I decided to migrate from LXD to Incus. Now I never have to touch Snapd again and I am happy.
root@random:~# snap refresh
error: cannot perform the following tasks:
- Run post-refresh hook of "canonical-livepatch" snap if present (run hook "post-refresh":
-----
Sorry, home directories outside of /home needs configuration.
See https://forum.snapcraft.io/t/11209 for details.
-----)
root@random:~# pwd
/root
But what if Ubuntu 24.04 server does not have any user at /home dir, only default root-user?
I resolved the issue and firefox works. Done in 4 steps.
sudo snap remove firefox
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt install firefox
sudo apt-mark hold firefox
This is the only viable option. Making a requirement to have a home directory in /home is ridiculous and obviously a huge bug.
You should just have set the system setting for it instead of switching to an unsupported browser (but that is indeed up to you ā¦)
https://snapcraft.io/docs/home-outside-home
(note this doc is linked several times from this thread already, but obviously people do not read all the posts indeed)
How many variables are needed to point to home? ā~ā exist, $HOME exist, every piece of software on Linux sorts out home dir location and only snap canāt. I call that a bug. Circumventing around it is not a solution and no one should accept such methods.
Not only you; and technical discussion around this issue by the various involved developers (as well as some insulting and unhelpful comments from community members) can be found at:
Perhaps it can be fixed eventually in some automatic way so you do not need to tell the various involved components that care for security about it manually without breaking the app isolation, but today there are only the two solutions that are documented on the doc page I linked above even though they might not be ideal or to your preference ā¦
The community had to create an entire LD_PRELOAD shim to capture apps that read the home dir straight from /etc/passwd, so, thereās certainly more than one variable even outside snaps. The latest versions of Java all do this, which gives them impressive bugs like opening your real home directory in the Swing UI without portals, but also impressive features like, breaking writing to their own config folders, and the environment variable for this is really easy to guess, export _JAVA_OPTIONS=Duser.home="$foobar".
(note this doc is linked several times from this thread already, but obviously people do not read all the posts indeed)
On this point I personally think itās overdue this thread gets locked, precisely because thereās a disproportionate amount of noise to usable results to the point people arenāt finding the answers despite them being here.
(And I do understand thereās edge cases that do still legitimately exist, but those edge cases also arenāt helped by being drowned out by noise either, new threads can be made where the topic isnāt covering 6 years of changes).
I would however we suggest we consider patching the link shown in the snapd error to the actual documentation if it hasnāt been adjusted already.