Question

When trying to upgrade from Magento 2.2.5 to 2.2.6 I've noticed some strange behavior blocking the upgrade. The first commands I did without problem are:

composer require magento/product-community-edition 2.2.6 --no-update composer update rm -rf var/di var/generation

Following this I normally clear the cache (php bin/magento cache:flush) but I get the following error:

[Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "cache" namespace.

Are the cache commands removed/changed in 2.2.6 or is this a problem straight away?

I tried to continue without that (using command: php bin/magento setup:upgrade) but I get a different error:

[Magento\Framework\Exception\LocalizedException] Init vector must be a string of 32 bytes.

Things I have tried so far:

  1. Roll back changes and use same update process without first specifying version 2.2.6. This updated several modules including 3rd party ones. Cache command was working fine and the whole thing went smoothly. Following that I tried updating to 2.2.6 again but got the same errors as above.

  2. Double checked the file system ownership was set correctly using commands I previously have used.

Any ideas?

Was it helpful?

Solution

We user varnish and redis cache on our server and had this same error. This is the procedure we followed for a successful upgrade.

composer require magento/product-community-edition 2.2.6 --no-update
composer update
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*
redis-cli flushdb
curl -X 'PURGE' -H'X-Magento-Tags-Pattern: .*'  localhost:8072
php70 bin/magento setup:upgrade

I believe redis and/or varnish are the culprit in this issue.

OTHER TIPS

I had the same issue with m2.2.6 and redis. Solving:

redis-cli flushall

Step 1: Access Your Server via SSH

You need to connect your server via SSH.

Step 2: Navigate to the Magento 2 Root Directory

Once your SSH connection is up, you will need to move to your target application folder. In that application folder, you will find the public_html folder which is the root directory of Magento 2.

Step 3: Upgrade Commands

composer require magento/product-community-edition 2.2.6 --no-update

Then execute this all commands

 composer update
 rm -rf var/di var/generation
 php bin/magento setup:upgrade
 php bin/magento setup:di:compile
 php bin/magento cache:clean
 php bin/magento cache:flush
 php bin/magento indexer:reindex

This happened to me, however I could not flush the cache using the CLI as I was experiencing the same error there.

We use redis as a cache, so I connected to the redis server (using redis-cli) and ran FLUSHALL which fixed the issue

In magento 2.2.5 there generated folder

so you have to run below command:

rm -rf var/di/* generated/* var/cache/* var/page_cache/*

after run it please check running php bin/magento command

you will see the cache:clean and cache:flush command

if not still any error present there

Here's exactly what I did to the env.php file to remedy this situation... I think it's because I did not switch out of production mode prior to installing the update.

Make sure that in the env file you're not in 'production' & make sure that the cache types are all listed as '0' (meaning they're off!).

Upon changing into developer mode and turning off all of the caching, I was able to run the setup:upgrade commands that were hanging...

'MAGE_MODE' => 'developer',
'cache_types' => [
    'config' => 0,
    'layout' => 0,
    'block_html' => 0,
    'collections' => 0,
    'reflection' => 0,
    'db_ddl' => 0,
    'eav' => 0,
    'customer_notification' => 0,
    'full_page' => 0,
    'config_integration' => 0,
    'config_integration_api' => 0,
    'translate' => 0,
    'config_webservice' => 0,
    'compiled_config' => 0

I have not tried to enable production mode yet, I still need to upgrade modules that have backward compatibility issues.

* Make sure your permissions are set correctly *

I ran into this same problem: 2.2.6 update, composer update went fine, then on php bin/magento cache:clean I got : There are no commands defined in the "cache" namespace.

And on the frontend/backend errors like: Magento\Framework\Exception\LocalizedException: Init vector must be a string of 32 bytes.

In my case it was also Redis but whatever I did (redis-cli flushall or redis-cli flushdb) I would still get the errors. Seems somewhere some cache still "lives"...

Finally I decided to open app/etc/env.php and comment out the whole cache section like so:

//    'cache' => [
//        'frontend' => [
//           'default' => [
//                'backend' => 'Cm_Cache_Backend_Redis',
....
//        'page_cache'=> [
...
// ],

right above 'db'=> [

Then my php bin/magento cache:clean worked and I could continue the upgrade. I hope it helpes someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top