Fresh Ubuntu 18.04 LTS Install : Virtualmin install fails : Can't locate Virtualmin/Config.pm

Hi,

I am trying to provision a new server with VirtualMin on Ubuntu 18.04.

I've done this a number of times in the past without issue but now it's giving me problems.

Ubuntu 18.04.4 LTS

Virtualmin GPL installer, version 6.1.1

Completes Phase 1 and 2 no problem, then in Phase 3 ir fails :

[INFO] Started installation log in /root/virtualmin-install.log

▣□□ Phase 1 of 3: Setup
Downloading RPM-GPG-KEY-virtualmin-6                                    [  ✔  ]
Downloading RPM-GPG-KEY-webmin                                          [  ✔  ]
Installing Virtualmin 6 key                                             [  ✔  ]
Installing Webmin key                                                   [  ✔  ]
Updating apt metadata                                                   [  ✔  ]
Downloading repository metadata                                         [  ✔  ]
Enabling universe repositories, if not already available                [  ✔  ]
Disabling cdrom: repositories                                           [  ✔  ]
Cleaning out old metadata                                               [  ✔  ]

▣▣□ Phase 2 of 3: Installation
Installing Webmin                                                       [  ✔  ]
Installing Usermin                                                      [  ✔  ]
Installing fail2ban                                                     [  ✔  ]
Removing nginx (if installed) before LAMP installation.                 [  ✔  ]
Removing unneeded packages that could confict with LAMP stack.          [  ✔  ]
Installing postfix                                                      [  ✔  ]
Installing virtualmin-lamp-stack                                        [  ✔  ]
Installing Virtualmin and plugins                                       [  ✔  ]
22 May 11:49:14 ntpdate[72508]: adjust time server 91.189.89.198 offset -0.004374 sec
Installing updates to Virtualmin-related packages                       [  ✔  ]

▣▣▣ Phase 3 of 3: Configuration
Can't locate Virtualmin/Config.pm in @INC (you may need to install the Virtualmin::Config module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/bin/virtualmin-config-system line 9.
BEGIN failed--compilation aborted at /usr/bin/virtualmin-config-system line 9.
▣▣▣ Cleaning up

Inspecting the /usr/bin/virtualmin-config-system PERL Script, it seems to have a problem using Virtualmin::Config;

#!/usr/bin/env perl
use strict;
use warnings;
use 5.010_001;
use Getopt::Long;
BEGIN { $Pod::Usage::Formatter = 'Pod::Text::Color'; }
use Pod::Usage qw(pod2usage);
use Term::ANSIColor qw(:constants);
use Virtualmin::Config;

Install Log file (last 10 lines)

Installing Virtualmin and plugins: Success. Spin pid is: 72510 Reading package lists... Building dependency tree... Reading state information... postfix is already the newest version (3.3.0-1ubuntu0.2). virtualmin-lamp-stack is already the newest version (6.0.9+ubuntu-18.04). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Installing updates to Virtualmin-related packages: Success. [2020-05-22 11:49:16 UTC] [DEBUG] Phase 3 of 3: Configuration [2020-05-22 11:49:16 UTC] [DEBUG] Cleaning up temporary files in /tmp/.virtualmin-38190. [2020-05-22 11:49:16 UTC] [WARNING] The following errors occurred during installation: <code>   I'm not sure what has changed here, I doubt the Ubuntu "out of box" PERL has changed, has something gone ary in your install scripts??   <strong>Please help urgently!</strong> This is time sensitive (I know not your problem but am desperate!)
Status: 
Fixed (pending)

Comments

Blatant's picture
Submitted by Blatant on Fri, 05/22/2020 - 07:07

FYI,

I had an older installer handy

Welcome to the Virtualmin GPL installer, version 6.0.18

This one also fails :

▣▣▣ Phase 3 of 3: Configuration
Can't locate Virtualmin/Config.pm in @INC (you may need to install the Virtualmin::Config module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/bin/virtualmin-config-system line 9.
BEGIN failed--compilation aborted at /usr/bin/virtualmin-config-system line 9.
▣▣▣ Cleaning up

[WARNING] The following errors occurred during installation:

  ◉ Postinstall configuration returned an error.
[WARNING] The last few lines of the log file were:
Setting up liblog-dispatch-perl (2.67-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Installing Virtualmin and plugins: Success.
Spin pid is: 114133
Reading package lists...
Building dependency tree...
Reading state information...
postfix is already the newest version (3.3.0-1ubuntu0.2).
virtualmin-lamp-stack is already the newest version (6.0.9+ubuntu-18.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Installing updates to Virtualmin-related packages: Success.
[2020-05-22 12:05:18 UTC] [DEBUG] Phase 3 of 3: Configuration
[2020-05-22 12:05:18 UTC] [DEBUG] Cleaning up temporary files in /tmp/.virtualmin-79040.
[2020-05-22 12:05:18 UTC] [WARNING] The following errors occurred during installation:
[2020-05-22 12:05:18 UTC] [WARNING] The last few lines of the log file were:

What gives??? This installer was also run on a fresh Ubuntu 18.04 box!! :/

I have the same problem!

Blatant's picture
Submitted by Blatant on Fri, 05/22/2020 - 08:21

Status:
Active
»
Needs review

Well, well, well,

I've fixed the issue, seems its related to CVE-2016-1238, where PERL are changing the @INC variable, as a result the Directory Virtualmin::Config.pm resides in (/usr/share/perl5/vendor_perl) is not available in @INC. This seems to be a VERY recent change as I last installed Vmin with 6.0.19 installer a few months ago.

What's most impressive is I don't (didn't) even know PERL when I woke up this morning! lol, good job I'm a Lead Dev!!

To detail my fix :

To fix it I Modified the file /usr/bin/virtualmin-config-system with 1 line to push the directory VIrtualmin::Config.pm resides in, into the @INC.

The top 10 lines of the file including my patch on line 9 :

#!/usr/bin/env perl
use strict;
use warnings;
use 5.010_001;
use Getopt::Long;
BEGIN { $Pod::Usage::Formatter = 'Pod::Text::Color'; }
use Pod::Usage qw(pod2usage);
use Term::ANSIColor qw(:constants);
BEGIN { push @INC, '/usr/share/perl5/vendor_perl'; }
use Virtualmin::Config;

Now Rerunning installer (latest) yeids :

▣▣▣ Phase 3 of 3: Configuration
[1/23] Configuring AWStats                                              [  ✔  ]
[2/23] Configuring Apache                                               [  ✔  ]
[3/23] Configuring Bind                                                 [  ✔  ]
[4/23] Configuring ClamAV                                               [  ✔  ]
[5/23] Configuring Dovecot                                              [  ✔  ]
[6/23] Configuring Firewalld                                            [  ✔  ]
[7/23] Configuring MySQL                                                [  ✔  ]
[8/23] Configuring NTP                                                  [  ✔  ]
[9/23] Configuring Net                                                  [  ✔  ]
[10/23] Configuring ProFTPd                                             [  ✔  ]
[11/23] Configuring Procmail                                            [  ✔  ]
[12/23] Configuring Quotas                                              [  ✔  ]
[13/23] Configuring SASL                                                [  ✔  ]
[14/23] Configuring Shells                                              [  ✔  ]
[15/23] Configuring SpamAssassin                                        [  ✔  ]
[16/23] Configuring Status                                              [  ✔  ]
[17/23] Configuring Upgrade                                             [  ✔  ]
[18/23] Configuring Usermin                                             [  ✔  ]
[19/23] Configuring Webalizer                                           [  ✔  ]
[20/23] Configuring Webmin                                              ██████▒Stopping Webmin server in /usr/share/webmin ▒▒▒▒███Starting Webmin server in /usr/share/webmin                                                                                [  ✔  ]
[21/23] Configuring Fail2banFirewalld                                   [  ✔  ]
[22/23] Configuring Postfix                                             [  ✔  ]
[23/23] Configuring Virtualmin                                          [  ✔  ]
▣▣▣ Cleaning up

[SUCCESS] Installation Complete!
[SUCCESS] If there were no errors above, Virtualmin should be ready
[SUCCESS] to configure at https://XXXXX.XXXXX.XXX:10000 (or https://###.###.###.###:10000).
[SUCCESS] You'll receive a security warning in your browser on your first visit.

As expected!

(I realize there's a number of ways to inject the dir into the @INC, but this seemed the least destructive, I'd suggest reviewing the patch and using a method to include into @INC that satisfies the CVE above!)

Hope this helps someone!

Danny Walker (Cygnus)

Ilia's picture
Submitted by Ilia on Fri, 05/22/2020 - 08:04

Assigned: Unassigned »

Hi,

Confirmed. I will let Joe know.

Blatant's picture
Submitted by Blatant on Fri, 05/22/2020 - 08:15

Thanks @Ilia, Glad I could help! :)

@ataalla, did you give my fix a go?

@Blatant thanks, How did you start installer.sh from phase of 3?

regards

Blatant's picture
Submitted by Blatant on Fri, 05/22/2020 - 10:58

I just re-ran sh install.sh and 'y' twice (continue, and overwrite) :thumbsup:

It replays Phase 1 and 2 quite quickly....

Edit While it overwrites the components on second install, it does not seem to overwrite (or re-download) /usr/bin/virtualmin-config-system so the patch remains.

Joe's picture
Submitted by Joe on Fri, 05/22/2020 - 17:07 Pro Licensee

You can always run phase 3 with:

virtualmin config-system --bundle LAMP

(Or other bundles MiniLAMP, LEMP, MiniLEMP, depending on whether it is minimal and/or nginx install.)

The problem is not with the install script, it is, I guess, with the new virtualmin-config package that I just rolled out last night. I haven't figured out a fix yet, but working on it. I can't make the change suggested, as it is nonsensical on non-Ubuntu/Debian systems. I need a generic way to re-add vendor_perl or make sure it gets installed somewhere that is in @INC.

Joe's picture
Submitted by Joe on Fri, 05/22/2020 - 17:21 Pro Licensee

I have removed the new virtualmin-config package from the Debian/Ubuntu repos while I figure this out.

Can someone try the following: /bin/sh install.sh --uninstall and apt-get clean and then re-run the installer? (Please don't ever run --uninstall on a production system or one that has stuff you don't want to lose, as it is very destructive. It's only useful if you've got a fresh system with a failed install and need to run install again from sort of fresh again.)

Ilia's picture
Submitted by Ilia on Sat, 05/23/2020 - 08:01

I tried it - it's working just fine now for Debian.

Hi folks,

I've tried to make a Travis-CI validation build to verify that the installer can be run successfully on all grade A OSes (as document) with the hope that we could avoid the accident of failed build is deployed in the future. Take a look if you are interesting in: https://travis-ci.org/github/trinhpham/virtualmin-install/builds/690388157

My thoughts is very simple at the beginning: Virtualmin is an application which contains other applications and can be able to run on application layer of the OS, means I can validate the installation easily by using Docker. I was wrong! I found several issues which I need your help to make the test be possible: - 'ps' related script show error: process ID out of range - Installation on CentOS 7 seems to be failed with error, but the script still returns with code 0 (which makes it green) - The log doesn't have much information to debug when error happen

Should I keep moving on this?

Joe's picture
Submitted by Joe on Sat, 05/23/2020 - 17:31 Pro Licensee

Status:
Needs review
»
Fixed (pending)

hlvtrinh, please open a ticket over on github (on https://github.com/virtualmin/virtualmin-install ) if you want to discuss installing Virtualmin in a container. I doubt it will be trivial at all. Virtualmin itself is "an application" as you say, but the installer is installing and configuring dozens of applications, needs root access for all of it, and makes changes to system-level stuff that is normally not managed from within a container (like networking settings). I haven't even attempted to do a Docker installation of Virtualmin because so much will have to change. It is not a quick project. Good idea, but only if you have many hours...probably more like weeks...to devote to the project. I certainly don't have time to tackle something like that anytime soon.

Failing without error code being set should be fixable, though. I'll look into it.

I made a change to the packaging process to make the package put files back where they used to be (my build system has been completely rebuilt since 6.0.24 was packaged, so I can't even look to see why it was different, but I figured out a workaround, so future builds will work better). Will be fixed in the next package build.

I did not hit this issue just now when installing from the script on a new clean 18.04 server.

Just FYI.

Cheers Spart

Blatant's picture
Submitted by Blatant on Wed, 05/27/2020 - 05:09

Hey,

Sorry for late reply, we had a bank holiday and getting back into work in these "strange" times :)

I can confirm the current installer (6.1.1) works perfectly on Ubuntu 18.04.4 LTS.

@Joe (Hi!) I totally get my "fix" was way to hacky to be submitted lol, however I hope it was at least instrumental to make your life a bit easier with the debug! Am I seeing your new package in 6.1.1 or is it still pending release? I assume the latter and if so looks good, great work and thanks for the quick turnover!

I'm off now to eagerly await Ubuntu 20.04 support!