Preview Website not working after restoring backup from another server

I've restored three domains after backing them up on another Virtualmin machine.

As I have no DNS pointing to the new machine, I am attempting to use the Preview Website function.

However for all domains it is throwing the error "Connections to IP addresses not on this system are not allowed : 88.208.192.186"

That is the main IP address of the system and as far as I can see it is configured properly in Webmin-->Network Configuration. (I am comparing to another server where this function is running properly, allbeing under Centos 5.5).

(I do realise that this may not be a bug and may be down to my specific config but I read a forum posting from someone with the same problem, and there directed to come here and file a bug report.)

Status: 
Closed (fixed)

Comments

The quick fix for this is to edit the file /etc/webmin/virtual-server/localips and add the line 88.208.192.186 to the file.

That should have happened automatically though. Was your system's main IP address changed recently?

Thanks so much, Jamie. That immediately solved the problem.

The file /etc/webmin/virtual-server/localips was not present at all. I looked on another of my servers to see the format, and seeing that the addresses are simply line separated, I added my three IP addresses and the Preview Website immediately worked.

To answer your question about the IP address changing recently, the server was literally commissioned on Wednesday morning. I supposed the provider could have assigned me a server that was built at some point in the past, and changed the IP address before allocating it to me.

I commissioned two servers at the same time, both from providers here in the UK - one with UK2 and one with Fasthosts (the client has a thing about eggs in one basket).

They are both built with Centos 6.2, and had virtualmin 3.90 installed by me within 30 mins of each other. Then I backed up three domains on each of two old servers, and restored them to the new ones. No problem on the UK2 machine, but the Fasthosts machine threw this error resulting from the absent localips file.

By the way, respect for the backup/restore functionality in Virtualmin. I can't imagine how many scenarios you must have had to keep in mind when building those scripts, and I did six servers (each with sub servers) without a single error aside from the issue posted here. Virtualmin rules. In fact to the point where I am about to ditch my Mac OS X Lion Server that I use for internal testing and replace with a linux box running Virtualmin. Thanks for a great product.

Very odd that the localips file was missing .. it should get generated automatically by the cron job /etc/webmin/virtual-server/collectinfo.pl , which usually runs hourly at least.

Does that cron job exist on your system? You can see by running crontab -l as root.

If it does exist, try running /etc/webmin/virtual-server/collectinfo.pl manually as root and see if it creates the localips file.

Hi Jamie,

Ok, we're getting to the crux of the issue here. Running crontab -l produces "var/spool/cron is not a directory, bailing out"

When I go to Webmin-->System-->Scheduled cron jobs, I get "The Cron jobs directory var/spool/cron does not exist. Maybe the module's configuration is incorrect, or Cron is not installed?"

Why would that directory be missing? Can i assume that other important cron jobs will be missing? In your opinion, can the situation be salvaged or should I rebuild the server?

Hmm, that's an unusual setting for the cron jobs -- normally, that would begin with a "/".

If you go into Webmin -> System -> Scheduled Cron Jobs -> Module Config -> System Configuration, what is "Crontab Directory" set to?

Sorry - that's my error in typing. In those references in my previous post, I should have typed /var/spool/cron and indeed that is what the setting you asked about is set to.

Okay, no problem. What do you get if you run this command:

ls -ld /var/spool/cron

On a CentOS 6 system, that normally looks like this:

$ ls -ld /var/spool/cron/
drwx------. 2 root root 4096 Apr  6 06:12 /var/spool/cron/

If that's missing altogether though, that could certainly cause some trouble!

Thanks for your help here guys, sincerely appreciated.

After our exchange last night I decided to rebuild the server to be on the safe side. However, the problem has happened again. Before virtualmin installation, with a fresh CentOS system, I check that the directory /var/spool/cron/ was present. However, after Virtualmin installation, that directory has been replaced with a file. The contents of that file are as follows:

# Check any software raid devices ( if they exist )
0 * * * * /opt/monitors/software-raid.pl
 
# Nightly yum updates
0 2 * * * yum update -y >> /dev/null 2>&1
 
# Regular ntp updates. ntpd can be sporadic in it's efficiency so we call this from cron
0 * * * * /usr/sbin/ntpdate ntp.live-servers.net >> /dev/null 2>&1
 
##################################################################
# Add your cronjobs below this line

I have now recreated the directory /var/spool/cron and placed that cron file inside it. I've also copied a file called root (which I found on another of my Virtualmin server) into the /var/spool/cron directory. That file contains:

55 7 * * * /etc/webmin/virtual-server/sendratings.pl
4,9,14,19,24,29,34,39,44,49,54,59 * * * * /etc/webmin/virtual-server/collectinfo.pl
47 13 * * * /etc/webmin/virtual-server/scriptlatest.pl
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /etc/webmin/status/monitor.pl
55 5 * * * /etc/webmin/virtualmin-awstats/awstats.pl irbpassport.com
30 2 * * * /etc/webmin/webalizer/webalizer.pl /var/log/virtualmin/irbpassport.com_access_log
44 * * * * /etc/webmin/virtual-server/spamconfig.pl
25 8 * * * /etc/webmin/virtualmin-awstats/awstats.pl irblaws.com
40 5 * * * /etc/webmin/webalizer/webalizer.pl /var/log/virtualmin/irblaws.com_access_log
36 14 * * * /etc/webmin/virtualmin-awstats/awstats.pl keeprugbyclean.com
9 5 * * * /etc/webmin/webalizer/webalizer.pl /var/log/virtualmin/keeprugbyclean.com_access_log

I can now see these through Webmin.

Are those actions I've taken correct, and any ideas what's happened here during installation?

ADDENDUM: On checking my virtualmin-install.log, I find these lines:

  Installing : wbm-virtual-server-3.90.gpl-2.noarch                        2/28 
virtual-server
virtual-server/postinstall.pl failed : virtual-server::module_install failed : Cron jobs cannot be managed on your system, as the module configuration is not valid : The Cron jobs directory <tt>/var/spool/cron</tt> does not exist. Maybe the module's configuration is incorrect, or Cron is not installed? at web-lib-funcs.pl line 1360.

Interesting ... it seems like maybe the /var/spool/cron directory got somehow deleted during the install process.

Which Linux distribution and version are you installing onto there? Also, is this a freshly installed system from a CD, or a pre-installed system or VM?

Hi Jamie,

I just ran another server rebuild, and I apologise for misleading you earlier - I can confirm that immediately after install of CentOS 6.2, /var/spool/cron is a file, not a directory.

This is causing cron to fail to start. When I run /etc/init.d/crond status I get crond dead but pid file exists

And when I run /etc/init.d/crond start I get

Starting crond: '/var/spool/cron' is not a directory, bailing out.
                                                           [FAILED]

To answer your question about the OS, this is Centos 6.2 installed on a dedicated server by a UK commercial provider. It looks like they've done something to the distro, and I can only assume that they have erroneously overwritten the cron directory with a file. I can't believe they would be intentionally selling servers on which cron will not start.

I have now replaced the file with an empty directory, and crond successfully started right away.

I'll now try installing Virtualmin again, and will let you know the outcome.

Ok .. let us know how it goes. /var/spool/cron being a file instead of a directory certainly looks like a major problem with the install..

Well Jamie, that ran fine, Virtualmin installed with no errors and is now running fine.

I've lodged a support ticket with the provider to ask, nicely of course, whether /var/spool/cron being a file rather than a directory is an intentional move on their part. It's impossible to think that it is, as they'd be deliberately deploying a CentOS build on which cron simply won't run.

I've had no reply as yet, but I'll let you when I hear. I suppose if there is a version of CentOS kicking around with this strange characteristic, you might want to amend your install script to allow for the scenario.

As expected, the response from Fasthosts:

Your issue highlighted a problem with the build process for your server. /var/spool/cron should indeed be a directory, not a file. If you rebuild your server, this issue will be fixed.
 
If you do not want to rebuild, the fix is simple enough. Log in as root via SSH and execute the following:
 
cd /var/spool
mv cron root
mkdir cron
mv root cron/

So this is not a Virtualmin bug and never was; so Jamie, I guess you can feel free to close this thread.

Thanks for looking into all that!

That certainly explains the issues you were running into.

Feel free to let us know if you have any other questions!

Automatically closed -- issue fixed for 2 weeks with no activity.