Score:8

How do I install Firefox in WSL, when it requires snap, but snap doesn't work?

us flag

so I wanted to install firefox in WSL2 with Ubuntu. Now, using

sudo apt install firefox

gives me this output:

Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  firefox
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 72.3 kB of archives.
After this operation, 261 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 firefox amd64 1:1snap1-0ubuntu2 [72.3 kB]
Fetched 72.3 kB in 0s (420 kB/s)
Preconfiguring packages ...
Selecting previously unselected package firefox.
(Reading database ... 24109 files and directories currently installed.)
Preparing to unpack .../firefox_1%3a1snap1-0ubuntu2_amd64.deb ...
=> Installing the firefox snap
==> Checking connectivity with the snap store
===> System doesn't have a working snapd, skipping
Unpacking firefox (1:1snap1-0ubuntu2) ...
Setting up firefox (1:1snap1-0ubuntu2) ...
update-alternatives: using /usr/bin/firefox to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/firefox to provide /usr/bin/x-www-browser (x-www-browser) in auto mode

Trying to launch firefox at this point will fail:


Command '/usr/bin/firefox' requires the firefox snap to be installed.
Please install it with:

snap install firefox

Once I run said snap command, I get this:

error: cannot communicate with server: Post "http://localhost/v2/snaps/firefox": dial unix /run/snapd.socket: connect: no such file or directory

Can anyone help me with this? I'm not a linux expert.

Score:13
ca flag

Quick answer:

Use your browser and look at:
https://ubuntuhandbook.org/index.php/2022/04/install-firefox-deb-ubuntu-22-04/

It says, in short (you might need to skip the first two if you already did those):

sudo snap remove firefox
sudo apt remove firefox
sudo add-apt-repository ppa:mozillateam/ppa

# Create a new file, it should be empty as it opens:
sudo gedit /etc/apt/preferences.d/mozillateamppa

# Insert these lines, then save and exit
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501

# after saving, do
sudo apt update
sudo apt install firefox # or firefox-esr
LightJack05 avatar
us flag
Worked like a charm! Though, won't snap also affect other packages? Having a PPA for firefox is well and good, but what about other stuff? Is there a way to get snap working?
Hannu avatar
ca flag
Sorry, can't tell about WSL. I also have purged snap / snapd from my Ubuntu - there are too many if:s and but:s involved in using them - I wholeheartedly believe the snap-people have some work to do to get software to work "normally" when packaged as snap:s; I won't be there "testdriving" it.
Score:7
vn flag

System doesn't have a working snapd, skipping

It looks like you may either:

  • Be on an older WSL2 release
  • Or haven't enabled Systemd on WSL2

Snap is now supported on Ubuntu on WSL2 by enabling the Systemd functionality as mentioned in my answer here.

However, consider whether you truly need this:

  • As mentioned in my answer there, enabling Systemd will create additional overhead that isn't always needed.
  • The Windows version of Firefox may be a better option (unless you truly need to test some Firefox functionality that is specific to Ubuntu or Linux-in-general).
  • The PPA mentioned in the other answer is a valid alternative as well.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.