# firefox package: "rmdir: /usr/local/lib/firefox: Directory not empty"



## hruodr (Jul 5, 2018)

When doing `pkg upgrade` I get:


```
[191/205] Upgrading firefox from 61.0_1,1 to 61.0_3,1...
[191/205] Extracting firefox-61.0_3,1: 100%
rmdir: /usr/local/lib/firefox: Directory not empty
```

Is this an error?


----------



## ShelLuser (Jul 5, 2018)

Does the installation process stop or does it continue? If it continues you can consider it a warning, otherwise it's an error.

Things like these can happen more often when a directory is in use  by multiple packages. Then the original "owner" of said directory could try to remove it in its uninstall script but that will fail due to the fact the directory isn't empty. Generally speaking it's nothing to worry about.


----------



## SirDice (Jul 5, 2018)

I'd remove the package and if it still complains it cannot remove the directory check what's getting left behind. It might be some user edited file. You can always check which package installed a file with `pkg which <full path to file>`. If nothing matches and there's nothing worthwhile left behind remove the whole directory by hand. Once everything is cleaned up reinstall the package.


----------



## hruodr (Jul 6, 2018)

It seems I have to inspect a lot of files.

I did not put anything in that directory as far as I remember.


```
# pkg which /usr/local/lib/firefox/chrome.manifest
/usr/local/lib/firefox/chrome.manifest was installed by package firefox-61.0_3,1
#pkg which /usr/local/lib/firefox
/usr/local/lib/firefox was not found in the database
# ls /usr/local/lib/firefox
application.ini         firefox                 libmozgtk.so
browser                 firefox-bin             libxul.so
chrome                  gmp-clearkey            omni.ja
chrome.manifest         gtk2                    pingsender
defaults                liblgpllibs.so          platform.ini
dependentlibs.list      libmozavcodec.so        plugin-container
dictionaries            libmozavutil.so         removed-files
```

I deleted firefox and remained /usr/local/lib/firefox/defaults/pref/gmpopenh264.js in the directory. Then I get:


```
# pkg which /usr/local/lib/firefox/defaults/pref/gmpopenh264.js
/usr/local/lib/firefox/defaults/pref/gmpopenh264.js was not found in the database
# more /usr/local/lib/firefox/defaults/pref/gmpopenh264.js
pref("media.gmp-gmpopenh264.autoupdate", false);
pref("media.gmp-gmpopenh264.lastUpdate", 1530589788);
pref("media.gmp-gmpopenh264.version", "1.8.0");
```

Who put it?


----------



## SirDice (Jul 6, 2018)

I don't think there's anything important in there, at least it doesn't look like it. So try `pkg delete firefox`, it's going to complain about that directory. Once the package is removed; `rm -rf /usr/local/lib/firefox` to clean up. Then `pkg install firefox` again. 

A pkg-delete(8) checks files against recorded checksums. Apparently this is somewhat out of sync and it doesn't recognize any of those files, so it takes the safe route and leaves them in place.


----------



## hruodr (Jul 6, 2018)

A small surprise:


```
# ll /usr/local/lib/firefox/defaults/pref/gmpopenh264.js
lrwxr-xr-x  1 root  wheel  61 Jul  5 11:14 /usr/local/lib/firefox/defaults/pref/gmpopenh264.js@ -> /usr/local/lib/browser_plugins/gmp-gmpopenh264/gmpopenh264.js
# ll /usr/local/lib/browser_plugins/gmp-gmpopenh264/gmpopenh264.js
-rw-r--r--  1 root  wheel  151 Jul  3 03:49 /usr/local/lib/browser_plugins/gmp-gmpopenh264/gmpopenh264.js
```

I am a little afraid of deleting it. Perhaps it has to do with many not repeatable, but succesfull firefox test and error configuration efforts. Firefox is not anymore continously crashing as before.


----------



## Beastie (Jul 6, 2018)

Then just move the file(s) somewhere safe and remove the directory.


----------



## SirDice (Jul 9, 2018)

Just move the old directory out of the way, `pkg delete firefox`, `mv /usr/local/lib/firefox /usr/local/lib/firefox.old`, `pkg install firefox`.

If there's anything missing that shouldn't have been removed you can find it in the firefox.old directory. If everything appears to be working without any adverse effects, remove the old firefox.old directory.


----------

