Firefox crashed, and got deleted

The firefox snap was working perfectly when I installed it sometime ago but during the past month it started crashing frequently (every 2-3 days), every time it crashed the filesystem got set to read only and I have to manually run the fsck to repair the filesystem thenreboot the system. But today when it crashed, I followed the same thing repairing the filesystem using fsck but when I reboot the system, the firefox didn’t get launched when I clicked at the icon.

Then I tried to launch it via command line, this was the output,

error: error running snapctl: cannot invoke snapctl operation commands (here "is-connected") from outside of a snap.
ERROR: not connected to the gnome-3-38-2004 content interface 

Then I tried snap list, the output was,

No snaps are installed yet. Try 'snap install hello-world'

After that I checked the status of snapd.service, it was not active then I started it using systemctl and it got activated successfully, but the result remained the same even after activating it, then I purged snapd and installed it again.

After that I executed snap install hello-world, first snap “core” was installed then after that the “hello-world” snap. The output of snap list,

Name         Version  Rev    Tracking       Publisher    Notes
core         16-2.58  14447  latest/stable  canonical**  core
hello-world  6.4      29     latest/stable  canonical**  -

The output of firefox,

Command 'firefox' not found, but can be installed with:
sudo snap install firefox  # version 109.0-2, or
sudo apt  install firefox  # version 1:1snap1-0ubuntu2
See 'snap info firefox' for additional versions.

Now,I think I did the worst by purging the snapd and my question is that do I have to reinstall firefox now (which I think I have to), but the folder /snap/firefox contains the following folders

2154, 2263, 2277, common, current

The size of /snap/firefox is 1.2 GB and the icon for the firefox is still there in the favourites.

This really looks like a hardware problem with your disk, have you checked your journal or dmesg for filesystem errors when you had these crashes ?

The “no snaps installed yet” error is usually pointing to a corrupted seed file (which is a text file on your filesystem that holds all info about installed snaps)

Thanks for replying ! I reinstalled firefox, and now it is working fine.