Repair broken Firefox after power outages

Hey everyone,

So, I've had some power fluctuations at home recently, with a few cuts and sudden restarts that forced my system to reboot unexpectedly. I managed to repair the filesystem to some extent using fsck, but ever since then, Firefox has been acting up.

The problem is, whenever I launch Firefox, try to search something, or especially when I go into the settings, it freezes and crashes on its own, just closing out completely.

I’ve already tried completely removing Firefox and reinstalling it, but that didn’t fix anything. I even switched to other Firefox-based browsers like Waterfox and Firefox-ESR, and they have the exact same issue. Chromium, though, works just fine without any problems. Some friends on the forums suggested creating a new Firefox profile, but that didn’t help either.

From what I’ve looked into, it seems like Firefox and SQLite on my system might have gotten corrupted.
Right now, I really need to use Firefox, but unfortunately, it's just not working.

My question is: Is there any hope of recovering Firefox without having to reinstall the whole OS?

My system details:
- OS: FreeBSD 14.3-RELEASE-p2 amd64
- Filesystem: UFS
- SQLite3 version: 3.50.4 2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45ealt1 (64-bit)

I’d really appreciate any suggestions or advice you might have. Thanks in advance!
 
I actually had a similar problem on Linux before I switched to FreeBSD and ZFS. It might be the filesystem issue.

Specifically, ZFS has sync enabled, meaning it syncs everything to disk right away, and even if the power goes out, it'll sync everything to disk on next boot because it has a special queue.

On Linux, I had sync OFF with BTRFS, and it was nearly always corrupting my Firefox's SQL database on abrupt poweroffs.

UFS also doesn't sync immediately to disk, it flushes to disk periodically. If the power goes out before it flushes something to disk (or during the writes?), SQL database might get corrupted.

Chrome also uses SQLite, so I don't know why it works on Chrome. They might do it differently.
 
There are a few things I would try:
1) Clearing the startup cache. Type about:support in the address bar and find the button in the top-right box.
2) Completely deleting $HOME/.mozilla and letting Firefox recreate it.
3) Check for damage in any other packages pkg check -as
4) Delete files from $HOME/.cache that may be part of the problem
 
There are a few things I would try:
1) Clearing the startup cache. Type about:support in the address bar and find the button in the top-right box.
2) Completely deleting $HOME/.mozilla and letting Firefox recreate it.
3) Check for damage in any other packages pkg check -as
4) Delete files from $HOME/.cache that may be part of the problem

I've already tried all of these steps. I completely removed every Firefox-related file from my system, reinstalled it, but it didn't help.

Also, when I ran pkg check -as, the only output I got was:

Code:
Checking all packages: 100%

No errors or warnings were shown.
 
The fact that all Firefox based browsers have the same/similar issue imply a library used.
Are you starting it from a term window or clicking on a menu item? Try from a term window, there may be a breadcrumb somewhere.
also from a term window, try starting in safe mode (I think --safe-mode) that may also give breadcrumb.

Last resort for me would boot the system in single user mode with networking, and do pkg upgrade -f to force reinstall everything. That may cleanup things.
 
The fact that all Firefox based browsers have the same/similar issue imply a library used.
Are you starting it from a term window or clicking on a menu item? Try from a term window, there may be a breadcrumb somewhere.
also from a term window, try starting in safe mode (I think --safe-mode) that may also give breadcrumb.

Last resort for me would boot the system in single user mode with networking, and do pkg upgrade -f to force reinstall everything. That may cleanup things.
I tried these steps, but it still crashes.

I remember the main error I kept seeing in the terminal was:
Code:
Segmentation fault (core dumped)

It just happened again. After about a minute of browsing and installing an extension in Firefox, it closed on its own (both in normal and safe mode).
 
I'm beyond what I can help with (this is where a coredump and source code in a debugger becomes necessary), but that seems like something someone could help with.
 
I'm beyond what I can help with (this is where a coredump and source code in a debugger becomes necessary), but that seems like something someone could help with.
Thanks...
I just opened Firefox again, and it closed immediately. I got these errors:

$ firefox:
Code:
console.warn: BackupService: "There was an error while trying to get the Document's directory" [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProperties.get]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource:///modules/backup/BackupService.sys.mjs :: get docsDirFolderPath :: line 1228"  data: no]
console.warn: BackupService: "There was an error while trying to get the Document's directory" [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProperties.get]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource:///modules/backup/BackupService.sys.mjs :: get docsDirFolderPath :: line 1228"  data: no]
console.warn: AboutNewTabResourceMapping: "train-hop add-on version 148.0.20251211.63751 already installed but not in use"
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Segmentation fault (core dumped)
 
You said you used fsck to repair filesystems? To rule out any potential permissions, maybe:

cd /home
chown -R username:groupname homedirectory

to walk through your home directory and set all the files and subdirectories as owned by you.
 
A friend of mine said: "Firefox is completely corrupted, maybe something like a bad sector or similar... You'll have to reinstall the operating system again. But honestly, I don't have enough time for that because it would be way too time-consuming for me."

One of my main reasons for going back to Firefox was using a vpn like v2ray, which isn't really configurable on Chromium. But I guess I'll have to give up on Firefox. the issue seems way too serious.
 
If pkg upgrade -f does not correct the issue, I don't think a fresh install would fix anything. But this is why I have "system disks" and "data disks" so I can separate my home directories and pure data from the system. Makes it a lot easier to reinstall a system.
 
A friend of mine said: "Firefox is completely corrupted, maybe something like a bad sector or similar... You'll have to reinstall the operating system again. But honestly, I don't have enough time for that because it would be way too time-consuming for me."
My question is: Is there any hope of recovering Firefox without having to reinstall the whole OS?
If Firefox was affected by a power-off bad enough to affect forks and reinstalls of it, I doubt it's the only thing on the whole OS broken (I'd do the reinstall :p)
 
  • Like
Reactions: mer
If pkg upgrade -f does not correct the issue, I don't think a fresh install would fix anything. But this is why I have "system disks" and "data disks" so I can separate my home directories and pure data from the system. Makes it a lot easier to reinstall a system.
Yes, unfortunately, pkg upgrade -f didn’t help either.
For now, I think I'll just stick with Chromium, one way or another.
Thanks for your time and the helpful suggestion.
 
Yes, unfortunately, pkg upgrade -f didn’t help either.
For now, I think I'll just stick with Chromium, one way or another.
Thanks for your time and the helpful suggestion.
That works, were you able to export whatever bookmarks and other personal information you had from Firefox? At any rate, it's worth just deleting the entire set of firefox directories in your home directory and do a force reinstall of everything on the system. But, at least you've got some option for cruising the net, which is ultimately the point of fixing Fx in the first place.

By reinstall, I'd export the list of pkgs you've got via pkg prime-list and uninstall everything before doing a reinstall of all of it. In rare cases, I've had something go wrong and need to go to that length, typically it doesn't take that long to get back up and running as you can alway prioritize Xorg and whatever other stuff you need to get up and running more quickly.
 
At this point, if you've successfully checked the filesystem consistency, reinstalled all your packages and recreated Firefox's profile, I'd seriously start suspecting disk damage.
If I were you I'd do a backup of anything of value ASAP and run a S.M.A.R.T. test (sysutils/smartmontools, sysutils/gsmartcontrol for a more friendly graphical interface). Note that your UEFI may already have such an interface so you may want to give that a try first.
 
Specifically, ZFS has sync enabled, meaning it syncs everything to disk right away, and even if the power goes out, it'll sync everything to disk on next boot because it has a special queue.

On Linux, I had sync OFF with BTRFS, and it was nearly always corrupting my Firefox's SQL database on abrupt poweroffs.

UFS also doesn't sync immediately to disk, it flushes to disk periodically. If the power goes out before it flushes something to disk (or during the writes?), SQL database might get corrupted.
ZFS uses transaction groups. Writes go into memory initially and are committed to the drive at the end of the each group. After an unclean shutdown the systems comes up a bit out of date, but fully self-consistent. You may be thinking of ZFS with a ZIL. A ZIL may slow down ZFS with no benefit; it exists to mitigate pathogical workloads that do a lot of flushing - a pure database server is the classic example.

UFS+Soft Updates has a similar objective, but it's never been fully reliable in my experience. I prefer ZFS or UFS on a gjournal partition.

As regards the OP's problem, I'd try a pkg upgrade -f. If it doesn't fix it, I'd create a new unix user and see if Firefox works on a completely clean home directory.
 
Back
Top