Firefox Quantum `about:config` `browser.cache` tweak hassle

Question: With FF Quantum [eg, 61.0.2 (64-bit)] is it no longer possible to completely stop FF caching to SSD/HDD?

I've read:

  1. Solving the Slow and laggy Firefox problem
  2. Troubleshooting Firefox
  3. https://wiki.archlinux.org/index.php/Firefox/Tweaks#Turn_off_the_disk_cache

I then did:

  1. Refreshed my test FF profile AND also deleted existing prefs.js to hopefully guarantee there were no historical about:config settings that might interfere / corrupt this experiment.

  2. Set browser.cache.disk.enable to false

  3. Verified that browser.cache.memory.enable is set to true

  4. Created new Integer entry browser.cache.memory.capacity & set it to -1 for automatic cache size selection

  5. Set browser.cache.offline.enable to false

  6. Closed FF.

  7. Deleted /home/kdemeoz/.cache/mozilla/firefox/

  8. Launched FF.

  9. Observed that instantly a new /home/kdemeoz/.cache/mozilla/firefox/ was created.

  10. Inspected about:cache & saw:

memory
    Number of entries: 	4
    Maximum storage size: 	29696 KiB
    Storage in use: 	56 KiB
    Storage disk location: 	none, only stored in memory
    List Cache Entries

disk
    Number of entries: 	4
    Maximum storage size: 	29696 KiB
    Storage in use: 	56 KiB
    Storage disk location: 	none, only stored in memory
    List Cache Entries

appcache
    Number of entries: 	0
    Maximum storage size: 	0 KiB
    Storage in use: 	0 KiB
    Storage disk location: 	none, only stored in memory 

...which would seem to be complete poppycock given my #9.

  1. Inspected about:profiles & saw:
Profile: default
This is the profile in use and it cannot be deleted.
Default Profile	yes
Root Directory	/home/kdemeoz/.mozilla/firefox/p0r3dfxw.default-1536906901716
Local Directory	/home/kdemeoz/.cache/mozilla/firefox/p0r3dfxw.default-1536906901716

...which conforms with my #9, contradicts #10, & thus implies an apparent impossibility to completely* prevent FF-Q from caching to disk.

  1. * Apparent partial solution: Created new String entry browser.cache.disk.parent_directory & set it to /tmp [which of course is a Ram-drive via tmpfs], undid #2, closed FF, repeated #7, launched FF, observed with exasperation that another new /home/kdemeoz/.cache/mozilla/firefox/ was created, BUT this time one of its previous subdirectories, cache2, now was created instead as /tmp/cache2/. That still leaves, perplexingly, these written to disk:
$ ls -l
total 108
-rw------- 1 kdemeoz kdemeoz 96113 Sep 14 19:17 activity-stream.tippytop.json
drwxr-xr-x 3 kdemeoz kdemeoz  4096 Sep 14 19:23 safebrowsing
drwxr-xr-x 2 kdemeoz kdemeoz  4096 Sep 14 19:19 startupCache
drwx------ 2 kdemeoz kdemeoz  4096 Sep 14 19:17 thumbnails
[kdemeoz@manjaro-xfce-vm p0r3dfxw.default-1536906901716]$ 

Pic of relevant settings [prior to #12]:
20180914_005

Comments, advice, corrections, suggestions welcomed please.

I think it may depend on what it's defining as "cache", and I suspect it's web page content (HTML, images, CSS, etc.) rather than newer stuff built-in to Firefox itself.

For example, page/bookmark thumbnails are a fairly new feature. Indeed, the four files/directories are all "newer" built-in features so the "do not cache" option won't know what these are or have any way of handling them - but that's without knowing whether the Mozilla devs would regard those items as "cached items".

Am i correctly intuiting that basically you're telling me my #12 is https://en.wikipedia.org/wiki/As_Good_as_It_Gets ? :grinning:

You could mount your $HOME/.cache as a tmpfs (or set your $XDG_CACHE_HOME to a location which is a tmpfs), then it's never written to disk and you don't have to faff about with application settings.

If you don't want the whole cache to be lost every boot, you could always mount only the $HOME/.cache/firefox directory as tmpfs or symlink it out to another tmpfs location.

Funnily enough, many hours ago i was speculating about that, but chickened-out when i saw:

Summary
[kdemeoz@GA-Z97-HD3-Tower .cache]$ ls -l
total 205580
drwx------   2 kdemeoz kdemeoz     4096 May  5 00:02  babl
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Aug  7 16:55  blinken
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Dec 10  2017  calibre
drwxr-xr-x   4 kdemeoz kdemeoz     4096 Mar  1  2018  cantata
drwx------   4 kdemeoz kdemeoz     4096 Jan 29  2018  champlain
drwxr-xr-x   5 kdemeoz kdemeoz     4096 Sep 13 17:03  Clementine
drwxr-xr-x   4 kdemeoz kdemeoz     4096 Dec  9  2017  dolphin
-rw-r--r--   1 kdemeoz kdemeoz    12288 Sep 13 18:49  event-sound-cache.tdb.767768ed550c47be8b6ddf861e71e3bf.x86_64-unknown-linux-gnu
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Jul  8 20:01  falkon
drwxr-xr-x   2 kdemeoz kdemeoz     4096 May 25 19:40  favicons
drwx------   3 kdemeoz kdemeoz     4096 Jan 29  2018  folks
drwxr-xr-x   2 kdemeoz kdemeoz    12288 Sep 14 11:53  fontconfig
drwx------   3 kdemeoz kdemeoz     4096 Jan 30  2018  gegl-0.2
drwx------   2 kdemeoz kdemeoz     4096 Jan 29  2018  geocode-glib
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Dec 10  2017  g-ir-scanner
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Sep 10 12:59  gstreamer-1.0
-rw-r--r--   1 kdemeoz kdemeoz 10547304 Sep 14 20:43  icon-cache.kcache
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Sep 10 13:36  ImageMagick
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec 10  2017  indicator-sensors
drwxr-xr-x   3 kdemeoz kdemeoz     4096 May  5 00:02  inkscape
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec  9  2017  kcmshell5
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Jan  2  2018  kgpg
drwxr-xr-x   4 kdemeoz kdemeoz     4096 Aug  7 16:47  khangman
drwxr-xr-x   4 kdemeoz kdemeoz     4096 Dec 10  2017  khelpcenter
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Jan  2  2018  kinfocenter
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Sep 14 20:41  kio_http
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Apr 11 16:24  krita
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec  9  2017  krunner
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec  9  2017  kscreenlocker_greet
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec  9  2017  ksmserver-logout-greeter
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec 11  2017  ksmserver-switchuser-greeter
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec  9  2017  ksplashqml
-rw-r--r--   1 kdemeoz kdemeoz  1974321 Apr 11 16:30 'ksycoca5_en-AU_0DdpIWNqhkxhU7u_kfBM4q_ZhdY='
-rw-r--r--   1 kdemeoz kdemeoz  1934801 Dec 31  2017 'ksycoca5_en-AU_aema2Lp7MGBzH6csDgj9hH8xG_Y='
-rw-r--r--   1 kdemeoz kdemeoz  2039258 Sep 14 11:06 'ksycoca5_en-AU_UDY7yo3bWfsY8yrcXjLzk4ko3tc='
-rw-r--r--   1 kdemeoz kdemeoz  2016314 Jun  5 19:18 'ksycoca5_en_UDY7yo3bWfsY8yrcXjLzk4ko3tc='
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Dec 16  2017  kup
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec  9  2017  kwin
drwxr-xr-x   4 kdemeoz kdemeoz     4096 Jul 13 16:47  lattedock
drwxr-xr-x 258 kdemeoz kdemeoz     4096 Aug 19 11:58  mesa_shader_cache
drwx------   3 kdemeoz kdemeoz     4096 Sep 14 12:28 'moonchild productions'
drwx------   3 kdemeoz kdemeoz     4096 Dec  9  2017  mozilla
drwx------   5 kdemeoz kdemeoz     4096 Dec 31  2017  netsurf
drwx------   2 kdemeoz kdemeoz     4096 Dec  9  2017  obexd
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Jul 21 11:37  okular
drwx------   3 kdemeoz kdemeoz     4096 Jan 29  2018  org.gnome.Maps
-rw-r--r--   1 kdemeoz kdemeoz 10547304 Feb 20  2018  org.kde.dirmodel-qml.kcache
drwxr-xr-x   7 kdemeoz kdemeoz     4096 May  2 12:06  plasmashell
-rw-------   1 kdemeoz kdemeoz   298625 Sep 14 12:29  plasma-svgelements-AdaptaBreath
-rw-------   1 kdemeoz kdemeoz     4592 Jul 14 19:34  plasma-svgelements-air_v1.3
-rw-------   1 kdemeoz kdemeoz     4980 Aug 26 17:14  plasma-svgelements-Arc-Dark-Transparent
-rw-------   1 kdemeoz kdemeoz    47691 Aug 26 17:14  plasma-svgelements-breath_v0.2.0
-rw-------   1 kdemeoz kdemeoz     6690 Aug 26 17:14  plasma-svgelements-breeze-dark_v5.30
-rw-------   1 kdemeoz kdemeoz     6690 Aug 26 17:14  plasma-svgelements-breeze-light_v5.20
-rw-------   1 kdemeoz kdemeoz     6690 Aug 26 17:14  plasma-svgelements-default_v5.30
-rw-------   1 kdemeoz kdemeoz     5495 Aug 26 17:14  plasma-svgelements-metadata
-rw-------   1 kdemeoz kdemeoz    91528 Jul 14 19:34  plasma-svgelements-oxygen_v1.1
-rw-------   1 kdemeoz kdemeoz     6236 Aug 26 17:14  plasma-svgelements-Starcraft_v1.0
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 14 17:11  plasma_theme_AdaptaBreath.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_air_v1.3.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_Arc-Dark-Transparent.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_breath_v0.2.0.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_breeze-dark_v5.30.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_breeze-light_v5.20.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_default_v5.30.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_metadata.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_oxygen_v1.1.kcache
-rw-r--r--   1 kdemeoz kdemeoz 16875624 Sep 10 13:25  plasma_theme_Starcraft_v1.0.kcache
-rw-r--r--   1 kdemeoz kdemeoz 10547304 Jul 24 10:38  plasma_wallpaper_preview.kcache
-rw-r--r--   1 kdemeoz kdemeoz   165196 Aug 14 12:28  qt_compose_cache_little_endian_0258dbfe574462cb78cbcfaa7b9d968b
-rw-r--r--   1 kdemeoz kdemeoz   165196 Aug 22 09:40  qt_compose_cache_little_endian_0e9916786e455afd17517eb65f790b7b
-rw-r--r--   1 kdemeoz kdemeoz   165196 Jul 21 13:53  qt_compose_cache_little_endian_13df719025492edd0ddfc7845d1931d0
-rw-r--r--   1 kdemeoz kdemeoz   165196 Jul 21 13:15  qt_compose_cache_little_endian_4b0728746148136b31ff1cbb124c2f65
-rw-r--r--   1 kdemeoz kdemeoz   165196 Aug  2 17:20  qt_compose_cache_little_endian_581161277d4201ae4983a9b473582149
-rw-r--r--   1 kdemeoz kdemeoz   165196 Aug  4 17:03  qt_compose_cache_little_endian_670b33f53343954458a006a538e619c7
-rw-r--r--   1 kdemeoz kdemeoz   165196 Aug 26 16:24  qt_compose_cache_little_endian_767768ed550c47be8b6ddf861e71e3bf
-rw-r--r--   1 kdemeoz kdemeoz   165196 Dec  9  2017  qt_compose_cache_little_endian_GA-Z97-HD3-Tower
drwxr-xr-x   2 kdemeoz kdemeoz     4096 Sep 12 15:53  qtshadercache
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec 10  2017  shutter
drwx------   3 kdemeoz kdemeoz     4096 Jul 31 18:58  simple-scan
drwx------   3 kdemeoz kdemeoz     4096 Dec 30  2017  slimjet
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec 31  2017  spectacle
drwx------   2 kdemeoz kdemeoz     4096 Dec 28  2017  stardict
drwxr-xr-x   5 kdemeoz kdemeoz     4096 Dec  9  2017  systemsettings
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec 23  2017  TeamViewer
drwxr-xr-x   4 kdemeoz kdemeoz     4096 Dec  9  2017  thumbnails
drwx------   3 kdemeoz kdemeoz     4096 Dec 28  2017  thumbnail.so
drwx------   3 kdemeoz kdemeoz     4096 Dec 10  2017  thunderbird
drwxr-xr-x   2 kdemeoz kdemeoz     4096 May 31 01:09  tracker
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Dec 14  2017  winetricks
drwxr-xr-x   3 kdemeoz kdemeoz     4096 Jan  4  2018  yakuake
[kdemeoz@GA-Z97-HD3-Tower .cache]$ 

... as i was unsure if i might create "unintended consequences" elsewhere.

Cache is supposed to be volatile so wiping it every so often can even be a good idea.

Whether having it wiped on every boot... the only thing I would find slightly suboptimal is losing AUR helper caches. This means they re-download the packaging files and re-prompt me to check the files for changes.

I've run a tmpfs .cache on an Ubuntu system for years with nary an issue. I haven't run it on Manjaro because of the AUR helper cache, but I still rm -fr $HOME/.cache every now and again.

1 Like

My question is, what do you want to achieve and why.
Else, when you tell FF to "auto" do something, or "be smart", you let AI do something, with whatever brains it has.
I would try disable auto and smart, if I knew my goal, which I don't :stuck_out_tongue_winking_eye:
Comment is based on image posted with FF config options.

Not really an answer to your problem, but I recommend you put the FF cache into the RAM, that way it gets deleted on reboot.
Just set browser.cache.disk.parent_directory to something like /tmp/firefox-cache.
Since /tmp is by default on tmpfs, you don't need to do anything else.
Cache must of course be enabled and size > 0.

http://kb.mozillazine.org/Browser.cache.disk.parent_directory

Hi,

I wanted my other caches to be left untouched, so I wrote meself a script that recreates links according to a defined template.

This runs after login
#!/usr/bin/env python
# vim:fileencoding=utf-8:foldmethod=marker

# imports {{{
import os, errno, shutil

from os import symlink
from os import mkdir 
from os import makedirs
from os import remove
from os.path import exists
from os.path import isdir
from os.path import islink
from os.path import expanduser 
from os.path import join 
from os.path import dirname 
from os.path import abspath 

# }}}

def symlink_force(target, link_name):
    try:
        symlink(target, link_name)
    except OSError as e:
        if e.errno == errno.EEXIST:

            if isdir(link_name) and not islink(link_name):
                shutil.rmtree(link_name)
            else:
                remove(link_name)
                
            symlink(target, link_name)
        else:
            raise e

def create_symlink(line):
    # ln -s target_path link_path
    paths = line.split(" -> ")
    target_path = expanduser(paths[0])
    link_path = expanduser(paths[1])

    if not exists(target_path):
        makedirs(target_path)

    if not exists(dirname(link_path)):
        makedirs(dirname(link_path))

    if exists(link_path) or islink(link_path):
        symlink_force(target_path, link_path)
    else:
        symlink(target_path, link_path)


def load_list():
    package_dir = dirname(abspath(__file__))
    thefile = join(package_dir,'symlinker-list.txt')
    return [line.rstrip() for line in open(thefile)]

def touch(fname, mode=0o666, dir_fd=None, **kwargs):
    flags = os.O_CREAT | os.O_APPEND
    with os.fdopen(os.open(fname, flags=flags, mode=mode, dir_fd=dir_fd)) as f:
        os.utime(f.fileno() if os.utime in os.supports_fd else fname,
            dir_fd=None if os.supports_fd else dir_fd, **kwargs)

def action_decider(line):
    if " -> " in line:
        create_symlink(line)
    elif any(map (line.startswith, ["mkdir","newdir", "dir"])):
        makedirs(line.split(" ", 1)[1])
    elif any(map (line.startswith, ["touch","newfile", "file"])):
        touch(line.split(" ", 1)[1])

def main():
    lines = load_list()
    for l in lines:
        action_decider(l)

if __name__ == "__main__":
    main()

And that script process a text file next to it that serves as template of where to create empty dir and where a symlink

Template file
# This is feeded to a python script
# The arrow signals it's going to create symlink
# WARNING - will overwritte files if necessary

/tmp/firefox -> ~/.cache/mozilla 
/tmp/remmina -> ~/.cache/remmina
/tmp/thumbnails -> ~/.cache/thumbnails
/tmp/qutebrowser -> ~/.cache/qutebrowser
/tmp/chromium -> ~/.cache/chromium
/tmp/kitty -> ~/.cache/kitty
/tmp/ranger -> ~/.cache/ranger
/tmp/npm -> ~/.npm/_cacache

/tmp/vscode -> ~/.config/Code/Cache
/tmp/vscode -> ~/.config/Code/CachedData
/tmp/vscode -> ~/.config/Code/CachedExtensions
/tmp/vscode -> ~/.config/Code/logs
/tmp/vscode -> ~/.config/Code/User/workspaceStorage

/tmp/signal/logs -> ~/.config/Signal/logs
/tmp/signal/attachments -> ~/.config/Signal/attachments.noindex

/tmp/.xsession-errors -> ~/.xsession-errors


~/.scripts/git_hooks/post-merge_skype4pidgin -> ~/.git/modules/.purple/plugins/skype4pidgin/hooks/post-merge

It's not the best or elegant way of doing so, but it works for me pretty well :smiley:

Disks be safe.

Teehee... From my point #12 earlier...

:wink:

That's very clever!

1 Like

Do you know about "profile-sync-daemon". It works very well.

2 Likes

Surprising reading, I've switched completely to Google Chrome these days as it works better with sites I use than FF Quantum. With that directing cache to RAM is far easier too. I simply modify the application start command to include --disk-cache-dir=/tmp/cache

$ chromium --disk-cache-dir=/tmp/cache

I've got a headache, a fever, and a big male (men) flu. :smiley:
Where exactly did you do that? (simply) :slight_smile:

In the meantime, I'm taking the
https://wiki.archlinux.org/index.php/Profile-sync-daemon

Also nice

Profile-Cleaner
➜  ~ profile-cleaner 
profile-cleaner v2.37

 /usr/bin/profile-cleaner {browser abbreviation}

   c) chromium (stable, beta, and dev)
   f) firefox (stable and beta)
  fa) falkon
  gc) google-chrome (stable, beta, and dev)
   o) opera (stable, next, and developer)

  ck) conkeror
   h) heftig's aurora
   i) icecat
  id) icedove
  ix) inox
   m) midori
   n) newsbeuter
  pm) palemoon
   q) qupZilla
   s) seamonkey
   t) thunderbird
  to) torbrowser

   p) paths
➜  ~ profile-cleaner o
profile-cleaner v2.37

 Cleaning profile for opera
 Cleaning Cookies                              done  -.12 Mbytes
 Cleaning History                              done  -.03 Mbytes
 Cleaning Origin Bound Certs                   done  -0 Mbytes
 Cleaning Shortcuts                            done  -0 Mbytes
 Cleaning autoupdate_checker.sqlite            done  -0 Mbytes
 Cleaning Login Data                           done  -0 Mbytes
 Cleaning Web Data                             done  -.02 Mbytes
 Cleaning Favicons                             done  -.01 Mbytes
 Cleaning previews_opt_out.db                  done  -0 Mbytes
 Cleaning Network Action Predictor             done  -.01 Mbytes
 Cleaning Databases.db                         done  -0 Mbytes
 Cleaning QuotaManager                         done  -0 Mbytes

 Profile(s) for opera reduced by .24 Mbytes.
 Cleaning profile for opera-developer
 Cleaning Cookies                              done  -0 Mbytes
 Cleaning History                              done  -0 Mbytes
 Cleaning Shortcuts                            done  -0 Mbytes
 Cleaning autoupdate_checker.sqlite            done  -0 Mbytes
 Cleaning Login Data                           done  -0 Mbytes
 Cleaning Web Data                             done  -0 Mbytes
 Cleaning Favicons                             done  -0 Mbytes
 Cleaning previews_opt_out.db                  done  -0 Mbytes
 Cleaning Network Action Predictor             done  -0 Mbytes

 Profile(s) for opera-developer reduced by 0 Mbytes.

I edited the Application Launcher command and put it before the %u

In KDE it was accessible by right clicking the browser icon in the application menu. You may need to use a menu editor in other desktops

1 Like

Thank you, Xfce too , :slight_smile:

Zusammenfassung

grafik

I got so much to learn, phew. :smiley:

FYI, BTW, if also interested in running in Firejail:

1. firejail -- chromium --disk-cache-dir=/tmp/chromium-cache
2. firejail -- vivaldi-snapshot --disk-cache-dir=/tmp/vivaldi-snapshot-cache
3. firejail -- vivaldi-stable --disk-cache-dir=/tmp/vivaldi-stable-cache
4. firejail -- /usr/bin/opera-legacy
1 Like

Some function did not work or not smooth, here in forum upload pic etc.

You could always put that flag, along with any other that you use, in a config file back in:

/home/user/.config/chromium-flags.conf
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by