Problem after update: sudo /usr/local/hestia/bin/v-update-sys-queue restart

Hello,

I receive every few minutes emails with subject line:
sudo /usr/local/hestia/bin/v-update-sys-queue restart
sudo /usr/local/hestia/bin/v-update-sys-queue backup

Content of this email is as follows:
Usage: v-update-sys-queue QUEUE

In the hestia/error.log, I see the following:

2021-12-07 21:32:01 v-update-sys-queue  'restart ' [Error 1]
2021-12-07 21:30:01 v-update-sys-queue  'restart ' [Error 1]
2021-12-07 21:30:01 v-update-sys-queue  'backup ' [Error 1]
2021-12-07 21:28:01 v-update-sys-queue  'restart ' [Error 1]
2021-12-07 21:26:02 v-update-sys-queue  'restart ' [Error 1]
2021-12-07 21:25:01 v-update-sys-queue  'backup ' [Error 1]
2021-12-07 21:24:01 v-update-sys-queue  'restart ' [Error 1]
2021-12-07 21:22:01 v-update-sys-queue  'restart ' [Error 1]
2021-12-07 21:20:01 v-update-sys-queue  'backup ' [Error 1]
2021-12-07 21:20:01 v-update-sys-queue  'restart ' [Error 1]

I do not know why it does this suddenly. As I am lack of time to trace this problem, I place this message here. May be someone knows a simple trick to stop this.

Error 1 is basicly:

1 E_ARGS Not enough arguments provided

I have honestly no idea where this comes from, never seen.

Hi ScIT,

Yes, thanks. I saw than and had a mind blowing thought that this is a default cron script tht cannot issue this error. But I wonder if there is some permission missing that I need to check, which it may require and does not have. However, this was just a superficial thought. I think I will sit down after 2 days and track the issue down.

What happens if you run the commands as root manualy?

Thanks.

bash -x /usr/local/hestia/bin/v-update-sys-queue restart

The earlier part of out contains all parameters from the hestia.conf. Only the last part seems of interest as below:

+ [[ ! WEB_SYSTEM =~ ^ *# ]]
+ [[ -n WEB_SYSTEM ]]
+ rhs=''\''apache2'\'''
+ rhs=''\''apache2'\'''
+ rhs=''\''apache2'
+ rhs=apache2
+ declare -g WEB_SYSTEM=apache2
+ IFS='= '
+ read -r lhs rhs
+ check_args 1 1 QUEUE
+ '[' 1 -gt 1 ']'
++ grep '/usr/local/hestia/bin/v-update-sys-queue backup'
++ grep -v grep
++ ps auxf
+ b_task=
++ wc -l
++ grep -v sudo
++ echo ''
+ b_task=1
++ grep '/usr/local/hestia/bin/v-update-sys-queue dns'
++ grep -v grep
++ ps auxf
+ d_task=
++ wc -l
++ grep -v sudo
++ echo ''
+ d_task=1
+ '[' 1 -gt 2 ']'
+ '[' 1 -gt 2 ']'
+ case $queue in
+ bash /usr/local/hestia/data/queue/restart.pipe
+ exit

I think that there must be a difference of running as a root and sudo admin. There must be something missing.

There are other emails, the third of its type, with subject line:

sudo /usr/local/hestia/bin/v-update-sys-rrd

Content:

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

It appears that the above gives some more clues on permissions or pass.

Checking contents of /etc/sudoers.d/admin (r–r----- / root:root), I have:

# Created by hestia installer
Defaults env_keep="VESTA"
Defaults env_keep+="HESTIA"
Defaults:admin !syslog
Defaults:admin !requiretty
Defaults:root !requiretty

# sudo is limited to hestia scripts
admin   ALL=NOPASSWD:/usr/local/vesta/bin/*
admin   ALL=NOPASSWD:/usr/local/hestia/bin/*

Uh, I see in /etc/sudo.conf:

#includedir /etc/sudoers.d

I now change this to

includedir /etc/sudoers.d

Let us see if this brings me any luck to stop the email bomb every 3 minutes!

After activating the avobe include, I got in the subject:

sudo /usr/local/hestia/bin/v-update-sys-queue restart

following content in the body of email:

/etc/sudoers: syntax error near line 30 <<<

sudo: parse error in /etc/sudoers near line 30
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

The include directive should be commented as mentioned:

https://askubuntu.com/questions/930768/adding-local-content-in-etc-sudoers-d-instead-of-directly-modifying-sodoers-fi

Vow, the script has become really nasty. After commenting the include above, it is not generating any emails anymore. This means I have changed to something wrong and have reset to the original. But that cannot be a solution.

Will report tom, if this happens again and under what circumstances, or if it does not happen. Amazing!

In the /var/log/cron, there appeared a stricking following difference:

Dec  7 22:22:01 server CRON[863748]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 22:20:01 server CRON[860440]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 22:18:01 server CRON[857875]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 22:16:01 server CRON[854981]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 22:14:01 server CRON[852454]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 22:12:01 server CRON[850031]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 22:10:01 server CRON[834277]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 22:08:01 server CRON[822488]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 22:06:01 server CRON[820051]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 22:04:01 server CRON[817723]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 22:02:01 server CRON[815222]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 22:00:01 server CRON[812192]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 21:58:01 server CRON[809712]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)

I did try to generate out from Webmin Cron page of this script to find out what it outputs as admin. Since the above change, I get no emails anymore.

Finally tracked the problem here:

Dec  7 10:36:01 server CRON[487546]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 10:35:01 server CRON[487436]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup^M)
Dec  7 10:34:01 server CRON[487388]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 10:32:01 server CRON[487296]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 10:30:01 server CRON[486944]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart^M)
Dec  7 10:30:01 server CRON[486943]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup^M)
Dec  7 10:28:01 server CRON[485340]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 10:26:01 server CRON[408616]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 10:25:01 server CRON[377171]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup)
Dec  7 10:24:01 server CRON[376908]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 10:22:01 server CRON[367185]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)
Dec  7 10:20:01 server CRON[365267]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart)

When I made an update, afterwards, it began to log above with “restart^M)”. This was not the case before.

It began to send me emails after I added a forward. Until then, there were resting emails in the queue, which I had deleted. Before deletion, I did not go through all those emails. Now I know what and how this problem got triggered.

There should be a space added in the line that causes “restart^M)”.

But I do not know what and why!

This is my contents of sudoers

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "@include" directives:

@includedir /etc/sudoers.d

# Added by cloud-init v. 20.4.1 on Fri, 03 Sep 2021 07:11:29 +0000
#includedir /etc/sudoers.d

Hi Eris,

I will try tom. with your sudoer file. I see that it has includes twice, @ and #. I think this was due to some backward compatibility, but cannot remember while reading through fast.

But Eris, can you speculate what could be the reason why I see “restart^M)” after the update? Then, I had try to manually run from Webmin to see the output as admin visually. No output, my mistake in thoughts. But could it be that there was a space inserted and then it did this above?

BTW, since one hour no more emails like before, which began to appear after I added a correct forward. This is strange.

Hello Eris,

your sudoers file does not work in my Ubunto 20.4 LTS. I get the following message by email:

/etc/sudoers: syntax error near line 27 <<<
sudo: parse error in /etc/sudoers near line 27
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

In /var/log/cron, I get the following:

Dec  8 03:44:01 server CRON[2872523]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:42:01 server CRON[2872259]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:40:01 server CRON[2871915]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup)
Dec  8 03:40:01 server CRON[2871914]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:38:01 server CRON[2871613]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:36:01 server CRON[2871320]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:35:01 server CRON[2871001]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup)
Dec  8 03:34:01 server CRON[2870960]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:32:01 server CRON[2870697]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:30:01 server CRON[2870091]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup)
Dec  8 03:30:01 server CRON[2870090]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:30:01 server CRON[2870089]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue webstats^M)
Dec  8 03:28:01 server CRON[2870045]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:26:01 server CRON[2869782]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:25:01 server CRON[2869474]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup)
Dec  8 03:24:01 server CRON[2869214]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:22:01 server CRON[2869175]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:20:01 server CRON[2868607]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue backup)
Dec  8 03:20:01 server CRON[2868606]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:18:01 server CRON[2868340]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )
Dec  8 03:16:01 server CRON[2868280]: (admin) CMD (sudo /usr/local/hestia/bin/v-update-sys-queue restart )

The end of line gives a clue as to something in the code misses. But I did not get any emails after there is no restart at the end of line “restart^M)

I can now corelate this trigger of emails and end of line stamp with upgrading the php version 7.4 to 8.0 becased on the time I did the update and when emails started pouring in my inbox. Although I am not definate. I need more time to play and repeat. Since this was done on my production server, I am restricted with the playground.

This config file is for Ubuntu 20.04

There should be no reason why sudoers have been changed during the change from 7.4 to 8.0.

Also the restart^M I have never seen before

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

Hi yes, that default file works. In your file, I wonder how you made the sudoers file with @includedir make it work because it throws exception on my server.

The default file did not change. I had uncommented includedir and then commented back. That is all.

It appears that the problem is somewhere else.

This is the config supplied by Hetzner and their Debian cloud servers…