0

I'll start from the beginning:

Case: I have to update from an OTRS 5 (already in use for years) to OTRS 6.

I followed Update from OTRS 5 to OTRS 6 of the OTRS Docs.

I did everything as described until it comes to converting the XML configuration files. Therefor I need Perl.

The default installed Perl version is 5.10.*. For converting those XML, I need at least 5.16.*.

I installed Perl-5.20.* manually by downloading the .gz and following installation instructions.

Command 'perl -v' still shows perl-5.10.

I googled how to switch between several Perl versions and found "perlbrew". I installed it. I used the command: perlbrew list. This should show me all installed perls. It didn't show me nothing. So I installed Perl v.5.26.* via Perlbrew and switched to it. It seemed to work.

Using command perl -v still shows me Perl-5.10.*.

I read through the whole internet. I however can't switch to a new Perl version, so I can't convert those XMLs. Because the Migration Script still tells me, there is Perl 5.10 installed and at least 5.16 needed.

What am I doing wrong?

simbabque
  • 53,749
  • 8
  • 73
  • 136
  • If you manually compile a Perl, you need to specifically use it. `perl` on the command line will use whatever is in your `PATH`. That's probably the system Perl. Perlbrew doesn't know about the Perls you've compiled yourself outside of it. It only sees the system Perl and its own Perls. How did you _switch_ to your 5.26? – simbabque Apr 25 '18 at 11:32
  • Where did you see that you require a Perl 5.16? Does the migration helper script explicitly say that? – simbabque Apr 25 '18 at 11:34
  • `perlbrew` is a good approach. What is the result when you say `perlbrew use perl-5.26.2` and then immediately after `which perl` and `perl -v`? – haukex Apr 25 '18 at 11:54
  • @simbabque Oh, okay. I switched to 5.26 using command "perlbrew switch perl-5.26.2. Yes, the OTRS Migration Tool explicitly asks for perl v5.16. – user9696859 Apr 26 '18 at 15:31
  • @haukex In all cases it returns perl-5.26.2. But when I try to use that migration tool, it still returns that I´m using perl-5.10. – user9696859 Apr 26 '18 at 15:31
  • @haukex https://i.stack.imgur.com/qw3WS.png – user9696859 Apr 27 '18 at 12:34

1 Answers1

0

The shebang line of otrs.Console.pl is #!/usr/bin/perl, which means that when you run it from the command line as bin/otrs.Console.pl, it will use /usr/bin/perl, regardless of what other perls you have installed.

Either run the command as perl bin/otrs.Console.pl ..., or change the first line of otrs.Console.pl into #!/usr/bin/env perl.

Edit as per the discussion in the comments: You needed to run the command as the otrs user, and you were trying to do so via su otrs .... The issue with that is that perlbrew will by default install its perls only for the current user. So you need to first log in as the otrs user, then use perlbrew to install and switch to a newer Perl, and then apply one of the solutions I suggested above.

haukex
  • 2,973
  • 9
  • 21
  • After changing the first line as proposed and installing all necessary modules (DateTime and DBI) I get following error: bin/otrs.Console.pl: line 21, 22 and 24: use: command not found line 25: syntax error near unexpected token `(' line 25:`use FindBin qw($RealBin);' – user9696859 Apr 30 '18 at 10:14
  • @user9696859 Did you try just running the command as `perl bin/otrs.Console.pl ...`? In [the screenshot](https://i.stack.imgur.com/sOK14.png) (from your proposed edit - you should have posted it as a comment instead) you seem to be running the command with `su otrs bin/otrs.Console.pl`, which was not my suggestion. – haukex Apr 30 '18 at 10:41
  • @user9696859 The same way you did [in this comment](https://stackoverflow.com/questions/50020799/switch-to-new-installed-perl-version-for-migrating-otrs-config-files-on-centos-6/50074649#comment87141462_50020799). – haukex Apr 30 '18 at 12:23
  • I also tried it with: su otrs perl bin/otrs.Console.pl the console returns: "/usr/bin/perl: /usr/bin/perl: cannot execute binary file" Sorry, entweder stelle ich mich zu dumm an oder iwas stimmt nicht... Danke für deine Geduld – user9696859 Apr 30 '18 at 12:37
  • @user9696859 Try it *without* the `su otrs`, *just* `perl bin/otrs.Console.pl ...` (Ich hoffe, damit klappt's.) - or at least without the `orts`, you might need `su` (but be careful with that). – haukex Apr 30 '18 at 12:46
  • If I try it with the root user, it tells me to run it with the otrs User, which is "otrs". That´s why I tried it with "su otrs". Without "otrs" it tells me, that the user perl doesn´t exist -.- – user9696859 May 02 '18 at 08:59
  • How do I use "su" in this case? Isn´t it used to "use" a different user? I don´t get it... – user9696859 May 02 '18 at 09:19
  • Now I logged on as the otrs user. The first line of otrs.Console.pl is changed to ´#!/usr/bin/env perl´. It still tells me, that perl v.5.16.0 is required and that only perl v5.10.1 is installed... – user9696859 May 02 '18 at 09:49
  • Ah, now I think I see more clearly what's going on. Note that `perlbrew` only installs Perl for the current user. 1. Log in as the `otrs` user. 2. Use `perlbrew` to install a newer Perl. 3. Try running `perl bin/otrs.Console.pl ...` (without `su`). – haukex May 02 '18 at 20:18
  • Thank you very much! This helped to solve my problem. Everything worked out fine! Du hast mich gerettet! :) – user9696859 May 04 '18 at 09:07
  • @user9696859 Glad to help! I've edited the answer to include the extra information. – haukex May 06 '18 at 15:21
  • Thank you again! :) – user9696859 May 08 '18 at 09:10