Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [~amd64] NFS server broken again :(
Date: Tue, 28 Oct 2014 01:05:50
Message-Id: CADPrc81JaungiacAFJ+Q5yVd=VcK+Gc5jrhj+bRFRFGQwHuFAg@mail.gmail.com
In Reply to: [gentoo-user] Re: [~amd64] NFS server broken again :( by walt
1 On Mon, Oct 27, 2014 at 5:46 PM, walt <w41ter@×××××.com> wrote:
2 > On 10/27/2014 12:56 PM, Canek Peláez Valdés wrote:
3 >> On Mon, Oct 27, 2014 at 1:38 PM, walt <w41ter@×××××.com> wrote:
4 >>> Last night when I powered off my machines NFS was working perfectly. Today
5 >>> it's broken again for the nth time:
6 >>>
7 >>> #systemctl status nfs-server
8 >>> ● nfs-server.service - NFS server and services
9 >>> Loaded: loaded (/usr/lib64/systemd/system/nfs-server.service; enabled)
10 >>> Active: failed (Result: exit-code) since Mon 2014-10-27 11:50:38 PDT; 25min ago
11 >>> Process: 896 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
12 >>> Process: 893 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
13 >>> Process: 939 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=1/FAILURE)
14 >
15 >> I think I know the answer. Some days ago you moved /etc/conf.d for
16 >> NetworkManager to work, right? Where does the environment variable
17 >> RPCNFSDARGS is defined? I'm willing to bet that is in a /etc/conf.d
18 >> file.
19 >>
20 >> Could you please post here the contents of nfs-server.service, and if
21 >> it exists, the files inside /etc/systemd/system/nfs-server.service.d
22 >> and their contents?
23 >
24 > Bingo again :) Your question led me to the answer, which I think is a bug
25 > in /usr/lib64/systemd/system/nfs-server.service.
26 >
27 > Here's why the bug showed up just this morning: way back at the beginning
28 > of systemd I stole some .service files from RedHat Fedora, including one
29 > named 'nfs.service'.
30
31 Gentoo nfs-utils package still doesn't include a systemd unit file,
32 really? With a perfunctory look at
33 /usr/portage/net-fs/nfs-utils/files, I see several *.service files. I
34 highly recommend using the unit files provided by the Gentoo devs.
35
36 > Turns out the foreign RedHat file was starting rpcbind for me all those
37 > months and, when I deleted it last night, rpcbind didn't get started this
38 > morning by nfs-server.service from gentoo (which I think is a bug).
39 >
40 > #cat nfs-server.service
41 > [Unit]
42 > Description=NFS server and services
43 > Requires= network.target proc-fs-nfsd.mount rpcbind.target
44 > Requires= nfs-mountd.service
45 > Wants=rpc-statd.service nfs-idmapd.service rpc-gssd.service rpc-svcgssd.service
46 > Wants=rpc-statd-notify.service
47 >
48 > After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
49 > After= nfs-idmapd.service rpc-statd.service
50 > After= rpc-gssd.service rpc-svcgssd.service
51 > Before= rpc-statd-notify.service
52 >
53 > [Service]
54 > EnvironmentFile=/etc/conf.d/nfs
55 >
56 > Type=oneshot
57 > RemainAfterExit=yes
58 > ExecStartPre=/usr/sbin/exportfs -r
59 > ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
60 > ExecStop=/usr/sbin/rpc.nfsd 0
61 > ExecStopPost=/usr/sbin/exportfs -au
62 > ExecStopPost=/usr/sbin/exportfs -f
63 >
64 > ExecReload=/usr/sbin/exportfs -r
65 >
66 > [Install]
67 > WantedBy=multi-user.target
68 >
69 >
70 > I can see that rpcbind.target is Required, but NOT rpcbind.service. AFAICT
71 > rpc.target does nothing (please explain if I'm wrong about that).
72
73 I have no idea; I haven't set an NFS server in years. However, most
74 target units usually are kinda "virtuals"; the bring other units up.
75
76 > BTW, /etc/conf.d/nfs doesn't define RPCNFSDARGS because it is intended
77 > for use by openrc (another bug?):
78
79 Something should define RPCNFSDARGS; perhaps a drop-in?
80
81 > #cat /etc/conf.d/nfs
82 > # /etc/conf.d/nfs
83 >
84 > # If you wish to set the port numbers for lockd,
85 > # please see /etc/sysctl.conf
86 >
87 > # Optional services to include in default `/etc/init.d/nfs start`
88 > # For NFSv4 users, you'll want to add "rpc.idmapd" here.
89 > NFS_NEEDED_SERVICES="rpc.idmapd"
90 >
91 > # Number of servers to be started up by default
92 > OPTS_RPC_NFSD="8"
93 >
94 > # Options to pass to rpc.mountd
95 > # ex. OPTS_RPC_MOUNTD="-p 32767"
96 > OPTS_RPC_MOUNTD=""
97 >
98 > # Options to pass to rpc.statd
99 > # ex. OPTS_RPC_STATD="-p 32765 -o 32766"
100 > OPTS_RPC_STATD=""
101 >
102 > # Options to pass to rpc.idmapd
103 > OPTS_RPC_IDMAPD=""
104 >
105 > # Options to pass to rpc.gssd
106 > OPTS_RPC_GSSD=""
107 >
108 > # Options to pass to rpc.svcgssd
109 > OPTS_RPC_SVCGSSD=""
110 >
111 > # Options to pass to rpc.rquotad (requires sys-fs/quota)
112 > OPTS_RPC_RQUOTAD=""
113 >
114 > # Timeout (in seconds) for exportfs
115 > EXPORTFS_TIMEOUT=30
116 >
117 > # Options to set in the nfsd filesystem (/proc/fs/nfsd/).
118 > # Format is <option>=<value>. Multiple options are allowed.
119 > #OPTS_NFSD="nfsv4leasetime=30 max_block_size=4096"
120 >
121 >
122 > Thanks Canek!
123
124 Walt, from time to time run "systemd-delta" and see what
125 configurations of yours differ from upstream (either systemd and/or
126 Gentoo). I think you should be using nfs-utils' included unit files.
127
128 Regards.
129 --
130 Canek Peláez Valdés
131 Profesor de asignatura, Facultad de Ciencias
132 Universidad Nacional Autónoma de México