The /etc/webmin/apache/config file contains obsolete command

Everyday our CentOS 7.x customer servers send the error messages with the title "Anacron job 'cron.daily' on ns1.host.tld" and content:

/etc/cron.daily/logrotate:

Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.

Troubleshooting this issue, I looked high and low and I have a guess this issue might be caused by an obsolete command in /etc/webmin/apache/config file:

apply_cmd=service httpd graceful

If you run this command in CLI then it gives:

service httpd graceful
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.

Even if these issues are not related, this particular command must be removed or replaced by some other legitimate command like, for example:

apachectl graceful

Thanks!

Status: 
Active

Comments

Howdy -- take a peek in Webmin -> Servers -> Apache -> Module Config -> System Configuration.

There, what is "Command to apply configuration" set to?

Also, did you perhaps migrate to this server from an older one? Or is this a fresh install and a fresh Webmin/Virtualmin configuration?

As the screenshot shows it is "service httpd graceful". What option or exact command should be here for RHEL 7.x based Virtualmin systems?

The server is a fresh CentOS 7.x install, but Virtualmin configuration was copied from another server. Anyway, even if this setting came from Virtualmin configuration backup file, there should be a check somewhere in the middle to verify the RHEL version and replace the faulty command.

Try setting that to the following:

apache2ctl graceful

That will only affect new Virtual Servers though; the command located in /etc/logrotate.conf would need to be manually updated.

Just so you know, the "apache2ctl graceful" command didn't work on CentOS 7.x, but the "apachectl graceful" did.

root@centos7:/root# apache2ctl graceful -bash: apache2ctl: command not found root@centos7:/root# apachectl graceful

Anyway, my original request was to update the obsolete command in /etc/webmin/apache/config for RHEL 7.x systems. So maybe we need to get the following three commands:

stop_cmd=service httpd stop
start_cmd=service httpd start
apply_cmd=service httpd graceful

replaced respectively by:

stop_cmd=systemctl stop httpd
start_cmd=systemctl start httpd
apply_cmd=apachectl graceful

?

Yes, those commands you're showing there are the correct ones for the start and stop commands.

I suspect those are settings that were pulled in from your old server, though I'll double-check on a test system here that a newly installed CentOS 7 system is using the correct commands.

Here is the content of freshly installed CentOS 7.x Virtualmin system:

test_manual=0
show_list=1
mime_types=/etc/mime.types
auto_mods=1
stop_cmd=service httpd stop
pid_file=/run/httpd/httpd.pid
test_apachectl=1
max_servers=100
httpd_dir=/etc/httpd
start_cmd=service httpd start
show_order=0
test_always=0
apachectl_path=/usr/sbin/apachectl
show_names=0
test_config=1
apply_cmd=service httpd reload
httpd_path=/usr/sbin/httpd
allow_virtualmin=0

So please make sure to replace the commands as suggested above. The "service httpd reload" command for the "apply_cmd" option could be replaced with systemctl reload httpd instead of apachectl graceful, but I am not sure which one is more appropriate.

Good suggestion .. I will do this for new installs in the next Webmin release.

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

Please note "apply_cmd" should be equal to systemctl reload httpd and not apachectl graceful otherwise Anacron keeps sending the following message:

/etc/cron.daily/logrotate:

Redirecting to /bin/systemctl reload  httpd.service
Redirecting to /bin/systemctl reload  httpd.service

What happens if you run apachectl graceful on your system?

It executes without without any warnings, however if apachectl graceful is left in the Webmin config file for Apache then the system sends the above notification message, so I believe the ideal value for apply_cmd= should be systemctl reload httpd.

Moreover, I noticed another empty value in the file:

graceful_cmd=

which probably should be equal to apachectl graceful.

In the same manner I suggest to replace

service mariadb start
service mariadb stop

in /etc/webmin/mysql/config with

systemctl start mariadb
systemctl stop mariadb

For that matter all RHEL 6.x style service name command need to be replaced by RHEL 7.x style systemctl command name.

I've found the following incidents:

cat /etc/webmin/*/* | grep '_cmd=service'
stop_cmd=service named stop
start_cmd=service named start
stop_cmd=service dhcpd stop
restart_cmd=service dhcpd restart
start_cmd=service dhcpd start
start_cmd=service ipsec start
stop_cmd=service ipsec stop
restart_cmd=service ipsec restart
start_cmd=service tgtd start
stop_cmd=service tgtd stop
restart_cmd=service tgtd restart
cat: start_cmd=service slapd start
stop_cmd=service slapd stop
apply_cmd=service slapd restart
stop_cmd=service cups stop
start_cmd=service cups start
stop_cmd=service postgresql stop
start_cmd=service postgresql start
start_cmd=service proftpd start
stop_cmd=service proftpd stop
stop_cmd=service smb stop
start_cmd=service smb start
start_cmd=service sshd start
stop_cmd=service sshd stop
restart_cmd=service rsyslog reload
start_cmd=service rsyslog start
start_cmd=service syslog-ng start
stop_cmd=service syslog-ng stop
start_cmd=service xinetd start

Doesn't the reload command completely stop and re-start Apache though? Whereas graceful just tells it to re-read the config.

Doesn't the reload command completely stop and re-start Apache though? Whereas graceful just tells it to re-read the config.

I am not sure, Jamie, but that might be true for RHEL 6.x. As I said before on RHEL 7.x the system sends the following notice:

/etc/cron.daily/logrotate:

Redirecting to /bin/systemctl reload  httpd.service
Redirecting to /bin/systemctl reload  httpd.service

so it is redirecting graceful to reload anyway, then why we don't make it easier for the system and use the correct command without redirecting it?

Please also read http://www.cyberciti.biz/faq/apache-making-changes-config-file-without-r... which seems to imply both are the same.

The accepted answer on another thread http://stackoverflow.com/questions/671667/apache-httpd-reload compares restart and reload:

/my/path/to/httpd restart Causes the current httpd process to exit, which means for a time the server appears to be down, as in not serving any requests.

    /my/path/to/httpd reload Does not cause the current server to exit, which means connections are never refused and thus the server never looks down (but is rather slow for a little while)

Also, will you please replace all these commands:

cat /etc/webmin/<em>/</em> | grep '_cmd=service'
stop_cmd=service named stop
start_cmd=service named start
stop_cmd=service dhcpd stop
restart_cmd=service dhcpd restart
start_cmd=service dhcpd start
start_cmd=service ipsec start
stop_cmd=service ipsec stop
restart_cmd=service ipsec restart
start_cmd=service tgtd start
stop_cmd=service tgtd stop
restart_cmd=service tgtd restart
cat: start_cmd=service slapd start
stop_cmd=service slapd stop
apply_cmd=service slapd restart
stop_cmd=service cups stop
start_cmd=service cups start
stop_cmd=service postgresql stop
start_cmd=service postgresql start
start_cmd=service proftpd start
stop_cmd=service proftpd stop
stop_cmd=service smb stop
start_cmd=service smb start
start_cmd=service sshd start
stop_cmd=service sshd stop
restart_cmd=service rsyslog reload
start_cmd=service rsyslog start
start_cmd=service syslog-ng start
stop_cmd=service syslog-ng stop
start_cmd=service xinetd start

Ok, the next Webmin release will include these changes (for Apache).

I'm reluctant to use systemctl more widely, as the service command is compatible with more distributions.

I'm reluctant to use systemctl more widely, as the service command is compatible with more distributions.

I see your concern, however you have different repositories for different OS distributions, don't you? If so then you can safely replace all commands in RHEL 7.x-based distributions (https://en.wikipedia.org/wiki/List_of_Linux_distributions#RHEL-based) since RHEL 7.x switched to "systemctl command service-name" format and all the consecutive releases will do too.

Moreover, you can switch one level up and replace all "service" commands on Fedora-based distributions (https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet), because it was not RHEL, but Fedora which made a shift: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

Please also read https://fedoraproject.org/wiki/Systemd and especially pay attention to this quote from https://docs.fedoraproject.org/en-US/Fedora/18/html/Installation_Guide/s...

Expect legacy commands to be deprecated!

systemctl fully replaces traditional utilites like service and chkconfig. While some services can still be administered with these legacy commands, all services can be administered with systemctl.

So "service ..." will be eventually deprecated on Fedora-based distros. Then why wait, especially when Virtualmin is sending unnecessary reports because of the old-style commands?

Diabolico's picture
Submitted by Diabolico on Sun, 10/04/2015 - 15:59

Ok, the next Webmin release will include these changes (for Apache). I would like to know when we can expect this?

While I don't have an exact day, the next Virtualmin release is expected very soon. Within the next few days.

Hi Jamie,

I would still love to hear your stance on the following quote from:

https://fedoraproject.org/wiki/Systemd and especially pay attention to this quote from https://docs.fedoraproject.org/en-US/Fedora/18/html/Installation_Guide/s...

Expect legacy commands to be deprecated!

systemctl fully replaces traditional utilites like service and chkconfig. While some services can still be administered with these legacy commands, all services can be administered with systemctl.

Please try to understand while it is ok to leave "service ..." style commands on Debian based distros, all of them should be replaced by "systemctl ..." style on Fedora-based distros. Otherwise, Virtualmin/Webmin based systems will just keep sending unnecessary notification messages to root mail. Which is really annoying.

Unfortunately, all CentOS 7.x based Virtualmin systems keep sending everyday notifications to root like:

/etc/cron.daily/logrotate:

Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.

And it is really annoying as we can't block the root messages to be able to receive other important notifications. So I am afraid all "service" like commands have to be replaced systemwide.

Yes, you will need to change the .conf files for your websites in /etc/logrotate.d to use your preferred Apache restart command.

While Jamie will be pushing out a release that changes the default command used for new installs, that shouldn't change any existing config files. Existing config files will need to be manually updated.

Eric,

Please read the issue from the very beginning. Jamie doesn't want to replace all "service" like style commands as he thinks it is more universal. Which is true as it works on other distros like Debian, Ubuntu. However as I explained above Fedora-based systems like RHEL, CentOS, Scientific Linux, etc will eventually completely switch to "systemctl" style commands.

Manually editing is not helpful as (1) we have lot's of such servers and (2) the next update from Virtualmin repository could override our changes. And that is why I am asking Jamie and the team to really pay attention to above stated changes in Fedora-world. You really can not ignore them and eventually will have to replace all "service" like commands to "systemctl" like ones, however the problem is that until then all Fedora 7.x based Virtualmin server owners have to suffer from receiving unnecessary notifications. It is extremely problematic when you have lot's of Virtualmin servers.

Yes, I'm aware of what you're describing.

What I'm saying is that Virtualmin can't tell whether the commands being used within logrotate are what the administrator wants, or whether the administrator wants it replaced.

In fact, you mentioned this here:

the next update from Virtualmin repository could override our changes

That's exactly what Virtualmin would seek to avoid, it can never tell if a user wants the config being used.

Because of that, I do not believe that Virtualmin would attempt to change any existing logrotation configuration. I believe Jamie would only have it change the config for newly added domains.

We can of course verify this with Jamie before making any changes, but I think you're going to need to manually change any existing configuration.

There are ways to mass change that, you wouldn't necessarily need to edit each and every config file individually.

For example, disabling the logrotate feature, and then re-enabling it, would cause it to be re-written using whatever Apache restart command you currently have setup.

So you could simply run these two commands:

virtualmin disable-feature --all-domains --logrotate
virtualmin enable-feature --all-domains --logrotate

And that will re-write all the log rotation config files for each of your websites on that server, with whatever the Apache restart command is currently set to.

Thanks Eric,

We will try to manually update logrotate on all previously existing servers. However, I still believe there is no much sense in keeping the following obsolete commands in Fedora-based systems, they all need to be replaced as otherwise Virtualmin systems will keep sending unnecessary notifications:

cat /etc/webmin/<em>/</em> | grep '_cmd=service'
stop_cmd=service named stop
start_cmd=service named start
stop_cmd=service dhcpd stop
restart_cmd=service dhcpd restart
start_cmd=service dhcpd start
start_cmd=service ipsec start
stop_cmd=service ipsec stop
restart_cmd=service ipsec restart
start_cmd=service tgtd start
stop_cmd=service tgtd stop
restart_cmd=service tgtd restart
cat: start_cmd=service slapd start
stop_cmd=service slapd stop
apply_cmd=service slapd restart
stop_cmd=service cups stop
start_cmd=service cups start
stop_cmd=service postgresql stop
start_cmd=service postgresql start
start_cmd=service proftpd start
stop_cmd=service proftpd stop
stop_cmd=service smb stop
start_cmd=service smb start
start_cmd=service sshd start
stop_cmd=service sshd stop
restart_cmd=service rsyslog reload
start_cmd=service rsyslog start
start_cmd=service syslog-ng start
stop_cmd=service syslog-ng stop
start_cmd=service xinetd start

This is still an issue on Webmin 1.770 as all the "service" style commands there intact and all our systems keep sending us annoying messages... :(

Was this a new install, or an upgrade? The commands don't get modified on an upgrade.

It was completely new install from CentOS 7.x template available through Cloudmin UI.

That's very unusual, as the default config for CentOS 7 defintely uses systemctl commands.

Which exact VM template did you use?

CentOS 7.0 64-bit KVM instance with base OS

Could be that Webmin is detecting your OS incorrectly. Can you post the /etc/webmin/config file from your system?

Sure:

cat /etc/webmin/config
passwd_cindex=2
passwd_uindex=0
real_os_type=CentOS Linux
real_os_version=7.2.1511
mobile_theme=virtual-server-mobile
cache_mods=virtual-server
webprefix=
logfiles=1
os_version=15.2
passwd_file=/etc/shadow
tempdelete_days=7
cache_size=52428800
by_view=0
log=1
os_type=redhat-linux
md5pass=1
theme=xenlayer-theme
ld_env=LD_LIBRARY_PATH
lang=en.UTF-8
find_pid_command=ps auwwwx | grep NAME | grep -v grep | awk '{ print $2 }'
path=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
passwd_mindex=4
passwd_pindex=1
referers_none=1
product=webmin
hostnamemode=0
help_width=
dateformat=dd/mon/yyyy
showhost=0
nofeedbackcc=0
hostnamedisplay=
feedback_to=custom@email.com
sysinfo=0
showlogin=0
help_height=

But I have already edited commands in /etc/webmin/apache/config.

Anyway, what is the status of the following files under /etc/webmin/ directory:

./postgresql/config
./syslog-ng/config
./syslog/config
./bind8/config
./xinetd/config
./lpadmin/config
./ipsec/config
./proftpd/config
./samba/config
./sshd/config
./dhcpd/config
./ldap-server/config
./iscsi-tgtd/config

which also have the following obsolete commands:

stop_cmd=service named stop
start_cmd=service named start
stop_cmd=service dhcpd stop
restart_cmd=service dhcpd restart
start_cmd=service dhcpd start
start_cmd=service ipsec start
stop_cmd=service ipsec stop
restart_cmd=service ipsec restart
start_cmd=service tgtd start
stop_cmd=service tgtd stop
restart_cmd=service tgtd restart
start_cmd=service slapd start
stop_cmd=service slapd stop
apply_cmd=service slapd restart
stop_cmd=service cups stop
start_cmd=service cups start
stop_cmd=service postgresql stop
start_cmd=service postgresql start
start_cmd=service proftpd start
stop_cmd=service proftpd stop
stop_cmd=service smb stop
start_cmd=service smb start
start_cmd=service sshd start
stop_cmd=service sshd stop
restart_cmd=service rsyslog reload
start_cmd=service rsyslog start
start_cmd=service syslog-ng start
stop_cmd=service syslog-ng stop

and the system is occasionally giving or sending notices because of them?

Please have them all changed for CentOS 7.x. You can leave them on Debian based systems, but RHEL will never return to "Service" style command and there is no point of torturing us, Virtulmin/Webmin system administrators - we can't turn of root mail, at the same time it is sending so many unnecessary messages because of these commands.

Those other config files will be updated in the next Webmin release.

However, I just did a fresh install of Webmin 1.770 onto a VM created in Cloudmin from the CentOS 7 64-bit KVM template, and /etc/webmin/apache/config looked correct :

test_manual=0
show_list=0
mime_types=/etc/mime.types
auto_mods=1
stop_cmd=systemctl stop httpd.service
pid_file=/run/httpd/httpd.pid
test_apachectl=1
max_servers=100
httpd_dir=/etc/httpd
start_cmd=systemctl start httpd.service
show_order=0
test_always=0
apachectl_path=/usr/sbin/apachectl
show_names=0
test_config=1
apply_cmd=systemctl reload httpd.service
httpd_path=/usr/sbin/httpd
allow_virtualmin=0

Those other config files will be updated in the next Webmin release.

Thanks Jamie!

However, I just did a fresh install of Webmin 1.770 onto a VM created in Cloudmin from the CentOS 7 64-bit KVM template, and /etc/webmin/apache/config looked correct

Strange. The only thing is coming to my mind then is that probably I downloaded that image long time ago, which most probably is true, because there were lot's of updates.

Could you make Cloudmin check if the image file is too old and either (1) to automatically download the newest one or (2) output a recommenddation to update the file?

The image file itself shouldn't actually matter here, as long as it was still CentOS 7.