Defect #36231

https://stackoverflow.com/questions/69910539/minimagickerror-you-must-have-imagemagick-or-graphicsmagick-installed-on-red

Added by Jan Catrysse about 1 year ago. Updated 9 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Gantt
Target version:-
Resolution:Duplicate Affected version:4.2.3

Description

I get an error about a missing ImageMagick installation when exporting a Redmine Gantt chart to PNG. But I cannot pin down the reason because everything seems to be installed correctly, and I have an identical server with the same OS, same Redmine version / config and the same packages etc. installed. On the other (test) server, it all seems to work.

What could be the issue, or how can I pin it down?

Some more in depth information:

Error in the logs:

    Started GET "/projects/migratie/issues/gantt.png

    MiniMagick::Error (You must have ImageMagick or GraphicsMagick installed):

    lib/redmine/helpers/gantt.rb:399:in `to_image'
    app/controllers/gantts_controller.rb:46:in `block (2 levels) in show'
    app/controllers/gantts_controller.rb:42:in `show'
    lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Redmine information:

    Redmine 4.2.3.stable
    Standaard beheerderaccount gewijzigd     
    Bestandsrepository schrijfbaar     
    Plugin assets map schrijfbaar (./public/plugin_assets)     
    MiniMagick beschikbaar (optioneel)     
    ImageMagick comversie beschikbaar (optioneel)     
    ImageMagick PDF support available (optional)     

    Environment:
      Redmine version                4.2.3.stable
      Ruby version                   2.7.4-p191 (2021-07-07) [amd64-freebsd13]
      Rails version                  5.2.6
      Environment                    production
      Database adapter               Mysql2
      Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
      Mailer delivery                sendmail
    SCM:
      Git                            2.33.1
      Filesystem                     
    Redmine plugins:
      easy_gantt                     1.13
      redmine_agile                  1.6.2
      redmine_checklists             3.1.20
      redmine_contacts               4.3.4
      redmine_contacts_helpdesk      4.1.12
      redmine_contacts_invoices      4.2.5
      redmine_crm_mailchimp          1.0.4
      redmine_datetime_custom_field  1.0.4
      redmine_drive                  1.1.1
      redmine_editauthor             0.11.0
      redmine_favorite_projects      2.1.1
      redmine_finance                2.1.7
      redmine_helpdesk_contact_sync  0.0.4.1
      redmine_issue_templates        1.1.0
      redmine_people                 1.6.1
      redmine_products               2.1.4
      redmine_questions              1.0.2
      redmine_reporter               2.0.0
      redmine_resources              1.0.6
      redmine_tint_issues            1.2.1
      redmine_view_issue_description 0.0.2
      redmine_zenedit                2.0.1
      redmineup_tags                 2.0.11
      stopwatch                      0.2.0

Verified steps: please bear in mind that it works on the test server.

1. Same FreeBSD version 13.0-release
2. Same Redmine 4.2.3 version, configuration and plugins (I did a directory compare)
3. ImageMagick7 installed, tested (convert and magick command) and executes as www user, available in the path env. Same options and confirmed PNG support.
4. Gem mini_magick (4.11.0, 4.10.1) installed.
5. Bundle: Using mini_magick 4.11.0 in /usr/local/www/redmine
6. configuration.yml (with two leading spaces): imagemagick_convert_command: /usr/local/bin/convert
7. Other converts (eg. pdf) in Redmine seem to work fine on both servers.
8. Moving to another database does not change a thing.
9. Apache config is identical.


Related issues

Duplicates Redmine - Defect #35424: https://www.redmine.org/boards/2/topics/65661 Reopened

History

#1 Updated by Jan Catrysse about 1 year ago

Sorry for the wrong title, I cannot change it back anymore.

#2 Updated by Go MAEDA 11 months ago

Does applying the patch in #35027#note-1 resolve the issue?

#3 Updated by Jan Catrysse 11 months ago

Go MAEDA wrote:

Does applying the patch in #35027#note-1 resolve the issue?

No, this did not make a difference. I cannot point my finger on the reason... on another server with, as far as I can see, an identical configuration it works fine.

Could someone tell me how I can activate logging on production to have some more detailed information when I get the error?

#4 Updated by Jan Catrysse 11 months ago

I added this line to the patched area in gantt.rb

if Redmine::Configuration['imagemagick_convert_command'].present?
    MiniMagick.cli_path = File.dirname(Redmine::Configuration['imagemagick_convert_command'])
    MiniMagick.logger.level = Logger::DEBUG
end

In development and test, this outputs a nice convert command line in my httpd_error_log ... on production nothing.

I first tried with a deprecated MiniMagick.debug = true, and this is outputting a deprecated warning, also on production. So, this means Redmine::Configuration['imagemagick_convert_command'].present is true.

So, the issue must really be related to MiniMagick ... or me having done something stupid.

I double-checked Redmine::Configuration['imagemagick_convert_command'] with some logging... and it seems to be correct.

#5 Updated by Jan Catrysse 9 months ago

I was testing this again, and now it doesn't work on either environments: test, dev nor production. I am not sure what changed in between tests, probably some updated gems.

This is related to issue #35424.

The errors seems to come from: \usr\local\lib\ruby\gems\2.7\gems\mini_magick-4.11.0

    def cli
      if instance_variable_defined?("@cli")
        instance_variable_get("@cli")
      else
        cli = CLI_DETECTION.key(processor) or
          fail MiniMagick::Error, "You must have ImageMagick or GraphicsMagick installed" 

        instance_variable_set("@cli", cli)
      end
    end

#6 Updated by Marius BALTEANU 9 months ago

Do you have any error in your logs?

#7 Updated by Jan Catrysse 9 months ago

No, nothing in the logs.

I added some info on: #35424.

#8 Updated by Jan Catrysse 9 months ago

I did fount this in my log, but I don't think it helps.

MiniMagick::Error (You must have ImageMagick or GraphicsMagick installed):

lib/redmine/helpers/gantt.rb:402:in `to_image'
app/controllers/gantts_controller.rb:46:in `block (2 levels) in show'
app/controllers/gantts_controller.rb:42:in `show'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

#9 Updated by Jan Catrysse 9 months ago

I fixed this by changing MiniMagick.cli = :imagemagick to lib/redmine/helpers/gantt.rb

if Redmine::Configuration['imagemagick_convert_command'].present?
    MiniMagick.cli_path = File.dirname(Redmine::Configuration['imagemagick_convert_command'])
    MiniMagick.cli = :imagemagick
end

#10 Updated by Jan Catrysse 9 months ago

  • Status changed from New to Resolved

#11 Updated by Marius BALTEANU 9 months ago

  • Status changed from Resolved to Closed
  • Resolution set to Duplicate

Closed in favour of #35424.

#12 Updated by Marius BALTEANU 9 months ago

  • Duplicates Defect #35424: https://www.redmine.org/boards/2/topics/65661 added

Also available in: Atom PDF