When I try to uninstall module "weather block" I got next error message:
"The website encountered an unexpected error. Please try again later."

apache error log
[Tue Oct 25 19:41:49.747696 2016] [:error] [pid 2936] [client 127.0.0.1:58676] Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\Pl
Drupal Recent log files
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "field_entity" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of /var/www/drupal/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Is there a possibility to force uninstalling ?

Comments

vm’s picture

not sure what you mean by force. If you had a backup of database before you created the module and after, you could manually remove any entries in the database.

I suggest researching the issue queue of the module in question for similar reports. If none, submit one. That's how things get fixed for all users of a specific module.

jjgw’s picture

I mean can I change a field in some table from the Drupal database in order to set the module as uninstalled and then remove the module file from the harddisk.
If so which table/field/value ?

vm’s picture

no. You can only disable in the database. Uninstall routine is in code.

jjgw’s picture

Disabling in the database, that's just what I wanted to do. But how???
"Disabling or enabling modules manually in the database" is described under https://www.drupal.org/node/157632
Following these instructions you should run "UPDATE system SET status='0' WHERE name='module_name';"
But in my Drupal 8 database there is not a table named "system"!
So what table/field/value should I use in order to set the flag off???

vm’s picture

D8 when a module is disabled in the admin ui it is also uninstalled (D7 one could disable without uninstalling). I dig some digging and I can't see where this can be done database only in D8. Perhaps drush.

jjgw’s picture

I tried the drush command with the same negative result and same error message as showed in the logfile when running from the UI.
drush pmu weather_block
The following extensions will be uninstalled: weather_block
Do you really want to continue? (y/n): y
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "field_entity" entity type does not exist. in [error]
/var/www/drupal/core/lib/Drupal/Core/Entity/EntityTypeManager.php:133

vm’s picture

sounds like you need to generate a bug report in the issue queue of the module in question.

jjgw’s picture

Reporting the weather block bug was already done.
The question remains : "How to remove safely a module in DRUPAL 8 not using the UI or drush ?"
Should I open a new issue on this forum for this question ?

Grphx’s picture

There's a way to sort of uninstall it tho if you're having that kind of problem. You can always delete the module folder/files from your directory then run yoursiteurl.com/update.php

This usually fixes some uninstall errors for me.

jjgw’s picture

I have a problem with "This usually fixes some uninstall errors"
Is this the standard procedure? Is it safe? Does it remove all traces in the DB?

Grphx’s picture

There are other ways like using drush or the drupal console to remove/uninstall the module. The one I stated are just manual steps and yes it does clear the db, the update.php deals with the database part. Just follow the steps, good luck

jjgw’s picture

The manual step worked. Thanks for helping me.

vm’s picture

running update.php does not remove data stored in the database by any module that stores data nor the tables that data is stored in. The module is no longer in the file system as such the uninstall routine cannot run and therefore cannot remove the data or tables.

Whether the 'weather' block module stores any data in the DB, I can't say.

jjgw’s picture

Before removing the folder and running update.php, I removed in the UI the content types, content, etc referencing to "weather block".
And I also cheched field data in table config. Module "weather block" was listed in that field.
After running update.php "weather block" disappeared in that field.
So I do believe that update.php made changes to the DB and I hope that in this case it's fully cleaned up.
May I also reference to the second answer in How can I disable a troublesome module? as an alternate solution.

chandantyagi’s picture

This works....

Remove the folder of the module you want to uninstall. Open database, select the cache tables and empty all of them(truncate). Now, run update.php...

"The website encountered an unexpected error. Please try again later." error gone... and my website works properly now.