Bug 833099

Summary: yast fails to enable nfs client services
Product: [openSUSE] openSUSE Tumbleweed Reporter: Olaf Hering <ohering>
Component: YaST2Assignee: Neil Brown <nfbrown>
Status: RESOLVED DUPLICATE QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P5 - None CC: fcrozat, jsuchome, locilka, systemd-maintainers
Version: 13.1 Milestone 3   
Target Milestone: ---   
Hardware: x86-64   
OS: Linux   
Whiteboard:
Found By: Outsourced Testing Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Olaf Hering 2013-08-02 14:20:45 UTC
Current Factory:

yast -> system -> runlevel, it fails to enable nfs client services. I think the reason is that nfs has some dependencies, which should be enabled along with nfs. Maybe we had this argument already that stuff should be enabled recursivly to satisfy the request (for nfs in this case).


What I see in the logs is like that:

2013-08-02 16:10:39 <1> linux-423m(2131) [YCP] runlevel/ui.ycp:1484 Current service: nfs / `enable
2013-08-02 16:10:39 <2> linux-423m(2131) [ui-shortcuts] YShortcutManager.cc(checkShortcuts):85 Not enough widgets with valid shortcut characters - no check
2013-08-02 16:10:39 <1> linux-423m(2131) [YCP] runlevel/ui.ycp:890 nfs -> start
2013-08-02 16:10:39 <1> linux-423m(2131) [YCP] Service.ycp:378 Running service initscript nfs start 2>&1 1>'/tmp/YaST2-02131-8fufjf/runlevel_out_nfs'
2013-08-02 16:10:39 <1> linux-423m(2131) [liby2util++] ExternalProgram.cc(start_program):202 Executing '/bin/sh' '-c' 'TERM=dumb /bin/systemctl start 2>&1 1>'/tmp/YaST2-02131-8fufjf/runlevel_out_nfs' nfs.service'
2013-08-02 16:10:39 <1> linux-423m(2131) [liby2util++] ExternalProgram.cc(checkStatus):361 pid 2645 exited with status 1
2013-08-02 16:10:39 <1> linux-423m(2131) [YCP] Service.ycp:413 Time spent: 100 msecs, retcode: 1
2013-08-02 16:10:39 <1> linux-423m(2131) [agent-process] ProcessAgent.cc(Execute):521 Releasing Process object 2645...
2013-08-02 16:10:39 <3> linux-423m(2131) [bash] ShellCommand.cc(shellcommand):78 nfs.service is not a native service, redirecting to /sbin/chkconfig.
2013-08-02 16:10:39 <3> linux-423m(2131) [bash] ShellCommand.cc(shellcommand):78 Executing /sbin/chkconfig nfs --level=5
2013-08-02 16:10:39 <1> linux-423m(2131) [ui] YPushButton.cc(setFunctionKey):188 Guessing button role YOKButton for YPushButton "OK" at 0x2c196d0 from function key F10
2013-08-02 16:10:46 <1> linux-423m(2131) [YCP] runlevel/ui.ycp:1404 RET: `enable


root@linux-423m:~ # TERM=dumb /bin/systemctl start 2>&1 1> 'runlevel_out_nfs' nfs.service
Job for nfs.service failed. See 'systemctl status nfs.service' and 'journalctl -xn' for details.
root@linux-423m:~ # cat runlevel_out_nfs
root@linux-423m:~ # 

root@linux-423m:~ # journalctl -xn
-- Logs begin at Fr 2012-08-31 15:56:07 CEST, end at Fr 2013-08-02 18:07:47 CEST. --
Aug 02 16:12:04 linux-423m dbus[766]: [system] Activating via systemd: service name='org.freedesktop.ModemManager1' unit='dbus-org.freedesktop.ModemManager1.service'
Aug 02 16:12:04 linux-423m dbus[766]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.ModemManager1.service': Unit dbus-org.freedesktop.ModemManager1.service failed to load: No such file or directory. See system logs and 'systemctl status db
Aug 02 16:12:47 linux-423m systemd[1]: Starting LSB: NFS client services...
-- Subject: Unit nfs.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs.service has begun starting up.
Aug 02 16:12:47 linux-423m nfs[2698]: Starting NFS client services:portmap/rpcbind is not running
Aug 02 16:12:47 linux-423m nfs[2698]: ..missing
Aug 02 16:12:47 linux-423m systemd[1]: nfs.service: control process exited, code=exited status=3
Aug 02 16:12:47 linux-423m systemd[1]: Failed to start LSB: NFS client services.
-- Subject: Unit nfs.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
-- 
-- Unit nfs.service has failed.
-- 
-- The result is failed.
Aug 02 16:12:47 linux-423m systemd[1]: Unit nfs.service entered failed state.
Aug 02 16:14:04 linux-423m dbus[766]: [system] Activating via systemd: service name='org.freedesktop.ModemManager1' unit='dbus-org.freedesktop.ModemManager1.service'
Aug 02 16:14:04 linux-423m dbus[766]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.ModemManager1.service': Unit dbus-org.freedesktop.ModemManager1.service failed to load: No such file or directory. See system logs and 'systemctl status db
root@linux-423m:~ # systemctl status nfs.service
nfs.service - LSB: NFS client services
   Loaded: loaded (/etc/init.d/nfs)
  Drop-In: /run/systemd/generator/nfs.service.d
           └─50-insserv.conf-$remote_fs.conf
   Active: failed (Result: exit-code) since Fr 2013-08-02 16:12:47 CEST; 3min 47s ago
  Process: 2698 ExecStart=/etc/init.d/nfs start (code=exited, status=3)

Aug 02 16:12:47 linux-423m systemd[1]: Starting LSB: NFS client services...
Aug 02 16:12:47 linux-423m nfs[2698]: Starting NFS client services:portmap/rpcbind is not running
Aug 02 16:12:47 linux-423m systemd[1]: nfs.service: control process exited, code=exited status=3
Aug 02 16:12:47 linux-423m systemd[1]: Failed to start LSB: NFS client services.
Aug 02 16:12:47 linux-423m systemd[1]: Unit nfs.service entered failed state.
root@linux-423m:~ # 


oddly enough, the list of services does now show portmap or rpcbind. Has yast code to detect that nfs needs portmap/rpcbind? It did not offer to install the required packages to enable nfs in the runlevel editor. Perhaps some extra code can be added so that it knows that nfs has dependencies.
Comment 1 Olaf Hering 2013-08-02 14:24:16 UTC
if I go to the nfs-client screen, it recognizes the nfs entry in fstab, and if I just leave the screen nfs is enabled afterwards in the runlevel editor.
Comment 3 Lukas Ocilka 2013-08-15 07:38:19 UTC
Systemd/nfs should care about the dependencies.
Yast sets the desired state of a service, what such service needs
it just between systemd and that service. Yast will not go through
all the deps and start/enable everything - that's impossible because
Yast would not know what to stop/disable if user decides to disable
some service. This has to be solved on a different level.
Comment 4 Neil Brown 2013-09-02 02:43:58 UTC
Hi Frederick, 
have you any ideas here?

nfs depends on rpcbind, and /etc/init.d/nfs contains

# Required-Start: $network $portmap


systemd seems to understand "$portmap" to be a synonym for "rpcbind.target".
However if you 
 systemctl start nfs.service
it doesn't start rpcbind first.

Could there be some confusion between "rpcbind.service" and "rpcbind.target"?
Comment 5 Frederic Crozat 2013-09-02 16:28:44 UTC
(In reply to comment #4)
> Hi Frederick, 
> have you any ideas here?
> 
> nfs depends on rpcbind, and /etc/init.d/nfs contains
> 
> # Required-Start: $network $portmap

Those requirements should be mapped to other services, using /etc/insserv.conf. On Factory, systemd generator will create "fake" entries in /run/systemd/generator/ to ensure dependencies are correct (see /run/systemd/generator/remote-fs.target.d/50-insserv.conf.conf for instance)
 
> systemd seems to understand "$portmap" to be a synonym for "rpcbind.target".
> However if you 
>  systemctl start nfs.service
> it doesn't start rpcbind first.

> Could there be some confusion between "rpcbind.service" and "rpcbind.target"?

It looks like a bug in rpcbind.service which doesn't trigger rpcbind.target (rpcbind.socket was triggering it but rpcbind.service doesn't trigger rpcbind.socket). Might be worth updating both files, based on Fedora version:  http://pkgs.fedoraproject.org/cgit/rpcbind.git/tree/
Comment 6 Neil Brown 2013-09-05 04:14:07 UTC
I don't think the files from fedora make any useful difference.

The problem seems to be that "Required-Start" in /etc/init.d/nfs is interpreted by systemd  to mean "Before" which is independent from "Requires".

i.e. I can see no way to specify in /etc/init.d/nfs that rpcbind *must* be started first, only that if it is being started, that must happen before NFS is started.

So I cannot see any way to get "systemctl start nfs.service" to first start rpcbind, except by creating a real systemd nfs.service file.

Mind you, "chkconfig -a nfs" doesn't automatically add "rpcbind", so maybe this is correct behaviour.

So I have no idea how this is supposed to work.  We need to find someone who does.

Help?
Comment 7 Lukas Ocilka 2013-09-05 07:52:45 UTC
Frederic, would you help, please? ^^^
Comment 8 Frederic Crozat 2013-09-05 08:10:26 UTC
(In reply to comment #6)
> I don't think the files from fedora make any useful difference.

rpcbind.service MUST trigger rpcbind.target, otherwise systemd won't be able to properly map Requires-Start dependency on $portmap.

> The problem seems to be that "Required-Start" in /etc/init.d/nfs is interpreted
> by systemd  to mean "Before" which is independent from "Requires".

This is true, but if rpcbind.service isn't pulled by a dependency on rpcbind.target, it won't work either. This is one part of the problem.
 
> i.e. I can see no way to specify in /etc/init.d/nfs that rpcbind *must* be
> started first, only that if it is being started, that must happen before NFS is
> started.
> 
> So I cannot see any way to get "systemctl start nfs.service" to first start
> rpcbind, except by creating a real systemd nfs.service file.

I agree with you. And it was exactly the same in the sysvinit age : running manually one initscript was never pulling its dependencies.

Therefore, nfs initscript should be ported to systemd service.
 
> Mind you, "chkconfig -a nfs" doesn't automatically add "rpcbind", so maybe this
> is correct behaviour.

I'm not 100% sure chkconfig will enable all initscripts when used under systemd.
Comment 9 Neil Brown 2013-11-11 06:16:52 UTC
This is the same as bug#845475 and somewhat more progress has been made there, so resolving as a duplicate.

*** This bug has been marked as a duplicate of bug 845475 ***
Comment 10 Frederic Crozat 2013-12-06 15:26:03 UTC
Hmm, I think we should reopen it, because bnc#845475 fixes the nfs issue but the more generic issue of Requires-Start services not being enabled at all, in the dependency tree, is still present for any initscripts