1

In Firefox I enter file:///tmp/ in the address bar. The contents shown are

enter image description here

However, in terminal:

~ #> ls /tmp
gdm3-config-err-9a52qA                                                     systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-colord.service-PvCY27
gimp                                                                       systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-ModemManager.service-GbOLg8
lu3108423r9mlz.tmp                                                         systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-power-profiles-daemon.service-bNBn0T
lu76911wsxeg.tmp                                                           systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-switcheroo-control.service-TGEWNV
MozillaUpdateLock-241071960E6330E5                                         systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-systemd-logind.service-JSWy2P
OSL_PIPE_1000_SingleOfficeIPC_65e3f1817f7920746bdd8681ec9a9b3              systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-systemd-resolved.service-xyyTHf
snap.chromium                                                              systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-systemd-timesyncd.service-ZSoJZS
snap.firefox                                                               systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-tor@default.service-2tpuX4
snap.snap-store                                                            systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-upower.service-08NJP6
systemd-private-16f62aa15e164ea1b3229f2198fa8d3d-bluetooth.service-yo03Q1  Temp-32250a58-86fc-48a9-93ac-0a367a879e58

Why are these not the same?

1

2 Answers 2

5

It does show the contents of what it thinks is /tmp, it's just not the same /tmp.

Linux supports "mount namespaces" which allow different processes to have different views of what's mounted where (e.g. this is how containers such as Docker or LXC are implemented).

You're using Ubuntu, so your Firefox was installed through the snap system, which also isolates each app in its own container with limited access to the real system – what Firefox sees as /tmp inside the container probably corresponds to /tmp/snap.firefox/tmp (or /tmp/snap-private-tmp/snap.firefox/tmp) outside the container.

(Running sudo nsenter -m -t <firefox_pid> findmnt or even opening file:///proc/mounts would probably show that there is a "bind mount" from /tmp/snap.firefox on top of /tmp, which is only visible to Firefox but not visible in a regular findmnt.)

All the /tmp/systemd-private-* subdirectories have the same purpose as well – they are used to provide an isolated view of /tmp various for system services.

3
  • I have the same problem: one process creates an .html file in /tmp, then launches Firefox to look at it, but it's not there. Is there a standard workaround for this? I.e. should I create the file somewhere else, or is there a way to tell Firefox not to use the "mount namespace"? Commented Apr 28, 2023 at 18:07
  • Namespaces are set up by Snap in this case; Firefox doesn't get a say in what namespace it's in (which is the whole point of this feature). Commented Apr 28, 2023 at 18:21
  • I can put the files under my home directory, and Firefox can read that. So I have a solution. Commented Apr 28, 2023 at 19:21
0

Seems firefox can only see home, not even e.g. home/.cache, so the only fix is to copy every html you want to view into home and view it from there.

1
  • 1
    It can see regular subdirectories, but it cannot see .dotfiles. (I've read the AppArmor policy while investigating an unrelated topic.) Commented Mar 10 at 7:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .