# NFS using random ports[solved]

## Adel Ahmed

The rpc.mountd process has stopped using the port I had specified in /etc/conf.d/nfs:

tcp        0      0 0.0.0.0:55003           0.0.0.0:*               LISTEN      359/rpc.mountd      

tcp        0      0 0.0.0.0:45406           0.0.0.0:*               LISTEN      359/rpc.mountd      

tcp        0      0 0.0.0.0:50957           0.0.0.0:*               LISTEN      359/rpc.mountd      

udp        0      0 0.0.0.0:36574           0.0.0.0:*                           359/rpc.mountd      

udp        0      0 0.0.0.0:46209           0.0.0.0:*                           359/rpc.mountd      

udp        0      0 0.0.0.0:46843           0.0.0.0:*                           359/rpc.mountd  

/etc/conf.d/nfs:

OPTS_RPC_MOUNTD="-p 32767"

pc ~ # netstat -tulnp | grep -i 32767

pc ~ # 

the only change I recall making was enabling the kerberos flag in NFS-utilsLast edited by Adel Ahmed on Mon Apr 04, 2016 10:09 pm; edited 1 time in total

----------

## gerdesj

 *Adel Ahmed wrote:*   

> The rpc.mountd process has stopped using the port I had specified in /etc/conf.d/nfs:
> 
> tcp        0      0 0.0.0.0:55003           0.0.0.0:*               LISTEN      359/rpc.mountd      
> 
> tcp        0      0 0.0.0.0:45406           0.0.0.0:*               LISTEN      359/rpc.mountd      
> ...

 

Are you using systemd?  If so then look at the command line in the unit file, specifically the environment variable that would pass the port number in the Exec= and the name of the environment variable in the conf.d/nfs file.  If so, file bug if not sorry - no idea (but check the OpenRC script for a similar problem and file a bug if it's like that there as well)

[edit]Sorry, I'll spell it out for systemd: 

in /etc/conf.d/nfs

```
# Options to pass to rpc.mountd

# ex. OPTS_RPC_MOUNTD="-p 32767"

OPTS_RPC_MOUNTD="-p 32767"

```

In the unit:

```
ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS

```

RPCMOUNTDARGS != OPTS_RPC_MOUNTD

Ahh, here we go: https://bugs.gentoo.org/show_bug.cgi?id=544772

[edit]Sorry again:

grep for EnvironmentFile in /usr/lib/systemd/system/nfs*

and add all those env vars to your /etc/conf.d/nfs and set both the current ones and the ones in the units.  That way you'll carry on working if they are "fixed" in the future.  OR create your own override files in /etc/systemd/system/ as per the ssytemd docs.

Cheers

Jon

----------

## Adel Ahmed

I just editted the service file as you had mentiiend and things are back to normal now

thanks

----------

## gerdesj

 *Adel Ahmed wrote:*   

> I just editted the service file as you had mentiiend and things are back to normal now
> 
> thanks

 

Cool, glad to help.  Mark the topic [SOLVED] - it might help someone else in the future

----------

