5

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?

8
  • can you run command php bin/magento list then check error Commented Sep 20, 2018 at 4:45
  • Same error as when I try the upgrade command. [Magento\Framework\Exception\LocalizedException] Init vector must be a string of 32 bytes. Commented Sep 20, 2018 at 4:47
  • can you try to upgrade with composer ? Commented Sep 20, 2018 at 4:48
  • follow the way i describe here magento.stackexchange.com/questions/242810/… Commented Sep 20, 2018 at 4:49
  • I think the command I used (composer require magento/product-community-edition 2.2.6) already does the same thing as that post you linked to. I checked the composer.json file and it is listing 2.2.6. The rest of the commands in that post are the same as what I tried already. Commented Sep 20, 2018 at 4:52

7 Answers 7

7

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.

2

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

redis-cli flushall
1

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
3
  • This is what I tried to do originally, it get's stuck at the upgrade command. Commented Sep 20, 2018 at 5:31
  • Did you run this command after upgrade ? php bin/magento maintenance:disable Commented Sep 20, 2018 at 5:45
  • I can't complete the upgrade command. I tried running your maintenance:disable command anyway and got this error: Disabled maintenance mode [Magento\Framework\Exception\LocalizedException] Init vector must be a string of 32 bytes. Commented Sep 20, 2018 at 6:43
1

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

0

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

3
  • OK I've tried that but still the cache commands are missing and I get the same error when trying the setup:upgrade command. Commented Sep 20, 2018 at 5:27
  • Then run di compile it will give error file where actually problem is Commented Sep 20, 2018 at 5:30
  • php bin/magento setup:di:compile outputs the following: [Magento\Framework\Exception\LocalizedException] Init vector must be a string of 32 bytes. setup:di:compile Commented Sep 20, 2018 at 5:32
0

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 *

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.