1

I did a Magento upgrade to version 2.4.2-p1. All went good, but in the logs I am getting this error message:

[2021-06-17 08:25:04] main.ERROR: There are no commands defined in the "setup:cron" namespace.

Did you mean one of these?
    setup
    setup:config
    setup:db
    setup:db-data
    setup:db-declaration
    setup:db-schema
    setup:di
    setup:performance
    setup:static-content
    setup:store-config
#0 /data/web/magento2/vendor/symfony/console/Application.php(657): Symfony\Component\Console\Application->findNamespace('setup:cron')
#1 /data/web/magento2/vendor/symfony/console/Application.php(237): Symfony\Component\Console\Application->find('setup:cron:run')
#2 /data/web/magento2/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /data/web/magento2/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /data/web/magento2/bin/magento(23): Symfony\Component\Console\Application->run()
#5 {main} [] []

This error prevents me to log in the admin panel or log in to my account, although other frontend pages are working ..

I found this similar issue: https://github.com/magento/magento2/issues/29872 I did a:

bin/magento cron:remove
bin/magento cron:install

But still didn't fix this issue. Any clue how to fix it ? Thank you

Crontab content:

#~ MAGENTO START 4e0174ce8466e99a2a8250c98c3279eb43a3c5471df8d5539c3c912d49638e0d
* * * * * sleep 2; flock -o -n ~/.b861095f.lock -c '/usr/bin/php7.3 /data/web/magento2/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /data/web/magento2/var/log/magento.cron.log'
#~ MAGENTO END 4e0174ce8466e99a2a8250c98c3279eb43a3c5471df8d5539c3c912d49638e0d
8
  • can you please share the content of your crontab? the part with magento crons Jun 17 at 8:35
  • 1
    @DianaBotean I've updated my post, please check Jun 17 at 8:40
  • looks good, not sure tho' where the setup:cron is called from. are you sure you are checking the correct crontab? it could be that you are updating the www-data and in fact the root one is on top of it. can you check this? Jun 17 at 8:49
  • 1
    I have nginx. I saw that I got 502 when I try to login into adminpanel or login in my account etc. By doing this: github.com/magento/magento2/issues/10049#issuecomment-658825113 , seems that my cronjob issue is fixed as well. I believe there was a memory issue, however I found this strange.. Jun 17 at 9:42
  • 1
    More details: soreninfotech.com/2021/02/01/… Jun 17 at 10:03
2

In magento 2.4 below cron command no longer exist

* * * * * /usr/bin/php /var/www/html/magento2/update/cron.php 
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento setup:cron:run

only below is exist

* * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run

so,please remove above cronjob from cpanel/cmd.

hope this helps you.

4
  • Yes, I did, if you check my updated post , you see that I only have the last part from your post. Thanks Jun 17 at 9:00
  • somewhere your cron is defined or scheduled before you remove so if scheduled from cpanel/cmd it will run till scheduled before you removed. Jun 17 at 9:30
  • what's output of 'crontab -l' ?? Jun 17 at 9:31
  • the output is the same as it is in my post. See Crontab content: Jun 17 at 9:40
0

I don't think this has anything to do with your cron in the crontab

Some file or module is trying to trigger setup:cron which is no longer there or register actions for setup:cron - that module needs updating, or that part of it disabling.

It could be a bit of 2.3 that wasn't cleaned out

First, I seem to vaguely remember there were some special actions that needed to be taken on one of the upgrades between 2.3 and 2.4 because of the change in updates, check the update notes of intermediate versions to make sure you didn't miss one.

Making sure composer is run with -W (all dependencies) on magento updates can help too

If nothing was missed, search in your tree if you can find "setup:cron" in a file - once you know who the culprit is, we can see what the next step is to fix it.

0

I ran into the same issue

My system.log file reports hundreds of these errors:

[2021-07-29 14:34:14] main.ERROR: There are no commands defined in the "setup:cron" namespace.

Did you mean one of these?
    setup
    setup:config
    setup:db
    setup:db-data
    setup:db-declaration
    setup:db-schema
    setup:di
    setup:performance
    setup:static-content
    setup:store-config
#0 /srv/public_html/vendor/symfony/console/Application.php(657): Symfony\Component\Console\Application->findNamespace('setup:cron')
#1 /srv/public_html/vendor/symfony/console/Application.php(237): Symfony\Component\Console\Application->find('setup:cron:run')
#2 /srv/public_html/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /srv/public_html/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /srv/public_html/bin/magento(23): Symfony\Component\Console\Application->run()
#5 {main} [] []

crontab -l

    #~ MAGENTO START 9195352b01afc628ab5497e3a61c902818138a7ebb9a591aefcff13e52e46b36
* * * * * /usr/local/bin/php /srv/public_html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /srv/public_html/var/log/magento.cron.log
#~ MAGENTO END 9195352b01afc628ab5497e3a61c902818138a7ebb9a591aefcff13e52e46b36

Cron.log

Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php
Could not open input file: /srv/public_html/update/cron.php

I tried to search under the vendor folder and under the app / code folder if any module contained setup:cron with grep -Ril "setup:cron"

unfortunately no module seems to contain this.

My system.log file is getting soooo heavy for this. Has anyone found a solution or could you help me? I am going crazy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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