LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 11-08-2019, 08:41 AM   #1
Shaggy1
LQ Newbie
 
Registered: Oct 2010
Posts: 24

Rep: Reputation: 1
'Active (enabled)' status - what is it, how to avoid it ?


Hi
Having just installed 7.7.1908 I notice that the nfs service (also network service and probably others) are marked as Active (enabled) when the status is queried:

systemctl status nfs
‚óŹ nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (exited) since Wed 2019-11-06 12:34:47 GMT; 1 day 2h ago
Process: 2181 ExecStartPost=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
Process: 1968 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 1927 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 1968 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/nfs-server.service

Nov 06 12:34:47 lb-cam-bca-kstest systemd[1]: Starting NFS server and services...
Nov 06 12:34:47 lb-cam-bca-kstest systemd[1]: Started NFS server and services.


This link:
https://unix.stackexchange.com/quest...ystemd-service
tells me:

"State active (exited) means that systemd has successfully run the commands but that it does not know there is a daemon to monitor.

If there is you must define it in the unit file by configuring the Type and ExecStart options appropriately according to whether the process you start is the main proces, forks child processes and exits etc."

It seems there is already a Unit file for nfs in /usr/lib/systemd/system/nfs.service:

Type and ExecStart are set as follows:
Type=oneshot
ExecStartPre=-/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
ExecStartPost=-/bin/sh -c 'if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi'


Is this status to be expected for nfs on centos 7?

Does anyone know how to get systemd to recognise the nfs service ?

Given systemd does not recognise nfs should I be using a different service to configure nfs ?
 
Old 11-08-2019, 06:19 PM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 3,596

Rep: Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972
Quote:
Originally Posted by Shaggy1 View Post

Does anyone know how to get systemd to recognise the nfs service ?

Given systemd does not recognise nfs should I be using a different service to configure nfs ?
I start nfs with systemctl start nfs.

What do you mean by "recognise"?
What problem do you have?
Have you read the documentation?
 
Old 11-08-2019, 06:33 PM   #3
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,972

Rep: Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352Reputation: 1352
Not sure what you're asking about. The subject asks about "enabled" and then you talk about "exited"

It appears that the service has been started:
Code:
Nov 06 12:34:47 lb-cam-bca-kstest systemd[1]: Starting NFS server and services...
Nov 06 12:34:47 lb-cam-bca-kstest systemd[1]: Started NFS server and services.
 
Old 11-11-2019, 10:28 AM   #4
Shaggy1
LQ Newbie
 
Registered: Oct 2010
Posts: 24

Original Poster
Rep: Reputation: 1
Hi
Thank you for your replies

> Not sure what you're asking about. The subject asks about "enabled" and then you talk about "exited"
Sorry the 'Active (enabled)' in the question was a mistake, I meant 'Active (exited)'.

> What problem do you have?
As mentioned the service does seem to be started, so there does not seem to be an immediate problem with the service itself.

I was, however, wondering:
a) exactly what it is which causes a service to have this status and why.
Most services when running indicate: 'active (running)'
(and also the legacy command 'service <servicename> status' successfully forwards to systemctl - in the case if nfs this does not work)
b) whether this matters, or is likely to be an issue.
c) if it is likely to be an issue how can I stop it from being so

> What do you mean by "recognise"?
I was referring to the statement "does not know there is a daemon to monitor." in the link I mentioned.
How do I get it to know there is a daemon to monitor ?

> Have you read the documentation?
I did read through this documentation, but I could not see any reference to 'active (exited)' status or how to tell it there is a daemon to monitor. I could well have missed, so will look again more thoroughly. There is also a link:
https://access.redhat.com/documentat...emd-unit_files
which may well be telling me the answer, but I'm not seeing it, so I'll try that again.
 
Old 11-11-2019, 10:49 AM   #5
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 3,596

Rep: Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972Reputation: 972
Quote:
Originally Posted by Shaggy1 View Post
a) exactly what it is which causes a service to have this status and why.
Most services when running indicate: 'active (running)'
b) whether this matters, or is likely to be an issue.
c) if it is likely to be an issue how can I stop it from being so
In short, all is fine. I will try to explain (as much as I understand it).

The nfs service definition includes
Code:
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
oneshot means that the service is considered to be up ("active") after the main process rpc.nfsd exits. I guess that rpc.nfsd starts one or more processes, then exits, so that there is no process that the nfs service can monitor. Which does not mean that the service failed to start.
Apart from the call to rpc.nfsd, the purpose of the nfs service is probably to start other services as dependencies.

With RemainAfterExit, the service is considered active even when all its processes exit, not only the main one (as far as I understand this).

See https://www.freedesktop.org/software...d.service.html for more details.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect my non wireless enabled pc to my wireless enabled pc via ethernet? Help me im dumb Linux - Networking 3 10-21-2012 05:58 PM
[SOLVED] Guys need your assistance in figuring out the active CPU enabled in the server srajeshkumar Linux - Server 1 03-31-2011 07:07 AM
mdadm: how to avoid complete rebuild of RAID 6 array (6/8 active devices) pbwtortilla Linux - Server 4 12-25-2009 09:06 PM
Do you need STP enabled to run active active bonding one CentOS4? ch19251 Linux - Networking 1 06-17-2009 10:30 AM
[sda] Write cache: enabled, read cache: enabled, doesn't support DPO seskissinger Linux - Software 3 05-16-2008 02:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 02:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration