RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1443055 - Exact error not reflected in systemctl status or journctl -xe output
Summary: Exact error not reflected in systemctl status or journctl -xe output
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: vsftpd
Version: 7.3
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Ondřej Lysoněk
QA Contact: Patrik Moško
URL:
Whiteboard:
Depends On:
Blocks: 1534569 1549614 1642465
TreeView+ depends on / blocked
 
Reported: 2017-04-18 12:00 UTC by Yogita
Modified: 2018-10-30 07:54 UTC (History)
5 users (show)

Fixed In Version: vsftpd-3.0.2-25.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1642465 (view as bug list)
Environment:
Last Closed: 2018-10-30 07:53:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch (780 bytes, patch)
2018-04-05 08:23 UTC, Ondřej Lysoněk
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3037 0 None None None 2018-10-30 07:54:19 UTC

Description Yogita 2017-04-18 12:00:47 UTC
Description of problem:
-If there is an error in /etc/vsftpd.conf, the unit won't start and neither systemctl status nor journalctl contain helpful output. 
-Starting the daemon by hand produces: 500 OOPS: unrecognised variable in config file: FOO.
-The systemctl status output should contain the error output.

Version-Release number of selected component (if applicable):
[root@client ~]# rpm -q systemd
systemd-219-30.el7.x86_64

[root@client ~]# rpm -q vsftpd
vsftpd-3.0.2-21.el7.x86_64

How reproducible:
Always.

Steps to Reproduce:
# echo "foo=bar" >> /etc/vsftpd/vsftpd.conf

# systemctl restart vsftpd
Job for vsftpd.service failed because the control process exited with error code. See "systemctl status vsftpd.service" and "journalctl -xe" for details.


Actual results:
# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2017-04-18 17:23:22 IST; 45s ago
  Process: 3480 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf &>> /var/log/messages (code=exited, status=2)
Apr 18 17:23:22 client.example.com systemd[1]: Starting Vsftpd ftp daemon...
Apr 18 17:23:22 client.example.com systemd[1]: vsftpd.service: control process exited, code=exited status=2
Apr 18 17:23:22 client.example.com systemd[1]: Failed to start Vsftpd ftp   daemon.  <--No reason behind failure
Apr 18 17:23:22 client.example.com systemd[1]: Unit vsftpd.service entered failed state.
Apr 18 17:23:22 client.example.com systemd[1]: vsftpd.service failed.

# journalctl -u vsftpd
-- Logs begin at Tue 2017-04-18 17:02:50 IST, end at Tue 2017-04-18 17:23:22 IST. --
Apr 18 17:23:22 client.example.com systemd[1]: Starting Vsftpd ftp daemon...
Apr 18 17:23:22 client.example.com systemd[1]: vsftpd.service: control process exited, code=exited status=2
Apr 18 17:23:22 client.example.com systemd[1]: Failed to start Vsftpd ftp daemon.     <--- Same as systemctl status vsftpd
Apr 18 17:23:22 client.example.com systemd[1]: Unit vsftpd.service entered failed state.
Apr 18 17:23:22 client.example.com systemd[1]: vsftpd.service failed.

But executing below command givens proper reason -
# /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 
500 OOPS: unrecognised variable in config file: foo


Expected results:
"systemctl status vsftpd" and "journalctl -u vsftpd" should have displayed error indicating reason behind failure.

Additional info:
Customer is facing issue understanding reason behind failure of service with such error message.

Comment 2 Lukáš Nykrýn 2017-04-18 13:14:14 UTC
Huh it looks that vsftpd is writing to STDIN

[0 root@qeos-193 test]# /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 
500 OOPS: unrecognised variable in config file: foo
[0 root@qeos-193 test]# /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 0>/dev/null
[0 root@qeos-193 test]# 

If you want a workaround then you can use something like this:
[0 root@qeos-193 test]# cat /etc/systemd/system/vsftpd.service
[Unit]
Description=Vsftpd ftp daemon
After=network.target

[Service]
Type=forking
ExecStart=/bin/bash -c "/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 0>&1"

[Install]
WantedBy=multi-user.target


and then:

[0 root@qeos-193 test]# journalctl -u vsftpd | grep variable
dub 18 09:11:24 qeos-193.lab.eng.rdu2.redhat.com bash[15346]: 500 OOPS: unrecognised variable in config file: foo

Comment 3 Martin Sehnoutka 2017-04-18 14:36:09 UTC
Well in vsftpd, the file descriptor 0 is supposed to be the command socket as defined here:
https://pagure.io/vsftpd/blob/master/f/defs.h#_6

And the error is written into this fd as you can see here:
https://pagure.io/vsftpd/blob/master/f/utility.c#_46

Unfortunately right after start-up the fd 0 is still STDIN.

Comment 5 Tomáš Hozza 2017-07-21 15:36:52 UTC
Is there any way to enhance the service file to not use bash for executing vsftpd, but rather use some systemd functionality?

Comment 6 Martin Sehnoutka 2017-07-24 08:19:23 UTC
There is no way that I'd be aware of. I think we need to fix this in vsftpd if we really want to change it.

I was also discussing this with a systemd maintainer and he also said, that systemd does not have any feature to handle this case and vsftpd should be fixed instead.

Comment 7 Ondřej Lysoněk 2017-08-08 08:54:10 UTC
I think we could solve this in vsftpd simply by redefining VSFTP_COMMAND_FD to 1.
https://pagure.io/vsftpd/blob/master/f/defs.h#_6

This should work both in standalone mode and in the mode where vsftpd is run from inetd.

In standalone mode the file descriptor 1 points to stdout during the time when configuration is loaded, so any errors written to it will be picked up by systemd. After that, file descriptor 1 points to /dev/null and after a connection is established, the connection file descriptor is duplicated to FD 1, as well as to FD 0 and 2, so it doesn't matter which FD we use:
https://pagure.io/vsftpd/blob/master/f/standalone.c#_226-237

When run from inetd, vsftpd should have the connection FD duplicated to both FD 0 and 1, so there should be no regressions in this case either. However the error will not be sent to syslog, but to the connected client. We have a separate RFE to get these errors, which are sent over the connection, to syslog as well:
https://bugzilla.redhat.com/show_bug.cgi?id=1318198

I also tested it and it seems to work.

Comment 10 Ondřej Lysoněk 2018-04-05 08:23:27 UTC
Created attachment 1417556 [details]
patch

Comment 15 errata-xmlrpc 2018-10-30 07:53:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:3037


Note You need to log in before you can comment on or make changes to this bug.