I broke the site - please help

Recently I tried to upgrade my Magento from 2.4.2 to 2.4.3-p1. It didn’t work.

I normally do both code and bd backups before and after any major change or module installation.

Now I want to reverse my Magento to the previous stage using one of my backups but for some reason, I can’t do it.

I can’t disable the maintenance mode to clear cache and so on. I’mconcedering putting a new Magento 2.4.3-p1 from scratch but I need some data from this broken one. Especially product data.

magento error 220205

Can somebody help, please? I have 10s of backups in my /var/backups directory. How can I use them to make my Magento work again?

bin/magento setup:rollback --code-file=“xyz_filesystem_code.tgz”
bin/magento setup:rollback --db-file=“xyz_db.sql”

Don’t work.

Thank you in advance.

Did you fix it?

This guide is very detailed …

https://www.mageplaza.com/devdocs/magento-2-rollback-database-media-code.html

When you ftp var/backups are you able to see the files?
Do you have access to admin panel?
In my experience you have to restore either server snapshot or restore a backup(rollback) to a working magento server.
Picture errors show that something went wrong during the install of magento

Hello Geroge,

Thank you for taking the time and responding to me.

No, I didn’t fix it.
You see I restored backups of both code and DB 10s of times with no issues.

I’m guessing that the Magento upgrade is causing the issue. In the past, I mean restoring backups on the same Magento version, all was easy with no complications but after I tried to upgrade it dosen’t work.

It is really annoying because I have 10s of backups.

I restored my backup runing the following commands:

bin/magento setup:rollback --code-file="code_file_name_code.tgz"
bin/magento setup:rollback --db-file="db_file_name_db.sql"

Checked ownership & permissions with these commands:

Using superuser:

sudo chown -R magento:www-data /var/www/html/

‘Magento’ user:

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} + && chmod u+x bin/magento

Removed the following runing the below command:

rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* pub/static/frontend/*
rm -rf var/page_cache/* var/cache/* generated/*

Finally restarted my Redis:
Using superuser:

sudo systemctl status redis-server

Flushed Redis with the below command:

REDISCLI_AUTH='my_password' redis-cli FLUSHALL

In the past, I never had to touch Redis.
I never set up Varnish.

The above didn’t help. Can you please give me some tips on how to bite it?


When I cd my var/backups I see a lot, 10s, of backups.
I haven’t got access to the Magneto admin pannel as the maintenance mode is enabled. I can’t disable the maintenance mode vis CLI. Pls. refer to the image I attached to my initial message.

Thank you.
Pawel

First check the permission to env.php and ownership

Second check if there is a app/etc/config.php file

And then try to run
rm -rf var/generation/*
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy or -f to developer mode

Your backup will be rollback when you fix magento instance

Hi George,

Once again thank you for taking the time and effort trying to help me.

I tried once again to roll back my code and DB backups but this time I picked Nov data.
I know that they definitely worked.

I can confirm that both env.php and conf.php files are within the app/etc directory and both have correct ownerships and permission.

As you advised I remove all within var/generation/8 directory running the bellow code
rm -rf var/generation/*

Then when I tried to run
bin/magento setup:di:compile
the following error was shown.
Please refer to the attached image.

From what I read the ReCaptcha issue is known during updates from M2.4.2 to 2.4.3 & 2.4.3-p1

The backup I’m using is from November when I could run any and all commands with no problems so where is the RECaptach from :frowning:

I have backups from March last year. Didn’t try them yet but I’m guessing that I’ll face the same issue.

Can you give me more tips on how to fix it?
Once again thank you for your time. I do appreciate it.

I’m surprised and annoyed that I can’t restore my Mag. to the working version.
I thought that if I use all working code and BD backups all will be as it was but clearly, it is not.

Pawel

Could you please attach composer.json?
Or check which version of magento is written at the moment
Also
bin/magento module:status check if it runs and disable recapcha to proceed with compile

composer J ap.zip (1.6 KB)

Please find my composer.json file attached.

I run the command
bin/magento module:status
it works and I see that all ReCaptcha modules are enabled.

recaptcha

It might be a stupid question but how do I disable the module via CLI?

I tried this
bin/magento recaptchacheckout::disable but it didn’t work. I was quite guessing the command.

I am away, I ll see composer.json as soon as I get home.

Disabling module you do
bin/magento module:status (you get the list) and then

bin/magento module:disable HERE YOU COPY ANYTHING YOU NEED DISABLED FROM LIST

EXAMPLE:
bin/magento module:disable Magento_Csp

It was so easy to disable the module. Thank you for this command.

I successfully disabled ReCaptchaCheckout and tried to run again setup:di:compile.

The same error message is presented.

“version”: “2.4.1”,

At the moment you have 2.4.1 Version on your composer.json and your composer require 2.4.2 Cause you mentioned that you had 2.4.2 and you update it on 2.4.3-p1.

Let’s focus a bit on the facts: You had a working live site on 2.4.2 with last backup on November 2021.
At the moment you got a broken magento instance and you’ve done few attempts to rollback.

In my opinion you should

  1. take a copy of the backup to your pc via ftp _ only copy
  2. run again
  • composer clearcache
  • composer update
  • composer require magento/product-community-edition 2.4.2 --no-update
  • composer update
  • rm -rf var/cache/* var/page_cache/* var/generation/*
  • php bin/magento setup:upgrade (if you see any error or version mismatch you have to edit composer.json to the required version - For example 2.4.2 require version up to 3.2.2.1 but your composer requires 3.4 at the moment and this produces an error. you have to edit 3.4 to 3.2.2.1 and then composer update
  • php bin/magento setup:di:compile
  • php bin/magento indexer:reindex

If everything goes as planned, check that you have a running magento instance and access to admin page and then run the backup rollback command

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.